Below are some thoughts on the Open-Closed Principle. -- Karl
Bertrand Meyer proposed the Open-Closed Principle:
Software entities should be open for extension but closed
for modification.

Robert Martin has included this principle in his 
list of OOD principles as the single most 
important guide for an OO designer.
See: http://www.oma.com (Principles of OOD)

The Open-Closed Principle means that we design our applications 
such that when they need to be changed, they can be changed by
adding new code (or no code at all in the aspect under
consideration!) and not by changing working code.

The work on AP and AOP can be seen as supporting the 
Open-Closed Principle at a higher level.

Some examples:

Context objects:
To modify the behavior of an object o, attach a context object to it.
Do not modify the class of o.

To modify a traversal with visitors, add more visitors or add more
traversal methods to existing visitors. This can be done
by subclassing visitor classes without modifying existing code.

To modify a traversal, we need traversal refinement. See:
http://www.ccs.neu.edu/research/demeter/biblio/LZHL97-tkde.html

To modify a well-written draw method for drawing shapes by
adding new shape types or modifying shape types, do nothing.

To modify an adaptive program for task f by modifying the class
graph within limits, do nothing.

To modify a sequential program to make it suitable for 
concurrent execution, add a coordination language aspectual
description and don't change the adaptive program.

The Open-Closed Principle calls for programming languages which
support refinements for the important language concepts
(classes, traversals, visitors, coordination descriptions, etc.)
and high genericity through partial descrptions.