1. Node
Keep track of any changes you made to your back end as you implemented your front end. What changes did you need to make and why? If you could go back in time, is there anything you would change about the way you approached making your back end for HW1?
For backend I made a separate types.ts and imported the database schemas over to server.ts. I changed all of the routes to start with /api/ so that it can proxy the HTTP requests. I also changed the BodySchema inside types.ts so that it displays the right message when there is an error adding to the forms. If I can go back in time, I would make a separate types.ts file as I just did so that it is cleaner to look at.
When adding books and authors, did you only use server-side validation, or did you also use client-side validation? What are the pros/cons of making either choice?
I only used server-side validation where when the user types something wrong or leaves something empty, the backend server rejects it and the error messages show up from the server. I think the pros of server side validation is that it makes it more secure but the cons is that you have to submit the form first before it tells you there is an error instead of instantaneous. Client side validation pros is that it is instantaneous and gives better feedback on what is wrong, while the con is that it does not protect from submitting errors for the forms when adding books and authors.
2. React
What was your general experience using React? What did you struggle with? What did you enjoy?
I think my general experience when using React is pretty good. I am getting better at using useState and useEffect. I think I struggled mostly with debugging the state bugs and posting the books and authors trying to figure out why there is a bug when creating an author’s name. I did enjoy how clean it is and the state changes when you update it using useState.
Compare and contrast writing React versus writing plain JS DOM manipulation code as you did in CS375. How was your experience different? Which do you prefer and why?
I think the experience is easier where the useState is more clean and easier to write compared to creating elements and appending children. I also don't have to select elements with querySelector. I currently prefer React because it looks more clean and the code seems more readable compared to before.
What was your experience using types with the front-end? Did they catch any bugs? Did you struggle to type things correctly? Did they feel helpful, useless, tedious?
I think my experience using types with front end is that it takes time getting used to compared to javascript, and that it takes time trying to figure out the state and what to use for each variable. It did help with catching bugs where I passed a string instead of a number like for author_id and passing an author name to post and there is an error to need to use the same variable name. I think I did struggle somewhat when trying to type the useState for numbers and the database and also union types. I think it was useful but also sometimes tedious to do.
4. LLMs
Did you use LLMs to help you write your code? If yes, explain how you used them.
I did use LLMs to help me write my code where I did not know how a bug occurred and it helped me figure out that I have to use the same name for the variable when posting into author so I had to use name: authorName instead to be able to run it. I also used it to help me figure out how to write distinct messages for errors when adding books and authors to forms when it is the wrong format or it was left empty.
If you used LLMs, reflect on how they changed your experience of coding. Did they make it more or less fun? Did they save you time? How do you think they affected what you learned from this assignment?
I think it saves a lot of time when trying to figure out a bug or finding out to add something to the code. I think it definitely makes it more fun to be able to learn what the error is and they have a full explanation of what was wrong from the mistake. I think that it made it much more productive for me to do this assignment and learned a lot more from my mistakes that I made from this assignment. It also helped me learn more on how react and typescript works.