From this post, we describe the design pattern in 23, giving the instance code for each design pattern. The code will be given at the end of this blog post.
The reference book of this blog is "Zen of Design Pattern" and "Big Talk design mode" two books.
But "Big talk design Mode" is not written in the Java language, so for the primary Java or a certain Java foundation of the people do not seem intuitive, especially for those who do not have the concept of design patterns, it seems a bit laborious, There is also a bad place is the inside of each model of the narrative is based on a certain scenario, there are big birds and rookie redundant dialogue, it looks really redundant!! (Note: This is a personal understanding and feeling!) If you don't like it, don't spray it ~ ~ ~ "Hold the Head")
So I recommend you to learn design patterns, the beginning of the "design mode of Zen" a book!!! This can be bought.
But later in the article I will give the two books electronic version, if you like the electronic version of the book is also possible. Please download the electronic version at the end of the article.
In fact, I also recommend another book, "-java design mode (2nd edition) Chinese version", the book I am just beginning to see, but from the introduction of the book on the 23 design patterns are categorized into five categories:
So in this blog post in the organization also use these five types of models for overview, avoid a pattern of a blog post, too redundant.
Blog post will only post the code, in the code will be in the necessary places to comment, you can understand.
The diagram for the Code Organization Section is as follows:
Each design pattern is organized under a package, and each package has a main class key function to debug, get the results, and post the results of the test in the main section, as well as an overview of the design patterns to be described.
Statement : Because I also refer to the above two books for the organization of the Code, and the main reference to the "design mode of Zen" a book, the code part and the book of the example of basic consistency, the original purpose is purely self-learning design patterns, so not to tell you about the purpose of design patterns, It's not going to teach you how to program design patterns, so please just flip through them. My level is also limited, inevitably there are mistakes, please light spray! or comment on the message, I will promptly reply to you! Progress together, thank you ~ ~
Originally wanted to each design mode to make a statement, but the 23 design mode, plus each design pattern code organization, will cause the blog is finally a lengthy, and "design mode of Zen" a book has been described in detail, so this article only in the form of an overview, to exchange ideas to tell. The ultimate goal is to exchange learning.
It is worth mentioning that the design pattern needs to be familiar with the design of UML class diagram, I just rarely know a uml, but in the "Big Talk design mode" in the introduction of the UML class, and "Java Design mode (2nd edition) Chinese version" in the appendix three parts of the UML class is also a simple explanation, We can all refer to it. If you want the system to learn UML class diagram design, please refer to my previous blog post related introduction. (In fact, I am reproduced others, we do not spray!) Welcome to the original blog, they write quite good!! )
Blog address: In layman's UML class diagram (i)
There are five blog posts about UML class diagram design, we can refer to.
However, in the design mode of this kind of class diagram does not have a high demand for UML, we only use to be familiar with UML class diagram, can understand.
Well, with so much to say, the design pattern is nothing to tell.
The following is an example code for the design pattern:
The code gives a more detailed overview of each model, which you can refer to.
Instance code download
ebook Download:
Zen Download of Design Patterns
Big talk design mode download
Java design mode Chinese version (second edition)
Design pattern Learning-and example source and ebook Downloads