Build Issues, Code Generation and Depth vs. Breadth First - Building DDTJ Day 8
Tags: startup, opensource, testing, programming
Published: 2021-12-29 11:12:55

Yesterday [I was making substantial progress](https://dev.to/codenameone/60x-performance-improvement-moving-on-fullstack-building-ddtj-day-7-2c92), 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?](https://ecosia.org/)), 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](https://twitter.com/debugagent).