experience reach a certain level, and it also means to summarize a lot of good design experience, however, it may not be the case that "no teacher can do anything", or you can say that, on the basis of level and experience, it is time for the system to learn the "mode, it is helpful to learn the experts' summary and verify your own shortcomings.
This series of design p
23 design patterns (22) java state patterns, 23 Design Patterns
I. Overview
When an object in the system has multiple states, these States can be converted, and the state mode can be used for different states of the object. The St
Common java design patterns, java Design Patterns
1. Factory design model.
Reference: http://www.cnblogs.com/zhouqiang/archive/2012/07/20/2601365.html
There are three types: Simple Fa
In the previous Java 23, you learned about the singleton mode and Factory mode of design mode. Here, the design pattern is introducedPrinciple of object-oriented thought designIn the actual development, we want to understand the object-oriented thinking more deeply, we must be familiar with the design principles of the
StaticSingleton getinstance () {if(INSTANCE = =NULL) {INSTANCE=NewSingleton (); } returnINSTANCE;//get instantiated Object } Public voidprint () {System.out.print ("Hello word"); }} Public classtest{ Public Static voidMain (String args[]) {Singleton s= Singleton.getinstance ();//regardless of how many times the getinstance () method is called, the resulting instantiation object is the sameS.print (); }}Multiple design
Illustration: Java 23 design patterns Note 1, Java 23 Design PatternsIterator pattern 1.1 Iterator Pattern
The element code in the array arr is displayed in Java as follows:
1 for (int I = 0; I
Many elements are saved in the a
patterns, and the book has been recognized as a cornerstone in the field of design patterns.Some basic principles of object-oriented1. For abstract principlesWhen designing a class, do not let the class target a specific class, but instead target an abstract class or interface.For example: Define a cylinder with a triangular bottom face2. Open-Close principleThe design
23 Types of Java design pattern analysis
I. Overview of Design Patterns
In general, design patterns fall into three broad categories:
Create five types of models: Factory method mode, abstract Factory mode, singleton mode, builde
pattern is to encapsulate some action that is applied to a data structure element. Once these operations need to be modified, the data structure that accepts the operation can remain unchanged. The visitor pattern is suitable for systems with relatively indeterminate data structures, which frees up the coupling between the structure and the operation of the structure so that the set of operations can evolve relatively freely. The visitor pattern makes it easy to add new operations, which is to
, for a dependent class, regardless of how complex the logic is, try to encapsulate the logic inside the class as much as possible. Outside of the public method provided. Incorrect external leaks no matter what information.It's a little hard to remember. Summary is:father1Opening and closing principleThis is nothing to say: try to make changes by extending the behavior of the software entity rather than changing the existing code. Transfer from http://blog.csdn.net/cq361106306/article/details/38
23 design patterns (21) java meta-mode and 23 Design Patterns
Dr. Yan Hong's book "JAVA and patterns" describes the Flyweight mode as follows:
In boxing, Flyweight refers to the most li
now requiredAdvantages:1, isolated the generation of specific classes, so that users do not need to care about when the physical product was created2, when multiple objects of an abstract product (such as P8, P9, P10 in the Huawei P-series phones) are designed to achieve the same abstract product, the client can be guaranteed to use only the same productDisadvantages:1. It is difficult to expand the abstract factory when adding new products.Abstract Factory class: Entity
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.