CS 478 HW 1: Reflection
1. Coding
How long did you spend on this assignment?
I spent between 1.5 - 2 hours on the actual coding part of this assignment and then another 30-45 minutes setting up the GitHub, answering the reflections questions and adding these to my website.
Where did you spend the most time? Fixing configuration, figuring out Typescript, designing your API, writing tests, debugging your request handlers, etc.?
I spent most of my time designing my API by actually implementing TypeScript as it is new to me. I spent some time just trying to set up the authorBodySchema and bookBodyScheme using Zod.
What did you struggle with the most? What would’ve improved your experience on this assignment?
My biggest struggle was the Foreign key constraints in Sqlite as I had to ensure that books were deleted first before authors because of the constraints. I think more lecture notes what PRAGMA foreign_keys = ON means and how it changes how tests should be written.
2. Typescript
Keep track of the bugs Typescript helped you catch and the ones it didn’t catch. What are some of the issues Typescript helped you prevent? What are some of the holes in the type system?
TypeScript was helpful in ensuring the objects sent in POST requests matched the database schema. It would catch errors when I forgot a field like pub_year or author_id. A major hole I noticed is that db.get
(...) and axios.get(...) are type casts. TypeScript trusts that the data returning from the database matches the scheme provided, but it doesn't actually verify the data. I used Zod to validate the incoming request bodies before they reached my logic code.
What kinds of values did you struggle to type correctly? Are there any Typescript topics that are still confusing you?
I initially struggled with Intersection types. I had to create a distinction between the data a user sends, and the data stored in the database which includes a unique ID.
3. Testing
What was your experience writing tests? Was it boring, soothing, rewarding? How did they affect your development process?
I think that writing tests were more rewarding than not. I liked it when I confirmed that the test passed and ensured that all the requirements of the assignment were tested through the testing suite.
Did your tests help you find any bugs? If so, which ones?
I found the foregin key violation bug. Because I enabled PRAGMA foreign_keys = ON, I couldn't delete an author if they still had books linked to them. So I had to delete the books linked to the author first before I could delete the author.
How would you structure your testing differently in the future? What did you learn while testing?
I learned that in relational databases where one record relies on another or is linked to it, then I need to remove the child record first to remove the parent. In the future I would like to try to write tests first, so I can catch errors in my logic or schema mismatches faster and base my code on the tests that I need to pass.
4. LLMs
Did you use LLMs to help you write your code? If yes, explain how you used them.
I used an LLM as a technical helper when I struggled with an aspect of the code. Initially, it helped me debug my server setup to ensure the structure was correct. Then I also used it to write and make sure that my test cases were complete and tested the full breadth of the assigned functionality. When I got the error when I tried to delete an author without deleting the books first, I used an LLM to help diagnosis that issue.
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?
While the LLM saved a lot of time, I noticed it changed the reward of coding. It minimizes the sense of relief and enjoyment I get when I finally solve an issue on my own. However, it helped me get a much clearer idea of how REST patterns and database constraints interact. I believe it helps explain concepts to me and helps me understand better.
← Back to Home