Homework 2 Reflection
Node
I had to make a couple significant changes to my backend. Retrieving all books now joined on the author table to get the author name so that it could be displayed on the frontend because I thought it would be nice. I also moved types out of the handlers to clean it up a bit. My major refactor involved writing a new Zod object to handle book create requests, which contained the author name. I also dropped location response headers from my create requests because there's no where to redirect to at the moment. Looking back on this, I wish I had considered designing the backend from the perspective of the UI interacting with it rather than a program interacting with it. It wasn't a major issue, but I could've been done a little bit sooner.
I leaned on server side validation. Honestly speaking, I had less time to do this assignment compared to the previous one due to my schedule the last two weeks. My validation and error messages are specific enough for a user to identify input errors, but not as granular as I would like. Server side validation keeps the frontend clean and prevents any additional computing on the client side, but requires the user to submit data before knowing whether or not it is right, potentially leading to a clunkier user experience. I'll probably change this in the future.
React
React is pretty cool. This isn't my first time using it, so I didn't really struggle with hacking it together, but I feel like I have a ways to go with learning about best practices surrounding front end development as a whole. I enjoy the abstraction of state management with React.
I think writing React is a better overall experience than writing plain JS DOM manipulation simply because React has so many baked-in features and code examples in their documentation to make a front-end do exactly what you want it to do, especially when what you're working on is fairly simple. I also enjoy the fact that React basically allows you to work on indiviual HTML components that manage their own state and call them in different parts of the main page. The unit of work becomes smaller and easier to test. I also never really enjoyed how JS DOM scripting attached functions to events; that always felt clunky to me.
Using types is my favorite way to write frontend code. They were helpful. They usually help
prevent me from writing easy bugs such as accessing nonexistent attributes because
waiting for responses or messages have to be encapsulated in an object with a
certain type. I did struggle to type an array of <option> (which was a JSX.Element)
that I had to look up on Google.
LLMs
Initially I was going to use LLMs to fix my integration tests on the server. However, I might work on the server portion a bit after submitting this assignment, so I didn't even end up fixing the tests. So I didn't use LLMs at all for this assignment.