Assignment two is a continuation of assignment one where, on top of the basic store structure (i.e. index, product display, and invoice pages) that I have already built for assignment one, I also needed to add at least the login and registration pages. After adding both the login and registration pages, the newly modified store in assignment two functions such that after the user makes a valid purchase on the product display page and clicks the 'submit' button, the user needs to either log in at the login page or register at the registration page before he or she can view his or her final invoice. At the same time, after a user successfully logs in or registers, the product inventories (i.e. quantity available of the purchased product(s)) will automatically update to the latest number(s). Other requirements of the assignment include that the entered user information in the login or registration page needs to be validated and that the purchase information needs to be kept in a query string and passed from the products display page to the login or registration page and eventually to the invoice page since this is the only way to generate an invoice successfully. If you want to find out more information about assignment two, please click here.
There are some valuable things I learned from this assignment. The first thing I learned was to use a query string to carry all transient purchase information and user's email from the products display page all the way to the invoice page. This is very important to know since, without the query string to save the purchase information and user's email at all the pages leading up to the invoice page, it will be impossible to pass the purchase information and user's email to the invoice page to generate a correct and personalized invoice for the user. The second thing I learned was to update the inventory after successfully making a purchase and logging in/registering. In assignment one, I did not implement the 'update inventory' feature, but I fixed this mistake in assignment two, and this is also a very important feature to implement in my store since it will not make sense for product inventories to perpetually stay the same after users make various purchases. The third thing I learned from doing assignment 2 is to generate a personalized invoice that not only contains a correct invoice but also displays a dynamic thank-you message containing the user's username (i.e. the user's email) at the bottom of the invoice.
No, I did not work with a partner.
I referred back to sample assignment 2 codes and past lecture videos and labs when I did not remember exactly how to program certain aspects (ex. login and registration forms). I also had to schedule an appointment with Professor Port to resolve my issue of not being able to pass data from the products display page all the way to the invoice page. Originally, my purchase information only appeared in a query string on the products display page, and after I clicked the 'submit' button, I was redirected to the login page, but all of my purchase information disappeared such that, after I successfully logged in, the invoice would generate nothing. Fortunately, after receiving guidance from Professor Port, I realized that submitting a new login/register form would erase my purchase information, and I also did not use the params.append() and request.query() functions to transfer all the purchase information and email from the request body into a query string on each page between the products display and invoice pages. After pinpointing these two key issues, Professor Port and I quickly fixed them so that in the end my store works successfully in terms of keeping and passing data from page to page.
This assignment is different from assignment one. Besides the difference in assignment goals, I also had fewer issues with assignment one. The main issues I had for assignment one were not being able to have a working server that posts the purchase information from the products display page to the invoice page and not being able to display the correct error messages next to an invalid entered quantity of a selected product. I was able to solve these issues on my own and with some help from Professor Port in a relatively short amount of time. However, in assignment two, things became much different. Despite having fewer codes in assignment two than in assignment one, I had to spend more time trying to figure out solutions to different issues that also happened to be key issues. After spending these long hours, I was able to solve some of these key issues (ex. tracking inventory after successful login or registration) on my own, but I still needed help from professor Port on keeping and passing transient data. Therefore, assignment two is certainly more challenging in terms of effectively understanding and implementing the more advanced concepts, which is why it takes longer to complete than assignment one.
I estimate that I spent more time writing code and testing and debugging than thinking about how to do something. More specifically, I spent about 10% of the time thinking about how to do something, 50% of the time writing code, and 40% of the time testing and debugging. Due to the fact that I was left with not much time after having to handle various important personal matters and schoolwork, I had to assign a majority of my remaining time to writing code, and I could not think through how every part of my program works in detail. As a consequence, at first, everything worked fine, but towards the end, various key issues appeared that cost me hours to test and debug, which was an uneasy process.
What worked well with assignment two was that I was able to attend two workshops last week in which Professor Port shared some simple examples of how to pass transient data using both the query string method and the method of temporarily setting data aside in the server first and then retrieving this stored data after the login/registration is successfully completed. Professor Port also shared a simple example of keeping track of inventory after each purchase is made, and all of these in-class examples gave me an idea of what assignment two was expecting from me and what I could do to meet these expectations. What did not work well was that my mastery of the recently taught knowledge and skills was not strong enough such that I had to spend the majority of the limited time that I got, after handling various important personal matters and schoolwork, writing the code that I wanted and understand and identify the root causes of some of my key issues.
If I could go back in time and do things differently, I would review the recorded lectures on Laulima at least once every other day while assignment two was still open for submission. That way, I would refresh my memory and gain a deeper understanding of what I learned up to this point. I also could have done assignment two little by little each day to combat my hectic schedule during the past few weeks. Nonetheless, I will apply the lessons that I learned from doing assignment two to improve the quality of the upcoming assignment three.