Alibabacloud.com offers a wide variety of articles about best object oriented design book, easily find your best object oriented design book information here online.
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
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
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 regard these principles as warning bells. If you violate one of them, the warning bells wi
(string audiotype) { switch (audiotype.tolower ()) { case ("MP3"): PlayMp3 (); break; case ("wav"): playwav (); break; } } }
Naturally, you will find this design very bad. Because it does not provide a minimum scale for future changes in requirements. If your design turns out to be the case, then when you're overwhelmed by the overwhelming demand change, you might want to get the
When we first came into contact with object-oriented thinking, I think the first concept we came into contact with should be"
Class ", We have been discussing profound issues such as how to design classes and how to implement classes, but have we ever thought about what is called" classes "and what is the essence of classes ?. According to the introduction in mo
Legend has it that object-oriented development patterns were first created by lazy programmers. Development so far, people from the initial hot loyalty to discuss whether a certain language is enough object-oriented to now start a broader focus on object-
change should be closed for the module he designed. He must first guess the most likely types of changes, and then construct an abstraction to isolate those changes.Take action immediately when changes occur.
When we first wrote the code, we assumed that the change would not happen. When a change occurs, we create an abstraction to isolate similar changes that occur later.In the face of requirements, changes to the program are made by adding new Code, rather than changing the existing code.We h
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
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
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 as warning bells. If you violate one of them, the warning bells will ring ."
---------- Arthur J. Riel
(1) All data should be hidden i
in object-oriented design, ask yourself two questions: (1) is the derived class A special type of the thing it inherits from? (2) is the base class part of a derived class?(57) If you find multiple inheritance relationships in an object-oriented
by the program, the value of the inside does not know when will be overwritten If you pass a class, struct, and so on, the parameters and return values are passed through some space in memory.The reference is converted into a pointer operation.Constructor: The same as the class name, no return value, implementation of the class member initialization. It is best to initialize the initial value list, and if the function body is initialized, the data member has completed the default initialization
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 thing, only a change that caused it. The princ
to say for the first time; the second compilation is like this; the third is basically a bit familiar; the fourth time, he actually brought me from VB to C #, and he was unable to extricate himself. In fact, the intermediate version has also changed. Now it should be version 4th. Program Language design I will start reading it slowly when I come back from work this evening. The father of C ++ should have a good
break the packaging of the program, the client sees the method should not be seen, no custom interface for the client. Therefore, the interface needs to be reconstructed according to the principle of interface isolation and the principle of single responsibility, and some of these methods are encapsulated in different small interfaces, ensuring that each interface is convenient to use and assumes a single role, each of which contains only one client (such as a module or class) that is required
I have been doing program design for the object-oriented design model for a short time. I recently went to several companies for an interview and was asked about the object-oriented design
Object-Oriented design method: The basic idea of Java object-oriented programming is to solve problems by constructing and organizing objects. Objects are good, and any object can be considered an
your system. Be especially careful with classes whose names contain driver, Manager, System, Susystem. Plan an interface instead of implementing one.
Be careful with classes that have a large number of access methods defined in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
Be cautious about classes that contain too many non-communicating behaviors. Another manifestation of this problem is that many get and set func
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.