OCP:The Open-Closed Principle

Software entities (class,modules,functions,etc.) should be open for extension,but closed for modification.
"Open for extension.":This means that the behavior of the module can be extended.As the requirements of the application change,we are able to extend the module with new behaviors that satisfy those changes,In other words,we are able to change what the module does.
"Closed for modification.":Extending the behavior of a module does not result in changes to the source for binary code of the module.The binary executable version of the module,whether in a linkable library,a DLL,or a java.jar,remains untouched.
Abstraction is the key.

posted @ 2007-02-05 12:28  南守拥  阅读(255)  评论(1编辑  收藏  举报