Homework 2 Reflection

Design

1. Keep track of the changes you made to your back-end as you implemented your front-end. What changes did you need to make and why? Would you structure your back-end differently in the future?

The changes I made in my back-end were all for functionality reasons. For example, my search property was by book title, but I had wanted to make it a contains search rather than an exact match. For this, I had to change my GET request. I had also wanted to make updates to my back-end to clean up what I had written for Homework 1, but I did not get to it. The only Homework 1 update I mhad made was to change the ID to auto increment rather than submitting an id. In the future, I would have a cleaner back-end by separating my api calls into different files and having cleaner tests.

2. Did you also perform client-side validation or did you rely on server-side validation alone? What are the pros/cons of making either choice?

I relied solely on server-side validation. This is because if an error had occured, the server would prevent the request and return an error message. I did however, add that the input for numerical fields has to be of type "number". The pros of having server-side validation is that all of the errors are consistent and only valid requests can be made. The pros of having client-side validation is that the client can reject invalid data and prevent sending data for the server to reject. The cons of not having server-side validation is that the system entirely reliant on the client to prevent invalid data from being requested. The cons of not having client-side validation is that it is inefficient to send invalid data when checks can be put in place to immediately reject the data.

React

1. What was your experience manipulating state with React components (especially with the useEffect hook)? What kinds of things did you struggle with?

While working on this homework, I referenced a lot of the work from the in-class activities. I found this especially helped when working with the React components. I think this saved me a lot of headache as I already had a working reference. I only really struggled with the sorting and implementing a search.

2. What was your experience using types with the front-end? Did they catch any bugs? Did you have to make a lot of manual annotations? Did you resort to using any frequently, and if so, why?

I found that the front-end complained more about typing, but I think this due to vite. I did not ending up having any bugs that needed to be caught. Vite complained about using any types, which alerted me when a variable was not typed. I did not have to use many manual annotations and I did not use any frequently. This is because the type was usually easy to assume or I would run the code to see which type was a best fit for my variable.

Compare and Contrast

Compare and contrast your experiences writing an SPA front-end with React to writing a MPA front-end like we did in CS375. Which was harder? Which did you enjoy more? How did you feel about the experience generally?

I found it much easier to write an SPA front-end rather than a MPA front-end. This is mostly because it takes less code to achieve the same result. It felt much more intuitive as a lot of my code ended up being reusable whereas in an MPA format, I would have to restructure the page every time.

Back