Open/closed design principle

by Ruben

A while ago a friend and I were having a discussion about the use the private and protected access control attributes in AS3. While I stated that you should always try to write your code as open as possible as to make it flexible, he said that you should always make your code closed unless it was explicitely designed to be not so.

I think the open/closed design principle makes a good compromise: "open for extension, closed for modification".
What it means is that code should be written so that other programmers can easily add functionality by subclassing your classes (extension), while at the same time 'private' stuff like errors will have to be fixed within the original class (modification).