This week is my fifth week in Aeste, I started my week by looking into the problem that have caused me not getting the result I wanted when I ran the test script. Last week, Dr Shawn told me that the issue might be the location of the email content file. The file was not located in the approot directory and he asked to study about what is approot and told me that the email content file should be located in that particular directory. Basically, approot directory is a place to store files that do not need to be published online, but are read only by the application. With the help of WServer I am able to solve the issue. However, I realized that there was another issue causing the test script not producing the correct result. The reason was because when I first ran the test script, it compiled the codes and built the necessary object files. Then, when I made some changes on the codes and ran the test script again, it just compiled and ran with the already built object files. I am not sure how are they linked together, but I am able to get my result by deleting the object files directory before running the test script after I have made the changes. In this case, it will compile and build the object files again. So, that’s it, I was able to test my codes and it was working.
Before moving on to my second task, which is to replace the currently hard-coded registration slip by using WTemplate, I have decided to spend some time to understand how the application works. In my first task, I was just focusing on the email content part only, I wasn’t clear how the information was captured from the database. What I did was just binding the required fields to the variables that were already there. It was just not right, like what Dr Shawn had told me before, as Engineers, we have to fully understand the things that we are working on in order to produce a great result. So, I started by looking at the debug log file which contains all the information which is written using Wt::log. From the log file I was able to follow step by step how the application flows, and looking at the codes I was able to catch the big idea of how the application works. With better understanding, I moved on to my second task. After studying the codes, I knew where to start and what needs to be changed. So, I started modifying those codes so that the application produces the registration slip using WTemplate instead of the currently hard-coded slip. After I have done modifying the codes, I need to run the test script to test whether it is working or not. That was the terrifying part, how I wished it would compile and run perfectly without errors. Unfortunately, that was not the case, lots of errors popped out which means that my codes are not right. I gave it a thought and made a second changes, but still, it failed during compilation. Sigh! Just when I was about to look into details about the issue, Dr Shawn came to the office.
He checked with me my progress and I told him that I have done my first task. He then asked why didn’t I push the code to the repository so that he could have a look on it. I told him that, I wasn’t 100% sure it was working fine and I was waiting for him to give it a look before I push the new codes to the repository. What he told me afterward made me think inside. He told me that, as an engineer, I am suppose to tell people that something that I have made is working but not waiting for someone else to come and check whether the thing that I have built is working or not. That’s so true, I realized that I have been too dependent sometimes and I need to do something to be a better person or engineer to be. Back to the point, Dr Shawn then looked at my code and told me that some parts of my code was still hard-coded. He wants the codes to be more general as in, we will not need to change the c++ codes when we want to generate a new template for a new category, what we have to do is just add in the new template file into the approot directory, then the c++ codes will do the rest, it will select to correct template to use. This way, the codes will be much easier to maintain and that’s the way to do programming. After that, he told me that he wants to add in new information in the confirmation email which is the competition type and also venue. To do that, I have to get the data from the database and bind it to the correct place. Just when I thought I understand the application very well, I was actually struggling to get the data that I need from the database. I was able to do my first task because I didn’t have to write any code to get the name of the registrant from the database as it was already written inside. I tried to write something similar to get the competition type and competition venue but unfortunately I was not able to do that. Errors were popping out.
So, the learning never ends. For now, I have to go deeper inside to understand the application thoroughly so that I can finish my first task. To do that, I have to really understand how can I get the data from the database which is something related to Wt::Dbo. Yeah, I have done the tutorials on Wt::Dbo before, but I have a tough time trying to apply it in the application. But overall, I have learnt a lot this week such as having a better understanding on c++ and also some life lessons that I have learnt from Dr Shawn. I am enjoying my time here and I can’t wait to learn more in the coming weeks!