Forem

Cover image for Build Issues, Code Generation and Depth vs. Breadth First - Building DDTJ Day 8
Shai Almog
Shai Almog

Posted on

2 1

Build Issues, Code Generation and Depth vs. Breadth First - Building DDTJ Day 8

Yesterday I was making substantial progress, so naturally I spent most of today with my figurative wheels spinning in mud…

I’m finally at the stage of generating the source code for a unit test from data. I hoped it would be a smooth experience, but I feared it wouldn’t be trivial. As I’m doing that, I’m running into a lot of edge cases and problematic behaviors in the code. Had I gone with a depth first approach and worked on getting the code working in Spring Boot, I might have missed a lot of these important fixes. I’m sure getting the code working in Spring Boot will expose a lot of other issues, but I think they will just be standard bugs, not bigger changes like the ones I’m doing right now.

To be fair, I merged a minor issue yesterday. Mostly to improve code coverage. While the PR had over 80% coverage, the code rounded down to 79%. The solution was to add a small test that pushes the coverage further.

Most of the issues I’m running into right now relate to data that I didn’t store or didn’t store in the right location. But I wasted a lot of time yesterday and today on some nonsense.

Unreachable Controller

I added a Spring Boot MVC controller and a Freemarker template. Things that I’ve done multiple times in the past. Not something too difficult.

Got a 404…

Must have missed something in the configuration… Doing that over again. Reviewing, Googling (or is it Ecosiaing?), rinse repeat.

Nothing comes up.

I try narrowing down the problem. Renaming classes, adding dummy services just to see if a non-MVC call works (it doesn’t).

Solution

As I changed the version to 0.0.5, something must have broken in the build and its relation to the IDE. I still don’t know what it was. But a few well placed “clean package” calls solved the issue.

It took me way too long to try that which is pretty embarrassing. I guess my mind was elsewhere. Hopefully, this detour doesn’t set me too far off course to finish this by the end of the week.

Code Generation

Once I resolved this, the process of code generation became mostly a mechanical process of getting the data from the model and adapting it to source code. Unfortunately, a lot of the data is still missing, so that’s where I’m stuck at this moment. I hope I’ll be able to get something decent by the end of the week.

The Freemarker code is very easy to work with and so is Spring MVC. I already have a test case printing but not much more. No mocks and object initialization is proving to be very tricky.

I still didn’t get into the whole “exception” handling complexity or declaring checked exceptions. These aren’t too hard, I just want to keep the focus for now. Hopefully, they won’t be a major blocker in the future.

Tomorrow

I kept this post brief so I can focus on work. Today and Tomorrow are crucial days that will determine whether I make it past the finish line. I think this might be close, so I want to put 100% on getting there.

I have 3 more blog posts to do in this series. After I finish the 10th, I plan to do a summary/post mortem to see what worked and what didn’t. 

If you want to keep up with the latest updates on this series and the many other things I work on, then follow me on twitter.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay