Back to Java
— java, spring, spring-boot, software-architecture, AI — 2 min read
For just over a decade now, Scala has been the language I worked with for most of the time. But recently I was asked to build a project in Java, and I was a bit hesitant. I've been busy setting it up now, it's in a hexagonal architecture, and there are a bunch of organization-wide mandated tooling choices like Spring Boot and Hibernate.
Other than that, I have a lot of freedom, so with my Scala-dev colleagues, we found Vavr, a decent implementation of things like immutable collections and Eithers, and we are discovering what modern Java has to offer.
Now this is a new project, so it's also a good opportunity to test Cursor IDE for this. So far I used Cursor with success for frontend work, but working on a very large existing Scala stack is a bridge too far for the AI apparently. Maybe it's the implicits of Scala, or just the complexity of so many generics, but the AI is useless at Scala.
For Java, however, it's been a joy. After some iteration I found the following rules for success when using an AI to setup a new project:
- Gather function requirements in markdown format in the repository.
- Describe your architecture in PlantUML inside markdown.
- (This was a new discovery for me) Make a coding style guide in markdown, with a lot of examples.
The AI was very inconsistent with naming things (
xyzDto
orxyz
), with exceptions vs Eithers. So I made a nice style guide with a lot of examples, had my colleagues review it, and then I used it to generate the code. It's not bulletproof, but it works a lot better now.
The hardest part however is my attention issues, since now, while waiting for the AI to solve the compiler errors it created, I find myself doing things like writing a blog, or worse doomscrolling 😱...