What are some things and language features you use to reduce writing/time spent on boilerplate?

I've been working on a greenfield project lately and noticing how tedious it is to create entities, domain models, request/response objects, dtos, when they're all really just pojos. There are also other things that are redundant/boilerplate like. I'm wondering what new language features, libraries, and other things you add into your coding to reduce time spent on writing boilerplate?
9 Replies
JavaBot
JavaBot2d ago
This post has been reserved for your question.
Hey @Kale Vivi! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
mariokh
mariokh2d ago
I personally use amazonQ or Git copilot for the boiler plate code of the unit testing or for the autocomplete
Kale Vivi
Kale ViviOP2d ago
Do you like tell Copilot here's ajson of an object, convert it to all these different type of objects? haha I just realized I should have probably tried that instead of manually creating all the fields and types myself
straightface
straightface2d ago
There are also json to pojo converters online
JavaBot
JavaBot2d ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
AgentMime
AgentMime2d ago
Project Lombok is nice for a lot of boilerplate elimination. You use annotations to generate getters, setters, and constructors, and it comes with a lot of other interesting features such as an annotation to generate a Builder for any class.
stechy1
stechy12d ago
On the other hand the way how Lombok is doing that is not nice - modifying AST during annotations processing. I just saw a very nice presentation about this topic and basically JDK will close some api on which Lombok is relying on. So the developers will have a hard time maintaining this project...
AgentMime
AgentMime2d ago
Ah that could be a problem It’s fine for now at least, and if it ever becomes obsolete they also have a “delombok” tool to undo everything
JavaBot
JavaBot21h ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?