... one of the biggest decisions here is probably how we should handle immutability... it's not always consistently applied (I think mainly with DTOs), but I think in general that was one of the main ideas in Fineract. Personally, I could live without this "feature"... having immutable classes (aka "you can set values only on instantiation via the constructor") in itself leads to redundant code (copies); not all values are always available when these immutable classes are instantiated which explains those "copy" functions here and there (sometimes done as static functions, sometimes package private... all kinds of patterns, not a lot of consistency)... all this would go away if we just trust and let go and make these classes simple Java beans (getters/setters ... and I still find the builder pattern useful here).
If we would opt for maintaining the immutability of those classes (makes the future introduction of more boilerplate reducing tools impossible) then we should at least consider using the builder annotation in combination with just getter annotation. At least we'll have a clue what values we pass to the respective parameters... in some classes we have a million (my exaggeration) constructor parameters with the same type (String) which makes it really easy to shoot ourselves in the foot. My 2c On Thu, Mar 17, 2022 at 10:04 AM <[email protected]> wrote: > +1 > > > > *From:* Awasum Yannick <[email protected]> > *Sent:* Wednesday, 16 March 2022 5:54 PM > *To:* Dev <[email protected]> > *Subject:* Re: Lombok usage? > > > > +1 > > > > Great Idea. > > > > On Wed, Mar 16, 2022, 16:43 Aleksandar Vidakovic < > [email protected]> wrote: > > +1 > > > > ... very in favor of doing this... with Lombok we can also get rid of a > lot of the "@Autowired" stuff... just saying > > > > On Wed, Mar 16, 2022 at 2:07 PM John Woodlock <[email protected]> > wrote: > > Arnold, > > > > I'm not aware if the community has considered this or other tools for > removing Java boilercode. However, not being a native Java programmer I > abhor the Java noise. And I'm sure you'd do a great job demonstrating how > Lombok can reduce it. > > > > Thanks a lot > > John > > > > On Wed, Mar 16, 2022 at 12:48 PM Arnold Galovics <[email protected]> > wrote: > > Dear Community, > > > > While I've contributed to the codebase, I realized there's a lot of > boilerplate code for a lot of classes. > > Mainly, I see the constructors which are really not doing anything except > assigning parameters to fields + the @Autowired annotation. And we have a > lot of getters/setters as well, mostly on DTOs. > > > > I don't have a number at hand but I think by using Lombok we could reduce > the amount of boilerplate in the codebase considerably, I'm just not sure > if somebody has considered it before. > > > > If there's no objection, I'd start introducing it gradually and then > others could also benefit from it. > > > > Thoughts? > > > > Best, > > Arnold > >
