the six principles of object-oriented (recommended)It is difficult to make the software very flexible and easy to maintain. Flexible software His structure is complex and difficult to maintain. The key lies in how to deal with the two, making greater than the loss. The design and development of software should follow t
It is difficult to make the software very flexible and easy to maintain. Flexible software His structure is complex and difficult to maintain. The key lies in how to deal with the two, making greater than the loss. The design and development of software should follow the following six major principles:1. OCPFull name: "Open-closed Principle" open-closed principleDescription: Open for extension, close for mo
, and many international object-oriented products have emerged. Object-Oriented development methods include Coad, booch, and OMT. 1. booch Method Booch first describes the basic issues of object-oriented software development met
software structure, and the coupling strength depends on the complexity of the interface between the modules, the points entering or accessing a module, and the data through the interface. The program stresses low coupling, high cohesion. Is that the elements within the same module are highly dense, but the interdependence between the modules is less dense.Cohesion and coupling are closely related, and modules that have high coupling with other modules mean low cohesion, while the high cohesion
risk reduction, change is inevitable, if the single responsibility principle is good, when modifying a function, can significantly reduce the impact on other functions.One point to note is that the principle of single responsibility is not only specific to object-oriented programming ideas, but a single responsibility principle is applied to modular programming. 2, open closure principle OCP (Open-close pr
First of all, I wish you a happy holiday!!!Well, I do not know you chop hands no, little dream is not! I've missed the nineth year of the whole!Small partner is not a feeling, PHP is easy to get started, always put "PHP is the best language in the world" hanging on the tip of the tongue, think he simple, quickly complete the project!Then, finally, one day, you develop the project is too large, suddenly found: I write code is messy, good scalability, poor maintainability ....And then you made up
return New F ();}He is an encapsulation of class inheritance, in fact, the transition object is equivalent to the subclass in the class inheritance, but in the prototype as a transitional object appears, in order to create to return the new instantiated object.Of course, if you feel the need to cache the F transition, you don't have to create a new transition class F each time, and then the Object.create (
only one change point (every class shocould attempt to make sure that it has only one reason to this, the death of each badly designed piece of software .)
What remains unchanged in the software is changes. Poor design will cause the software to crash in changes, but good software can be easily changed.
Each type has only one reason for change, which will make your software relatively simple to cope with changes. In other words, reduce the change
Chapter eighth Introduction to object-oriented programmingThe contents of this chapter:What is object-oriented programmingOOP technologyThe Windows forms application's dependency on OOP8.1 Meaning of object-oriented programmingThe
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-
independent of the customers who use it.5. Advantages and DisadvantagesPros: Scalability is good. When we add a new module to the export, do not need to change the original code, only need to add a new import and export behavior class, and then the client side by setting the different behavior to determine the different import and export results.Cons: Increase in codeTherefore, judging the use of design patterns of standards, I think, is the function
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-
principles, In the final analysis, the goal of software design is to package change and reduce coupling, and the open closure principle is the most direct embodiment of this goal. The core idea of the Open closure principle is that software entities should be extensible and non-modifiable. That is, open to the extension, to modify the closed. Therefore, the open closure principle is mainly embodied
It has always been thought that the classes in the program used to encapsulate inheritance polymorphism is object-oriented design, it is not encapsulation, inheritance, polymorphism is only the three main characteristics of object-oriented, but in the
is the headquarters staff or the outside staff, should be able to participate in the lottery, or the company will not be harmonious.4. Principle of Reliance (the Dependency inversion Principle DIP)Depending on the abstraction, the upper layer relies on the lower layer.Assuming B is a lower module, but B needs to use the function of a, this time, B should not directly use the specific class in a: Instead, a abstract interface should be defined by B, and a to implement this abstract interface, B
1) The single responsiblity principle (SRP)
2) The Open-Close principle (OCP) Principle)
3) The liskov substitution principle (LSP)
4) Dependency inversion principle (DIP)
5) the interface segregation principle (ISP)
I. Single Responsibility Principle (SRP)
For a class, there should be only one reason for its change. What software design really needs to do is to discover responsibilities and separate them from each other. Test-driven development
responsibility principle is well adhered to, when a function is modified, it can significantly reduce the impact on other functions.One thing that needs to be explained is that the single responsibility principle is not only specific to object-oriented programming, so long as it is a modular program design, it applies a single responsibility principle.2. Open cl
During the interview, you are always asked, what is your understanding of JavaScript object-oriented?Object-Oriented programming (Object-oriented Programming,oop) is a programming paradigm. It speaks of objects as the basic unit o
The process-oriented design method emphasizes the consideration of the software's functional characteristics. process-oriented designers usually divide the system into multiple functional modules at different levels, at the same time, try to minimize the Coupling Degree between modules.
The main task of object-
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.