PubMed correct job open closed principle

4.1 PubMed fail

4.2 Open Closed Principle

Is said software entities (classes, modules, functions, etc.) should be extended, but not modify,

For the extension is open for change is closed,

But the face of changes in demand may remain relatively stable, so that the system can keep out of the new version after the first version,

The elastic system to work, i.e. open closed time performance,

4.3 When to cope with change

No matter how the module is "closed", there will be a number of closed can not change, since it can not be completely closed, the designer must be closed to make a choice as to what changes he designed the module, he must guess the most the kind of changes that may occur, and then construct abstract to isolate those changes,

When you first write the code, assuming that does not change, when the change occurs, create an abstract to isolate similar changes in the future,

The face of demand changes to the program is carried out by adding new code, rather than changing existing code,

Open Closed Principle is the core of object-oriented design, follow this principle can bring enormous benefits of object-oriented technology claimed, that is maintainable, scalable, reusable, flexible, and should only program showing frequent make changes in those parts of the abstract, but the program for each part deliberate abstraction is not a good idea,

4.4 hands ready and go all out

Guess you like

Origin www.cnblogs.com/huangxuQaQ/p/11263449.html