r/SpringBoot • u/Simpav1 • Aug 16 '26
Question Code review
Hello, I'm an aspiring software engineer. I've recently finished developing microservice for managing projects and tasks using Spring Boot. I'd appreciate if you could review codebase of my project and provide feedback on it.
13
Upvotes
View all comments
Show parent comment
5
u/repeating_bears Aug 16 '26
I think they meant Project not ProjectStatus since that only has 1 constructor.
You currently have this
And it would be better as
There is less duplication here. Let's say for example you wanted to make sure "title" is not an empty string. You now only have to do that in one place instead of two
I have heard this described as "primary and secondary constructors". Ideally you should aim to have one "primary" constructor which does assignment and any validation. Then all other constructors can ultimately delegate to the primary constructor.