(According to the msdn webcast courses)
Coupling directly determines the behavior of the software in the face of changes.
When the coupling is tight, when a module changes, the relevant modules must be changed accordingly; the dependency is complex.
When loosely coupled, the module is easier to replace or change, while other related modules can remain unchanged. Simple dependency (small dots represent interfaces)
Do not be limited to a fixed method used by a
1. Conventional object creation methods:
// Create a road objectRoad = new road ();New problem:-Implementation dependencies cannot cope with changes to the "Specific instantiation type.
2. Origin of the factory Model
• The change point is "Object creation", so the "Object creation" is encapsulated"
• Interface-oriente
(According to the msdn webcast courses)
Started with Russian doll. The doll contains another one, and the last one does not contain any one.
The combination mode uses a tree structure to implement ubiquitous object containers. It converts a complex one-to-many relationship into a simple one-to-one relationship, so that a batch of objects can be processed in a consistent manner, make the customerProgramYou do not need to care about the specific imple
(According to the msdn webcast courses)
Intermediary mode dependency:
Multiple objects are closely related to each other. When an object changes, multiple objects may change accordingly. When an intermediate object is used, the object is not saved and referenced with other objects. After each object is dependent only
them wherever they are needed;
3. the clone method in prototype mode can use the memberwiseclone () method or serialization of the object class in. Net to implement deep copy.
About the Creation Mode:
1. The Singleton mode solves the number of object objects. Apart from Singleton, other creation modes solve the coupling relationship brought about by new;
2. Factory method, abstract factory, and builder a
know the return type is ArrayList, only know to return the list, this is the Richter replacement principle;
Public list
The two examples listed above are the relationships between the interfaces in the collection and the implementation classes, that is, the relationship between the base class and the subclass. The function that the base class can implement, the subclass can replace the base class to implement the corresponding function, this is also the Java
(According to the msdn webcast courses)
Solve the collection and access problems.
The internal structures of the set mainly include linked list and sequential.
Component developers often want to provide flexible external access without exposing the internal structure of the component.
Gof: provides a method to access each element of an aggregate object sequentially without exposing the organization structure of the
system design level, however, we only know one or two specific object-oriented languages.On the other hand, in the process of learning an object-oriented language, we usually first learn the procedural syntax of the language (for example, how to write a circular statement i
I. DefinitionThe open and closed principle (OCP), which is the full name of open for Extention and closed for modification principle, that is, the principle of opening and closing for modification. The idea of this principle is that we can meet the changes through expansion without modifying the code, or when designing a module, this module should be extended without being modified.II. ImplementationAbstraction is the key to implementing the open/closed principle. abstraction is a core feature o
pack them all into the window structure, so the function becomes this:int Draw(struct window*);So we just have to change the value in the struct, this idea is the object-oriented foundation, and C + + is to let this incoming struct automatically pass in, and then evolve for this pointer.Object-Oriented
The basic principle of object-oriented design http://www.cnblogs.com/malaikuangren/archive/2012/03/22/2411315.htmlInterface:Understand:An agreement between the parties.Benefits:interface and implementation separation;Easy to expand;Object-Oriented
public void M3 () {}//... #endregion #region Data Helpers publi c void M4 () {}//... #endregion}Guys, what do you think of this kind of writing?This is put into a variety of different types of auxiliary methods, each module has an auxiliary method need to find a place to put, people are consciously found this class, so this class in each release constantly have new members to join, and eventually become a monster, use, Look at the list of functions
Single duty principle srp:single responsibility PrincipleOpen Closure Principle ocp:open-close principleLiskov substitution principle Lsp:liskov substitution principleDependency Inversion principle dip:dependency invertion principleInterface Isolation principle Isp:interface separate principleIn object-oriented design, how to deal with the change of
Now the mainstream language of programming is basically object-oriented. such as C#,c++,java. When we use it, we have constructed a class. But often because of our internal or external design problems in the class, resulting in the objec
List of articles in this columnFirst, what is object-orientedSecond, C language can also achieve object-orientedThird, the non-elegant features in C + +Iv. solve the package and avoid the interfaceV. Rational use of templates to avoid code redundancyVI, C + + can also reflec
Single Responsibility Principle SRP: single Responsibility PrincipleOCP: Open-Close PrincipleLiskov replacement principle LSP: liskov substitution principleDependency inversion principle dip: dependency invertion PrincipleInterface isolation principle ISP: interface separate Principle
In object-oriented design, how to deal with changes in
Now the mainstream language of programming is basically object-oriented. such as C#,c++,java. When we use it, we have constructed a class. But often because of our internal or external design problems in the class, resulting in the objec
. Abstractions should not be dependent on detail, and details should be dependent on abstractionOr: To program for the interface, do not program for implementation. (Program to a interface, not a implementation.)2, Analysis: The principle of dependence reversal is Robert C. Martin in 1996 for the "C + + Reporter" column Engineering notebook third, and later added to his 2002 edition of the classic "Agile so
factory role. Through proper encapsulation, the factory model can purify most of the structures and isolate the practices that violate the principles into easy control. Joint use of C # interface and C # Abstract class: The Declaration type is undertaken by the C # interface, but a
Service-oriented analysis and design principles
Author/OLAF Zimmermann, pal krogdahl, Clive Gee
Experience from the initial Service-Oriented Architecture (SOA) Implementation Project shows that, for example, object-oriented analys
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.