Thinking in Patterns chapter 8: Specialized creation

Thinking in Patterns with Java V0.9: chapter 8: Specialized creation: TIPatterns.htm#_Toc41169717

1, The sections name of today's learning;

Prototype. 61

Builder. 62

Exercises. 66

2, What is it talk about in these sections my comments and feeling of the content:

1), Prototype

Come up with it at this chapter, but will descript it later.

2), Builder.

"They never define exactly what they mean by representation. ", "but alas, ", etc... Again, Bruce appears to be not satisfied with the GoF's work about this part. At the end of this section, Bruce gives a simple definition of "Builder" pattern is: "Thus, Builder could be described as using a Policy to create objects."

And, maybe I have known a difference between "State" and "Builder" is: State "simply forwarding the requests" , Builder "has a sequence of operations to perform", and both "State" and "Builder" is called by a context to perform its job. At this point, maybe I have seen a little meaning of the "context" which mentioned at the begin of this book as "it will often be the controller that manages the operation of the pattern". In the example: state:StateDemo.java, the context class is "ServiceProvider", in the example: builder:BuildMedia.java, the context is "MediaDirector".

And, maybe I have also known a little of statement appeared at the section of State pattern: "State can be found everywhere because it’s such a fundamental idea. For example, in Builder, the “Director” uses a backend Builder object to produce different behaviors.".

At this point, the difference of "State", "Strategy", "Policy", "Builder" patterns make me a bit dizzy. But, I think if I read more source code of these patterns and apply these patterns in some real projects (like LearnDiary), maybe I will master these patterns really, and maybe create my own design patterns, isn't it?

3, My questions about the program;

1), Although the resulting “object” (the entire converted text file) is created over time, if you consider the conversion of each RTF directive to be an object, this feels to me a little more like Bridge, because the specific types of converters extend the interface of the base class.

2), exercises;

4, My questions about the english language;

1), Strange words:

representation, spread out, over time, essence, maze, alas, overwhelmingly, compelling, a.k.a. (Also known as.), in some ways

2), Strange sentences:

1>, The final variation of the maze builder is something that doesn’t create mazes at all, but instead counts the rooms in an existing maze.

===============================================================================================================

UML classes diagrams of examples mentioned in this chapter:

**********************************************************************************************

//: state:StateDemo.java

// Simple demonstration of the State pattern.

 

*****************************************************************************************************

//: strategy:StrategyPattern.java

//Strategy: choosing the algorithm at run-time

***************************************************************************************************

//: builder:BuildMedia.java

// Example of the Builder pattern

                                                      incomplete