java - Building an object -
i came across rather unusual way build object of class in blog : http://marchwicki.pl/blog/2010/11/building-a-pojo-in-an-elegant-way/. way this. benefits?
i came across rather unusual way build object of class in blog : http://marchwicki.pl/blog/2010/11/building-a-pojo-in-an-elegant-way/.
this builder design pattern fluent interface.
as see article, 2 ideas complementary , used (which i've seen call "fluent builder"), so, confused same thing:
the builder pattern abstracts , simplifies construction of complex object simpler steps.
the builder pattern discussed in "gang of four"'s design patterns book
joshua bloch talks builders item 2 in book effective java
a fluent interface api-style uses contexts , method chaining improve readability of code.
- see martin fowler's post fluent interfaces:
http://www.martinfowler.com/bliki/fluentinterface.html
- see martin fowler's post fluent interfaces:
note can use builder pattern without fluent interface (e.g. builder simple setters). can use fluent interface idea in more contexts builders (e.g. improve readability of set of overloaded methods many parameters , parameter variations).
is way this?
this "fluent builder" seems highly accepted "a way this" (at least based on number of articles , blog posts i've seen proselytizing idea).
what benefits?
each idea has own distinct advantages/benefits. example, see:
builder - when use builder pattern?
fluent interface - what's fluent interface?
Comments
Post a Comment