Interfaces Vs Classes

Inspired by some discussions in DontDistinguishBetweenClassesAndInterfaces.

I like to say that interfaces are different from classes in at least two important ways (at least in Java):

They don't have class in the sense that you cannot do anything useful at the class level with interfaced objects - in Java terms, there are no static methods.

They don't have a life in the sense that the lifecycle of an interfaced object must be managed by another object. Or, at least the creation must be.

Should one use factories universally? I've been tempted to think so. There are some real limitations with public Java constructors, but I haven't had enough pain yet to pitch them entirely. If one does that, then the creation difference between interfaces and classes disappears.

--JeffMantei 2000-12-14


CategoryInterface


EditText of this page (last edited June 19, 2002) or FindPage with title or text search