Object construction

I came across a rather unusual way of creating a class object on this blog: http://marchwicki.pl/blog/2010/11/building-a-pojo-in-an-elegant-way/ . This is a good way to do it. What are the benefits?

+1
source share
6 answers

I came across a rather unusual way of creating a class object on this blog: http://marchwicki.pl/blog/2010/11/building-a-pojo-in-an-elegant-way/ .

This is a constructor design template with a free interface .

, ( , " " ), , :

, (, ). , (, ).

?

" " " " ( , , , ).

?

/. , .

+7

- . , .

API, , API .

+4

, , 2 " Java".

+3

Builder. , , . GoF :

  • . . . , . , , .
  • . . , ; Builder. ConcreteBuilder . ; .
  • . , Builder -. , . Builder , . , , .

ProgramNodeBuilder Smalltalk-80. Parser, ProgramNodeBuilder. Parser ProgramNodeBuilder , . , , , .

+3

stackoverflow , : -)

, ( , : ) . ( ), , . , , , . , , .

+1

, Builder Fluent Interface . .

I wrote a small Builder example with the Fluent Interface, hope this helps.

http://jpereira.eu/2011/10/12/fluent-interfaces-while-trying-to-make-sense-of-prototype-pattern/

+1
source

Source: https://habr.com/ru/post/1530117/


All Articles