You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Filip Strajnar <fi...@gmail.com> on 2023/09/29 10:33:37 UTC
[EMAIL] Fluent interface
Greetings,
I've noticed that some methods on the org.apache.commons.mail.Email
class provide fluent interface (examples include setCc, addBcc,
addReplyTo), and some do not (to name a few: setAuthentication,
setSmtpPort, setMailSession). Is this intentional, or am I allowed to
submit a PR that would change all relevant void methods so that they
would return an Email object instead?
Sincerely,
Filip Strajnar
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [EMAIL] Fluent interface
Posted by Gary Gregory <ga...@gmail.com>.
At some point in the future we will have a 2.0 and that's when to revist
this issue. Feel free to create a Jira ticket to request this as a feature
for a future 2.0.
Gary
On Fri, Sep 29, 2023, 7:47 AM Elliotte Rusty Harold <el...@ibiblio.org>
wrote:
> Personal opinion: it probably wasn't intentional, but please don't do
> that. It doesn't help anyone and is needless churn. Fluent methods are
> not better than non-fluent ones, and are in fact less semantic and
> harder to debug. They prioritize saving code writing over code
> maintainability.
>
> Not just personal opinion: The API MUST not be changed in an
> incompatible way. Changing the return type of an overridable method is
> an incompatible change that is forbidden. Return types of
> non-overridable methods (final, private, or static) might be able to
> be changed, but still shouldn;t be.
>
> On Fri, Sep 29, 2023 at 7:13 AM Filip Strajnar <fi...@gmail.com>
> wrote:
> >
> > Greetings,
> >
> >
> > I've noticed that some methods on the org.apache.commons.mail.Email
> > class provide fluent interface (examples include setCc, addBcc,
> > addReplyTo), and some do not (to name a few: setAuthentication,
> > setSmtpPort, setMailSession). Is this intentional, or am I allowed to
> > submit a PR that would change all relevant void methods so that they
> > would return an Email object instead?
> >
> >
> > Sincerely,
> >
> > Filip Strajnar
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
>
> --
> Elliotte Rusty Harold
> elharo@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
Re: [EMAIL] Fluent interface
Posted by Elliotte Rusty Harold <el...@ibiblio.org>.
Personal opinion: it probably wasn't intentional, but please don't do
that. It doesn't help anyone and is needless churn. Fluent methods are
not better than non-fluent ones, and are in fact less semantic and
harder to debug. They prioritize saving code writing over code
maintainability.
Not just personal opinion: The API MUST not be changed in an
incompatible way. Changing the return type of an overridable method is
an incompatible change that is forbidden. Return types of
non-overridable methods (final, private, or static) might be able to
be changed, but still shouldn;t be.
On Fri, Sep 29, 2023 at 7:13 AM Filip Strajnar <fi...@gmail.com> wrote:
>
> Greetings,
>
>
> I've noticed that some methods on the org.apache.commons.mail.Email
> class provide fluent interface (examples include setCc, addBcc,
> addReplyTo), and some do not (to name a few: setAuthentication,
> setSmtpPort, setMailSession). Is this intentional, or am I allowed to
> submit a PR that would change all relevant void methods so that they
> would return an Email object instead?
>
>
> Sincerely,
>
> Filip Strajnar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
--
Elliotte Rusty Harold
elharo@ibiblio.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [EMAIL] Fluent interface
Posted by Mike Drob <md...@mdrob.com>.
I think the natural next question is whether we can have a major version
change?
Mike
On Fri, Sep 29, 2023 at 6:24 AM sebb <se...@gmail.com> wrote:
> On Fri, 29 Sept 2023 at 12:13, Filip Strajnar <fi...@gmail.com>
> wrote:
> >
> > Greetings,
> >
> >
> > I've noticed that some methods on the org.apache.commons.mail.Email
> > class provide fluent interface (examples include setCc, addBcc,
> > addReplyTo), and some do not (to name a few: setAuthentication,
> > setSmtpPort, setMailSession). Is this intentional, or am I allowed to
> > submit a PR that would change all relevant void methods so that they
> > would return an Email object instead?
>
> The return type is part of the Java method signature.
>
> Changing it would affect binary compatibility, so would not be
> possible without a major version change.
>
> >
> > Sincerely,
> >
> > Filip Strajnar
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
Re: [EMAIL] Fluent interface
Posted by sebb <se...@gmail.com>.
On Fri, 29 Sept 2023 at 12:13, Filip Strajnar <fi...@gmail.com> wrote:
>
> Greetings,
>
>
> I've noticed that some methods on the org.apache.commons.mail.Email
> class provide fluent interface (examples include setCc, addBcc,
> addReplyTo), and some do not (to name a few: setAuthentication,
> setSmtpPort, setMailSession). Is this intentional, or am I allowed to
> submit a PR that would change all relevant void methods so that they
> would return an Email object instead?
The return type is part of the Java method signature.
Changing it would affect binary compatibility, so would not be
possible without a major version change.
>
> Sincerely,
>
> Filip Strajnar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org