E5: Reflecting on Assignment 2

23 Apr 2023

Provide a brief introduction to the assignment along with a link to this page for further details

Assignment 2 builds upon the foundation that was set by completing Assignment 1. This time around, we were tasked with implementing a login and registration page on top of the basic store structure (index, products display, and invoice pages) that we already made during Assignment 1. Once you have completed creating a login and registration page, you need to do some validations. Once the user enters valid entries, they will be able to proceed to the invoice. A brief step by step of this assignment is once the user enters the quantities that they would like to purchase, they would be directed to the login page, in which they would have to login in order to see the invoice with their purchase. If they do not enter a valid login, then they would see their errors and need to enter a valid login. If they do not currently have an account, then they could click on the “Register” button which directs the user to the registration page where they would have to enter a valid registration. If they enter invalid entries, then they would see their errors. Once they enter a valid registration their data is stored in a json file so that they can use it to login, upon successful registration, they are directed to the invoice. The inventory is also updated accordingly. The quantities that they select are stored in an object on the server and are called upon when they have reached the invoice page, this is where they are taken out of the inventory so that the next user sees the updated inventory. For more information regarding Assignment 2, click HERE.

What did you learn from this assignment?

I learned some valuable things from doing this assignment. I especially had to learn quickly because we only had one week to complete this assignment and there was a lot to do. The first thing I learned was how to carry the quantities purchased through the login and registration pages to the invoice and display the purchased products. I learned how to do that by storing the purchased quantities in an object on the server and then calling it once they have reached the invoice by putting it in the query string so that it could display on the invoice page. Another thing that I learned was how to write out the tasks that I needed to complete and put them in order from most priority to least so that I could achieve things in increments. I learned to test after every 5 or so lines of code so that if I had any errors, I would know where to start, if I have to backtrack and fix accordingly. I worked alone for this big assignment instead of with a partner as we had the choice too, so I had to learn how to research efficiently and quickly how to resolve my problems that I was having such as encrypting passwords entered and matching them with the encrypted passwords stored in the json file. I figured out that there was a function that I could use which required minimal amounts of code, so I got lucky there and was able to fulfill my IR1 which was encrypting passwords.

Did you work with a partner? Assign an estimated percentage on the amount each team member contributed to the assignment (including yourself).

As per mentioned in the previous question, I did not work with a partner.

How did you get help when you needed it? What did you need help with?

How I got help when I needed it was researching on google, utilizing ChatGPT (only as a last resort prior to meeting with Professor Port), scheduling an individual meeting with Professor Port, referring to his Assignment 2 code examples and referring back to previous labs that I thought would come in handy such as Lab 11, 12, and 13. What I needed help with was figuring out how to best transfer the products selected and moving them through the pages until the user reached the invoice page and then got the products that were selected and displaying them on the invoice. I arranged a meeting with Professor Port and we originally discussed passing the data through the query string, this meant that I had to include the data in the query string every single time I moved from page to page. I thought that this would be easy but I instead decided to pass the data utilizing an object on the server which stored the data and used it once I got to the invoice (displaying the purchased quantities on the invoice). Once I did this, I found myself writing less code and I was able to understand what I was doing. Some issues along the way was that I was not understanding how to put the email and fullname information in the query string along with displaying the quantities selected in the query string on the invoice page so that on the invoice page, I could pull all of the data in the query string and display it on the invoice. Assignment 2 was definitely more challenging than Assignment 1, especially because of the time crunch, but I feel that I learned a lot and with the assistance of Professor Port, I was able to get a clearer understanding of what it was that I had to do to complete the assignment correctly.

How was developing this assignment different than assignment #1?

This assignment 2 is definitely more different and challenging than assignment 1. In terms of developing this assignment, although it required less code to write than the first assignment, the concepts and level of understanding needed to implement and create the correct code was much more difficult. It required more attention to detail as well as fully understanding how to create and process a login and registration page whilst implementing a broad level of security so that users could not immediately access their invoice upon purchase. The main issues that I had with assignment 1 was passing along the data to the invoice as well as having the correct validations and error messaging appearing next to the correct textbox. I was able to resolve these errors quickly with the help of Professor Port. However, with assignment 2, the codes needed were much more complex and required more time to figure out solutions as there was a variety of solutions that I could use but I could only use one that would work well with the current code that I had written out already. After spending long hours working on my errors such as passing the products selected over to the invoice, which was accomplished with the help from Professor Port, I was able to resolve my errors and learn new advanced concepts that I could potentially use in assignment 3.

Estimate the % of time you spent (a) thinking about how to do something, (b) writing code (but do not include testing, (c) testing and debugging

I estimate that the percentage of time that I spent thinking about how to do something was significantly more than what I thought. I think that I spent more time writing code (both good and bad code) and testing, than actually thinking of what I needed to be doing. If I were to go into the specifics of my time divided amongst the three criteria, I would say that I spent 40% of my time thinking about how to do something, 40% writing code and 20% testing and debugging any and all of my errors. As for the consequences, I ended up having A LOT of code that I did not know what to do with, just taking up space, and found myself more frustrated because I did not know how to proceed. Eventually, I backtracked, got rid of all of my excess code and it turns out at the end, I did not add too much code.

Describe what worked well with this project? What did not work well?

What worked well with assignment 2 was that I was able to meet with Professor Port on the side as well as attend a brief workshop during the week where he went over some examples on how to pass data from page to page. Two methods that he mentioned were to pass the data through the query string or by temporarily storing the data in an object and calling upon it only once the user has logged in and/or registered correctly. What did not work well was my habit of writing a lot of code without properly testing a few lines at a time before proceeding, this in turn, prevented me from progressing in a timely manner and found myself more stressed and less focused on fully understanding the concepts first before writing more code.

If you could go back in time and do things differently, what would you do differently?

If I could go back in time and do things differently, what I would do differently is I would take a breath, take a step back and prepare a full and detailed outline of the tasks that I need to complete and fully understand the first step as that sets the foundation for the rest of the assignment. I would also go back and review my notes and screencasts from past lectures that were relevant to the material needed to learn for this assignment so that before I write any actual code, I have a better idea of what I need to do and hopefully have an idea of how to start. Ultimately, I would use what I have learned from past lectures as well as this assignment to help me with assignment 3.