Alibabacloud.com offers a wide variety of articles about interface or abstract class, easily find your interface or abstract class information here online.
I. Design Pattern principles:
1,Single responsibility principle:
Specific description: there should be only one reason for a class change, that is, a method should do only one thing as much as possible, that is, to implement only one
Problem Introduction: for example, if there are A-type and B-type nuts, you can directly use A-type screws produced by A-type nuts on a-type nuts, you can also directly use B-type screws produced according to B-type Nut standards on B-type nuts.
1. Single Responsibility Principle (SRP)
Original Definition: There shoshould never be more than one reason for a class to change.
BOTH: there should be and only one reason for class changes.
Benefits of a single responsibility:
1. The
When writing a Java program, a class (or interface) is typically placed in a separate Java file, and the class name is the same as the file name (if the class is public, the class name must be the same as the file name; non-public, no mandatory
Many netizens consult to learn Java has what shortcut, I say " without him, only hand ripe ". But is willing to write some experience, so that later people less detours, help others is the greatest joy!To learn Java well, you first need to know the
Many netizens asked me to learn Java have any shortcut, I said "without him, only hand-cooked." But I am willing to learn some of their experience to write out, so that later people less detours, help others is the greatest joy!To learn Java well,
Definition: Provides an interface for creating a set of related or interdependent objects without specifying their specific classes.Type: Creating class ModeClass Diagram:
The difference between abstract Factory mode and factory method
Before that, I wrote an in-depth introduction to Ms Enterlib PIAB (see "Ms Enterprise Library Policy Injection Application Block in-depth resolution [summary]"), Also wrote WCF integration with PIAB (see: WCF Follow-up Tour (8): implementation of
---restore content starts---Many netizens asked me to learn Java have any shortcut, I said "without him, only hand-cooked." But I am willing to learn some of their experience to write out, so that later people less detours, help others is the
From: http://www.cnblogs.com/zhenyulu/articles/39257.html
Reference: http://www.dofactory.com/Patterns/PatternPrototype.aspxI. prototype mode
Definition: Specify the kind of objects to create using a prototypical instance, and create new objects by
The factory model is quite tangled when I look at English books. I feel like I'm confused in head first, and I can't even read it anymore. When I look at other people's summary in Chinese, a main line will come out right away.
There are three main
Definition:Given a language, it defines a representation of its syntax and an interpreter that uses this representation to explain sentences in the language.
Type:Behavior mode
Class diagram:
The interpreter mode is rarely used, and I have never
1. abstractfactoryVSBuilder
The Builder mode is very similar to the Abstract Factory mode in Abstract view. However, the Builder mode focuses on how to assemble an object, while the abstract factory focuses on which class of the instance. In the
4.3.4 introduce the facade Mode
The facade mode can be used to encapsulate some complex logics to facilitate callers to call these complex logics. It seems that a uniform facade is provided, which encapsulates internal subsystems into a high-level
I,Definition
I recently started to study the head first design model. This book is refreshing and difficult to get sleepy. Today, I will share with you the policy model.
1.Definition:
Policy mode definedAlgorithmFamily, respectively, so
Definition:Provides an interface for creating a set of related or interdependent objects without specifying their detailed classes.
Type:Create Class Mode
Class diagram:
Differences between Abstract Factory mode and factory method mode
Abstract
Abstract Factory: Definition: Provides an interface for creating a set of related or interdependent objects without specifying their specific classes. Type: Create class mode Class Diagram: Calling the class client Factory Interface Ifactory Product
One, the first step to optimize the code: a single responsibility principleEnglish Name: SingleResponsibility Principle (SRP)Definition: as far as a class is concerned, there should be only one cause for it to change. In simple terms, a class should
Simple Factory mode, factory method mode and abstract Factory mode are all created design patterns, and none of the three creation models need to know the specific class. We grasp the idea that when creating an object, it is necessary to encapsulate
Go directly to the topic, interpreter UML diagramAs you can see from the UML diagramThe core is the Abstractexpression class, which is the abstraction layer of the interpreter. His core approach is interpret (Content)OK, now we can think, how to
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.