You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@fineract.apache.org by Zeyad Nasef <ze...@gmail.com> on 2024/03/19 22:30:13 UTC
Multiple Constructors boilerplate
Hello, devs.
I've observed that there are several parameterized constructors within the
same class, each differing in the parameters they accept.
Since Lombok is already set up, why not streamline these constructors by
using the *@Builder* annotation instead?
I reviewed the following doc
<https://docs.google.com/document/d/1w23pvpbWmWZVQUOKXcC_0zjfs-T1bSAagkW-XG2kgxE/edit?disco=AAAAZ5PWsLk>
which
suggested using it but it has been dismissed due to some immutability
issues happening in the service layer, which I don't fully understand :(
If there are any suggestions I would like to hear from you.
Thanks,
Zeyad
Re: Multiple Constructors boilerplate
Posted by Zeyad Nasef <ze...@gmail.com>.
I see that I misunderstood while reading :")
Could you show what kind of issues appear due to immutability?
As for my suggestion, I'm thinking of using @Builder alongside
@NoArgsConstructor. This means ditching the existing constructors and
updating other files to use the Builder approach instead of the
constructors.
Do you see any red flags with this plan?
Regards,
Zeyad
On Wed, Mar 20, 2024 at 1:05 AM Ádám Sághy <ad...@gmail.com> wrote:
> Hi
>
> Based on the doc you shared Builder was not dismissed, only
> immutability...to a later stage.
>
> My understanding was that you could move forward with Builder pattern but
> also these Data/DTO shall have setters as well...for now.
>
> Am I missing something?
>
> Regards,
> Adam
>
> Sent from my iPhone
>
> On 19 Mar 2024, at 23:30, Zeyad Nasef <ze...@gmail.com> wrote:
>
>
> Hello, devs.
>
> I've observed that there are several parameterized constructors within the
> same class, each differing in the parameters they accept.
>
> Since Lombok is already set up, why not streamline these constructors by
> using the *@Builder* annotation instead?
>
> I reviewed the following doc
> <https://docs.google.com/document/d/1w23pvpbWmWZVQUOKXcC_0zjfs-T1bSAagkW-XG2kgxE/edit?disco=AAAAZ5PWsLk> which
> suggested using it but it has been dismissed due to some immutability
> issues happening in the service layer, which I don't fully understand :(
>
> If there are any suggestions I would like to hear from you.
>
> Thanks,
> Zeyad
>
>
Re: Multiple Constructors boilerplate
Posted by Ádám Sághy <ad...@gmail.com>.
Hi
Based on the doc you shared Builder was not dismissed, only immutability...to
a later stage.
My understanding was that you could move forward with Builder pattern but also
these Data/DTO shall have setters as well...for now.
Am I missing something?
Regards,
Adam
Sent from my iPhone
> On 19 Mar 2024, at 23:30, Zeyad Nasef <ze...@gmail.com> wrote:
>
>
>
>
> Hello, devs.
>
> I've observed that there are several parameterized constructors within the
> same class, each differing in the parameters they accept.
>
> Since Lombok is already set up, why not streamline these constructors by
> using the **@Builder** annotation instead?
>
> I reviewed the following
> [doc](https://docs.google.com/document/d/1w23pvpbWmWZVQUOKXcC_0zjfs-T1bSAagkW-
> XG2kgxE/edit?disco=AAAAZ5PWsLk) which suggested using it but it has been
> dismissed due to some immutability issues happening in the service layer,
> which I don't fully understand :(
>
> If there are any suggestions I would like to hear from you.
>
> Thanks,
> Zeyad