Ever since I got my computer, I can no longer remember small reminders. For example, more than once my mother told me to look after the boiling water; I tell her yes and completely forget about everything. The result can be very catastrophic. Therefore, I tried to find a solution to this problem and tried to solve it using programming as a tool. The solution was to simply make a personal reminder and I was successful. About a month later, I had a personal reminder working for me. Its name was “Remindme”. It was a good one. It would simply take a time and message as input and later at that particular time, it would respond with the message I gave it. At that time, I was just coming from C Language Programming, so I had to use that Date/Time features of the C Language, which was messy to deal with and that did not offer much functionality. The first and second Version of Remindme program was built on the base of the C Language together with the VCL.
After a month of dogfooding, I started to saw the limitation of the program and decided to replace it with a second version. Some of the newer functionalities of the second version were Visual Effects and a new way to compare time. In fact, the first Remindme will break only when the current time will be exactly of the same values of the time that I entered. So in the second version, if the time is either less than or equal to the current time, it would break. That was a much better one. It was very good and I used it for more than a month until I decided that it was old enough for another replacement. Immediately I started to think about the next version of Remindme: Remindme3. Remindme 1 and 2 were good, but they were not good enough. The only thing that was missing in these programs was the ability to be reminded of dates.
Here are the dependencies that we need to satisfy for Remind3. First, the program must remember dates as well as times. However, date reminders cannot be only for one day but can be for months or even more, so we need a way to keep these reminders for such a long period. The solution was to keep a file in which we would write the reminders. We also cannot put everything in one program so it must be divided into two separate programs. I was also quite mature in VCL programming, and decided to completely move away from C Language programming to totally VCL Programming. Therefore, this is how I proceeded: First, I went for a brainstorming session, trying to see how the final program would look like. Then I went towards research, to see the best way to solve the problem of comparing two dates. After one month of research, I found in the VCL a Method called CompareDate and its partner, CompareTime.
The next day, I immediately set to work on the core of the Remind3 Program. In fact, the architecture of this Remind3 would be completely different from all the other programs I have made so far. It would be more complicated and more advance. Remind3 will consist of two parts. The Module or the core and the User Interface. The user interface would not be difficult. All I want is to present all the necessary information to the user. The only difficult thing was the Core.
The core is the Module.exe. This program would work as a background process and will scan the Test.ini file each second. The Test.ini file will have a Header or main section called Remindme. We can put all our reminders inside this one header. Then while the module will run in the background, it will scan the Test.ini file every second. If a reminder was found during scan, Module would load it in a string list and perform the necessary comparisons with it. If the date is found to be more than the current date, the program loops itself, but if the date is found to be equal or less than the current date, then the program goes to compare it’s time. If the time is less or equal to the current time, the program breaks and displays the message of the user, which is also stored in the Test.ini file.
We first create the IniFile Reader on the free store, and then we must buffer the entire Ini file into memory using ReadSections, The data read is buffered into a StringList using TStringList. Thus, throughout the While Loop we work with the StringList. Then each time the program breaks, we first delete it from the string and then from the file. The Line of code that goes to read and buffer the Ini file has been inserted within a For loop, so that any changes to the file can be caught and immediately worked upon. I must also talk about the myClass Class. This is truly great. This is my first ever work with objects in programming truly from scratch. The aim is to simply take the Date and time in raw format from the file, and break it into unsigned shorts respectively. These will be later used as parameters for CompareDate and CompareTime for date and time comparisons.
We ran into some nasty bugs. For example, if the date has long passed, we delete it but I did not ask the program to loop back to LABEL, thus, after deleting the string, the time module will try to read the deleted module for time, thus causing an Exception. The solution was to simply loop the code to the topmost. There is a second bug that I have not understood. In the For loop I checked for the counts of Strings. If however mir->Count were NULL, the program would Crash. So I had to int Counts = mir->Counts; then use Counts instead.
One point to note is how we compared the date and time. Eventually, in previous versions of Remindme, I used the standard date time functions of C. However, because these were not efficient, I had to look for an alternative method. First two instances of TDateTime must be constructed, the first one contains the date of the user and the second one contains the current date. Then I use Compare Date and I compare both date. The same method is used for Time Compare.
Almost a month since I have started to work on this remindme Project, I can say that it is still not ready. I have finished what I had in my mind, that is, a simple program that will remember dates as well as time reminders; however, I made some mistakes. Due to the case that the codebase was still not very stable (lots of memory leaks), I continued to built upon it and added features that I just dreamed of. For example, the biggest feature addition is Constant Reminders that can remember a particular time of the day forever. This allows me to display a message only once per day, but only at a particular time. This new module just added some more memory leaks to the existing module. At the moment of writing this, am still striving to find the leaks and eliminate them.
Now, almost three weeks later, I can clearly say that we have a stable codebase. There are no more memory leaks. I believe that you must be asking yourself why lose two weeks in programming a program while there are many on the internet. This is very true, but the joy that you get when you use your own program is truly something unique. It is a pleasure that you do not get when you use the software created by other programmers.