Interfaces and Abstract Classes - Don't design without them
Although this is a small article, which is some of the time is a good thing. The article won't help you learn how to use Abstract classes or interfaces but it does explain why they are useful, particularly why they are useful when used with Object orientated programming.
It describes the way I view interfaces and abstract classes where the interface or abstract class becomes the type instead of just the class. What this allows you to do is have many classes to become the same type as the interface or abstract class by implementing the interface or extending the abstract class. In other words Interfaces allow you to use Polymorphism but without the hierarchy and coupling that comes with abstract classes. This gives you good flexible points in your code where you can easily change the workings behind this type thus making your code easily changed in the future. The use of interfaces also allows you to separate the code via the interface and decouple the code.
I have blogged about Abstract classes versus Interfaces http://hoskinator.blogspot.com/2006/04/interfaces-vs-abstract-classes.html
but this articles takes a different approach by just describing the benefits and strengths of both. It finally talks about the collections frameworks as a good example of interface and abstract class usage.
here's the link
I really enjoyed reading the article, especially the part about interfaces because although it wasn't very long it explained the benefits of using interfaces very succinctly
1 Comments:
Great blog.
weight loss
By Anonymous, at Sun Dec 24, 05:29:00 am 2006
Post a Comment
<< Home