Public · Protected · Private
Open Closed Principle
Type: Public  |  Created: 2012-08-14  |  Frozen: Yes
« Previous Public Blog Next Public Blog »
Comments
  • classes / modules / functions (ENTITIES  ) should be open for extension,
    but closed for modification. When a single change to a program results in
    a cascade of changes to dependent modules, that program exhibits the
    undesirable attributes that we have come to associate with “bad” design.
    The program becomes fragile, rigid, unpredictable and unreusable.
    The openclosed principle  says that you should design modules that never change.
    When requirements change, you extend the behavior of such modules
    by adding new code, not by changing old code that already works.

    The primary mechanisms behind the Open-Closed principle are abstraction and polymorphism.In statically typed languages like C++, one of the key mechanisms that supports abstraction and polymorphism is inheritance.

     

    2012-08-14 17:07
This blog is frozen. No new comments or edits allowed.