small medium large xlarge

06 Feb 2014, 07:55
Marco Vermeulen (1 post)

Hi all,

For starters, I just wanted to say that I’m loving the book. It’s turning to be such a great resource, and really enjoying both the style as well as how thorough it is! Great job Venkat!

I have come across something small in one of the examples that might be worth revising, unless I misunderstood it of course :-)

It’s the example in chapter 4 about Fluent APIs. I noticed that the final solution on page 83 of the pdf only sets up the the FluentMailer, but does not actually perform any send action.

Would it be an idea to have a private void send() method that gets invoked in the public static final send() method after the FluentMailer has been initialised properly?

In other words:

    private void send() {}

and then:

    public static void send(final Consumer<Mailer> block) {
        final Mailer mailer = new Mailer();

It’s just a small detail, and I’m not sure how far advanced the publishing process is, but thought I’d raise it none the less.

Keep up the great work! Marco.

06 Feb 2014, 17:28
Venkat Subramaniam (86 posts)

Hi Marco,

Thank you so much for the kind words, that means a lot.

In the example you’re referring, the original implementation of send (instance method) simply had a symbolic print statement to indicate sending. In the modified version, that symbolic print has been moved to the static send, to indicate that method taking the necessary action. Much like how the original send would do whatever it has to, the send in the modified code would do as well, and it does have access to the mailer if needed.

In other words, our focus here is on the interface fluency instead of the implementation.

Thanks again for your encouragement and also the input.



You must be logged in to comment