19 November 2007

Open Inheritance versus Designed Inheritance

Final means different things depending on where it’s found. If you put it in front of variables, that means ‘constant’. Final variables can just be assigned a value once.

It’s different if it’s put in front of methods and classes. In that case it means that it closes them from being overridden through inheritance. A final class can’t be extended, and a final method can’t be overridden by methods with the same signature in derived classes.

I’ve just discovered that closing or not a class to inheritance is behind two different school of thoughts: Open Inheritance and Designed Inheritance.

Here’s a little introduction to these two different approaches:

http://martinfowler.com/bliki/DesignedInheritance.html

No comments:

Post a Comment

Note: only a member of this blog may post a comment.