If the classes are tightly coupled, it is difficult to reuse them separately because they depend on each other. Therefore, a single block system is generated. You cannot modify or remove a single class unless you understand the internal relationship or involve many classes. Dense mass of the entire system are hard to learn, transplant, and maintain.
Loose coupling enhances the possibility of reusing a single class and the entire system is easy to understand, transplant, modify
Design patterns are specific solution patterns (routines) that can be reused for specific problems in a specific situation that is constantly emerging. According to the three categories of creation, structure and behavior, this paper summarizes the main points of use of 24 kinds of design
1. four essential elements of a pattern:(1) pattern name;(2) problem;(3) solution;(4) consequences: the results and trade-offs of applying the pattern.
2. One person's pattern can be another person's primitive building block.
3. The design patterns in this book are descriptions of communicating objects and classes that are customized to solve a general design p
behavior that may change and make it open. It contains three meanings: first, the interface and abstract class are used to limit the boundaries of the extension. Public methods that do not exist in the interface or abstract class are not allowed; second, the parameter type and referenced object should try to use interfaces or abstract classes instead of implementation classes. Third, the abstraction layer remains stable and cannot be modified once determined.
2) metadata (metadata) controls
objects; The new object is used to re-use its existing functions by delegating methods that call existing objects. In short: Use the combination/aggregation relationship as much as possible, with less inheritance.7, Dimitri Law (least known principle) (Demeter Principle)Why is it called the least known principle, that is to say: an entity should be as small as possible interaction with other entities, so that the system function module is relatively independent. This means that a software entit
Six main principles:Single duty;Opening and closing principle;Dimitri Principle;The principle of the Richter replacement;dependency inversion principle;Interface Isolation principle23 Different design modes:Create Five types of models: Factory method mode, abstract Factory mode, singleton mode, builder mode, prototype mode. structure mode , a total of seven kinds: Adapter mode, adorner mode, proxy mode, appearance mode, bridging mode, combined mode, e
No nonsense C # One of the design patterns: the beginning
What is the design model?
What is Shaolin boxing? Shaolin Boxing is a set of martial arts routines that Shaolin monks have drawn after a long summary. There is a secret of Martial Arts called Shaolin Boxing, which records the applicable groups, style routines, and after-learning effects of this box
Design pattern (Patterns)
--the foundation of reusable object-oriented software
Design patterns are a set of repeated use, most people know, through the classification of purpose, code design experience Summary. Design
copy behavior of the object, you should also override the Copywithzone: methodOverrides should ensure that no new objects are created, such as:-(ID) Copywithzone: (struct _nszone *) zone {return self}5) If memory management uses non-arc, also consider overriding the Retain methodIt is necessary to ensure that the single object release is destroyed once, and retain does not make any sense, such as:-(ID) retain{return self;}
Implementation of single-instance
language is:1 , the dependencies between the modules can occur through abstraction, and the implementation class cannot have direct dependencies between them, and their dependencies are generated by interfaces or abstract classes;2 , interface, or abstract class does not depend on the implementation class;3 , implementing class-dependent interfaces or abstract classes;a more streamlined definition is "interface-oriented programming" ------OOD one of the essence. Benefits of the dependency inver
Design principle one : single principle of responsibility Definition: There should be only one reason for a class to cause it to change. Advantages: Reduce the complexity of the class, improve the readability of the class, improve the maintainability of the system. Example: Super Human public class Superman {public void Maintains world peace () {//Superman maintains world Peace}} Extension: public class Animal {Public void Breathe (String animal) {Sys
Why design patterns? Let's take a look at the six principles and use the design pattern principles.
Introduction
I don't like reading books very much, because I forgot to read ten lines of books, so I read the left teacher and copied it to improve my memory.
This is the http://www.cnblogs.com/zuoxiaolong/p/pattern1.html of o
Design principles of design patterns (medium)Interface Segregation Principle, then multiple interfaces are used instead. Each interface serves only one submodule. This is similar to the single responsibility principle shared for the last time. Purpose of designing the interface isolation principle: when designing an application, if a module contains multiple sub-
The original * * * * may need to change the application, separate them (encapsulated), and do not mix with the code that does not need to change.
The original * * * for interface programming, rather than for implementation programming, here for interface programming really mean "for super type Supertype programming", the key is polymorphism.
The original * * * Multiple use combination, less with inheritance.
Mode * * * * Strategy mode (Strategy pattern): Defines the algorithm family (a group
User Interface Design Patterns are solutions to common design challenges, such as navigating around a app, listing data or providing feedback to users.
Mobile apps and sites have unique UI design requirements because, compared to their desktop counterparts, they're used in smaller screens and, at least with today' s mo
design mode A book introduces design patterns to the software community, which is written by Erich Gamma, Richard Helm, Ralph Johnson, and John vlissides design (commonly known as "Gang of Four"). The core concepts behind the design patt
Introduction to Design PatternsDesign patterns represent best practices and are often used by experienced object-oriented software developers. Design pattern is a solution to the general problems faced by software developers in the process of software development. These solutions are summed up by many software developers over a long period of trial and error.Desi
One of the several javaScript design patterns-the single mode and the javascript Design Pattern
JavaScript is a weak type, dynamic, prototype-based language. This language feature makes it very easy,
It is even common to implement some of these modes.
The idea of the standalone mode is to ensure that a specific class has only one instance. This means that when y
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.