Daily Thought Algorithm


This entry is part 4 of 7 in the series WPF Daily Thought

Here below is an outline of an algorithm for our Daily Thought program. I start with what happens when the program starts.

Program Start

  • get the current system date and put it into the variable
  • open the database
  • if we opened it then search for today’s day in the table
  • if we found it then put the data into a variable
  • display the date, thought, and the comments on the interface
  • if it cannot be found, simply display the date and empty strings
  • close the database
  • if we cannot open the database then display a message

One thing to note in the algorithm is that even if we don’t find the date in the database, we still change the date on the interface and display nothing (empty strings) on the interface. In this way the user will see that we do not have a thought for the date that they chose.

Next Button Click

When the user clicks the right arrow, they want to see the next thought which is the next day after the current day. What is the current day? We have stored that number in the interface in a hidden element. This algorithm is similar to the one above.

Series Navigation<< Daily Thought Back-EndDaily Thought C# Listing >>