Discover design patterns reusable object oriented, include the articles, news, trends, analysis and practical advice about design patterns reusable object oriented on alibabacloud.com
method to grasp complexity is to break it into smaller parts when designing a complex software system, and then refine them separately.
AlgorithmDecomposition represents each module in the system as the main step in a general process. Object-oriented decomposition is used to break down the system based on the key abstraction in the problem field. The algorithm decomposition method highlights the sorting o
need to implement personality, the specific object will be called.Encapsulation of ClassesThe responsibilities of low-level modules should not be done by high-layer modules, or the encapsulation of classes will be broken.The specifics of the encapsulation of classes in a program are:1. Duplicate the object that defines the class.2. Cross-use of various kinds of objects, the correct usage is that after one
What is the data Access object pattern?
The data Access object design pattern describes how to create an object that provides transparent access to any data.
Application problem and solution of data access object pattern
For those who have also learned PHP and MySQL, the d
access methods defined in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
(15) Be cautious about classes that contain too many non-communicating behaviors.
Another manifestation of this problem is that many get and set functions are created in the public interface of the class in your application.
(16) In an application that is composed of an object-
. The creator is a factory class that defines the class method that is used to build the Product object. If you do not provide a default implementation, the subclass of the Creator class performs the instantiation. In general, It is the subclass of each creator class that instantiates a corresponding product subclass. The advantage of the Factory mode is on the creation object. Its task is to encapsulate th
model the dynamic semantics of classes. If you try to use a static semantic relationship to model dynamic semantics, the type will be switched during runtime.
(50) do not convert the class object into a derived class. Be careful with any Derived classes that only have one instance.
(51) If you think you need to create a new class at runtime, take a step back to recognize that you want to create an object
an empty method (that is, a method that does not do anything) in the derived class. P103
(53)Do not confuse optional items with the need for inheritance. Model the optional include into a class that inherits and can cause flooding. P108
(54)When creating an inheritance layer, try to create reusable frameworks instead of reusable components. P112
static semantic relationship to model dynamic semantics, the type will be switched during runtime.
(50) do not convert the class object into a derived class. Be careful with any Derived classes that only have one instance.
(51) If you think you need to create a new class at runtime, take a step back to recognize that you want to create an object. Now, we can generalize these objects into a class.
(52) it s
frameworks rather than reusable components when creating an inheritance hierarchy.
(55) If you use multiple inheritance in the design, first assume that you have made a mistake. If you do not make a mistake, try to prove it.
(56) as long as inheritance is used in object-oriented
reusable inheritance LayersFrameworkInstead of reusable components.
(55) If you use multiple inheritance in the design, first assume that you have made a mistake. If you do not make a mistake, try to prove it.
(56) as long as inheritance is used in object-oriented
of access methods in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
(15) Be more careful with classes that contain too much communication behavior.
Another manifestation of this problem is the creation of many get and set functions in the public interface of the classes in your application.
(16) In an application composed of an object-ori
of access methods in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
(15) Be more careful with classes that contain too much communication behavior.
Another manifestation of this problem is the creation of many get and set functions in the public interface of the classes in your application.
(16) In an application composed of an object-ori
I. Design Principles1. Dependency inversion principle (DIP)
High-level modules (stability) should not depend on low-level modules (changes), both of which should depend on abstraction.Abstract (stable) should not depend on implementation details (changes), and implementation details should depend on abstraction.
2. Open and closed principle (OCP)
Class modules should be extensible, but cannot be modified; open to extensions and closed to changes
Before studying the design patterns of object-oriented design, I had a vague understanding of Java interfaces and Java Abstract classes.
When I first learned the Java language, it was hard to understand why the concept of interfaces was required. Although multi-inheritance c
model the dynamic semantics of classes. If you try to use a static semantic relationship to model dynamic semantics, the type will be switched during runtime.
(50) do not convert the class object into a derived class. Be careful with any Derived classes that only have one instance.
(51) If you think you need to create a new class at runtime, take a step back to recognize that you want to create an object
class that inherits and can cause flooding.
(54) try to create reusable frameworks rather than reusable components when creating an inheritance hierarchy.
(55) If you use multiple inheritance in the design, first assume that you have made a mistake. If you do not make a mistake, try to prove it.
(56) as long as inheritance is used in
switched during runtime.(50) do not convert the class object into a derived class. Be careful with any Derived classes that only have one instance.(51) If you think you need to create a new class at runtime, take a step back to recognize that you want to create an object. Now, we can generalize these objects into a class.(52) it should be illegal to overwrite the methods in the base class by using an empty
the dynamic semantics of a class by inheriting relationships. Attempting to model dynamic semantics with a static semantic relationship causes the type to be switched at run time.(50) Do not turn the object of the class into a derived class. Be careful with any derived class that has only one instance.(51) If you feel you need to create a new class at run time, step back to see what you are creating. Now, generalize these objects into a class.(52) It
Object-oriented design principlesBorn to support maintainability multiplexing, these principles are embedded in many design patterns, which are the guiding principles that are summarized in many design scenarios, and understand
Why Study Design Patterns:1, more in-depth understanding of object-oriented thinking2, is conducive to the development of a strong extension of things What is a design pattern: a typical solution for a typical scenario that often occurs is the
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.