61 empirical principles of Object-Oriented Design
Excerpted from the log of OOD, translated by BaO zhiyun, Arthur J. Riel
"You do not have to strictly abide by these principles and violate them and are not subject to religious penalties. But you should
61 empirical principles of Object-Oriented Design
Author: Arthur J. Riel
"You do not have to strictly abide by these principles and violate them and are not subject to religious penalties. But you should regard these principles
an empty method (that is, a method that does nothing) in the derived class.(53) do not confuse optional items with the requirements for inheritance. Model the optional include into a 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 mi
Three basic elements of object-oriented architecture: encapsulation, inheritance, and Polymorphism
Five basic object-oriented design principles:
Single-Resposibility Principle)
Its core idea is: A class, it is best to do only one
Three basic elements of object-oriented architecture: encapsulation, inheritance, and Polymorphism
Five basic object-oriented design principles:
Single-Resposibility Principle)
Its core idea is: A class. It is best to do only one
Arthur J.riel once said that you do not have to strictly abide by these principles and will not be sentenced to religious punishment for violating them. But you should think of these principles as alarms, and if you violate one of them, the alarm will ring. So, whatever we do, we have to have a principle. Programming is no exception, the following describes
PHPThe principle of
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 design, I have two questions: (1) is the derived class a special type of the thing it inherits? (2) is the base class part of the derived class?
(5
a unified manner according to the design.
(13) do not create all-powerful classes/objects in your system. Be especially careful about the classes whose names include Driver, Manager, System, and Susystem. Plan an interface instead of implementing an interface.
(14) Be careful with classes that define a large number of access methods in public interfaces. A large number of access methods mean that related data and behaviors are not stored in a central
is, the top-level classes should share work in a unified manner according to the design. P30(13) do not create all-powerful classes/objects in your system. Be especially careful about the classes whose names include driver, Manager, system, and susystem. P30Plan an interface instead of implementing an interface.(14) Be careful with classes that define a large number of access methods in public interfaces. A large number of access methods mean that re
. If you do not make a mistake, try to prove it.(56) as long as inheritance is used in object-oriented design, I have two questions: (1) is the derived class a special type of the thing it inherits? (2) is the base class part of the derived class?(57) If you find multiple inheritance relationships in an object-
3 basic elements of object-oriented: encapsulation, inheritance, polymorphism
Object-oriented 5 basic design principles:
single Duty principle (Single-resposibility Principle)
Its core idea is: A class, it is best to do only one t
the design.
(13) do not create all-powerful classes/objects in your system. Be especially careful about the classes whose names include driver, Manager, system, and susystem.
Plan an interface instead of implementing an interface.
(14) Be careful with classes that define a large number of access methods in public interfaces. A large number of access methods mean that related data and behaviors are not stored in a centralized manner.
(15) Be c
61 empirical principles of Object-Oriented Design
Excerpted from the good revelation-Arthur J. Riel
(1)All data should be hidden inside the class. P13
(2)The class user must be dependent on the common interfaces of the class, bu
direction as much as possible, that is, the top-level classes should share work in a unified manner according to the design.
(13) do not create all-powerful classes/objects in your system. Be especially careful about the classes whose names include driver, Manager, system, and susystem.Plan an interface instead of implementing an interface.
(14) Be careful with classes that define a large number of access methods in public interfaces. A large num
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 design, I have two questions: (1) i
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 design, I have two questions: (1) i
number of access methods in public interfaces. A large number of access methods mean that related data and behaviors are not stored in a centralized manner.(15) Be careful with classes that contain too many non-communication behaviors. Another manifestation of this problem is in your application.ProgramMany get and set functions are created in the public interface of the class.
(16) In an application composed of an object-
access methods in public interfaces. A large number of access methods mean that related data and behaviors are not stored in a centralized manner.
(15) Be careful with classes that contain too many non-communication behaviors.
Another manifestation of this problem is in your application.ProgramMany get and set functions are created in the public interface of the class.
(16) In an application composed of an object-
derived class. p103(53) Do not confuse the optional inclusion with the need for inheritance. Modeling an optional inclusion into a class where inheritance can lead to flooding. p108(54) When creating an inheritance hierarchy, try creating a reusable framework, rather than a reusable component. p112(55) If you use multiple inheritance in your design, let's say you made a mistake. If you don't make a mistake, you need to try to prove it. P120(56) If yo
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.