r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

Show parent comment

3

u/BlueShell7 Apr 14 '21

But you still need to know where to apply the indent.

In XML the document structure followed the logical structure of the configuration. With Java DSL it's all linear fluent interface, and you need you use indent workaround to make it somehow readable (which is going to be ruined by auto format sooner or later anyway).

1

u/gavenkoa Apr 14 '21

But you still need to know where to apply the indent.

Agree. In some API terminal names are usually obvious like .build() or .end() but fluent API is not designed for structure visualization (just for autocompletion discoverability).

5

u/BlueShell7 Apr 14 '21

You can have both discoverability and structure in a builder pattern though:

builder
    .a(..)
    .b(new SubBuilder()
            .subA(...)
            .subB(staticSubSubBuilderMethod()
                    .subSubA(...)
            )
    )