Reflection
Coding
- I spent around 9–10 hours on the assignment.
-
I spent the most time writing tests and debugging my request handlers,
especially fixing status codes and making sure my API responses matched
the expected formats.
-
I struggled the most with writing tests because I didn’t have much
experience with them, and with using zod for input validation since it was
new to me. More practice examples would have made the assignment easier.
TypeScript
-
TypeScript helped me catch wrong property names for example authorID vs
author_id, since I decided to change my variable naming convention, and
missing fields when building response objects. It also helped prevent
mistakes when working with Express request and response objects, such as
accessing properties that didn’t exist or were typed incorrectly.
But, TypeScript did not help with configuration or dependency-related
issues. Problems like missing packages or incorrect setup only appeared at
runtime. It also could not catch issues related to invalid input data or
database behavior, which had to be handled through runtime validation and
testing.
-
I struggled most with handling values that TypeScript considers unknown,
such as route parameters, query strings, and database results. I had to
spend time understanding how to properly validate IDs helped me get past
this, and once it clicked, the rest of the code became much cleaner and
safer.
Testing
-
Writing tests was challenging for me in this assignment since I didn’t
have a lot of practice of really understanding and writing backend tests.
At first it felt a bit tedious and frustrating, especially when tests
failed because of small issues like incorrect status codes or response
formats. Over time though, it became more rewarding because the tests
helped confirm that my API was actually working the way I expected.
-
The tests helped me catch several bugs, like returning mismatched field
names between the database and API, and issues with deleting authors that
still had books. This was also a good experience because it inspired me to
get better at writing tests through more practice.
-
In the future, I would start writing tests earlier instead of waiting the
most of the API was implemented. I think I struggled the most because of
this issue since I had to go back and change my APIs after already writing
them after writing tests. I also learned how important it is for tests to
be independent and reset the database before each test, since that made
failures much easier to track down.
LLMs
-
Yes, I used LLMs to help debug errors and understand why certain bugs were
happening, especially when tests were failing or when I ran into
TypeScript or configuration issues. I also used them to think through
which test cases would be important to include, such as edge cases and
error scenarios, and for small clarifications about tools like Zod and
SQLite since I hadn’t used them previously.
-
Using LLMs made the coding process less frustrating and saved me time when
I got stuck. Sometimes the LLM also made me more lost and confused with the
solution, but mostly it was not a bad tool for this assignment.