The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 (Not So) Stupid Questions 5: Inheritance Versus Interfaces
Subject:  interface definition is a design-time resource, inheritance is an implementation-time resource
Date:  2005-10-14 09:09:22
From:  rivasdiaz


As the famous GoF book says:

Prefer interfaces over inheritance.

Use interfaces as a design-time resource when you are planning your system. Inheritance should be used almos always to reuse code. If your system is designed based on interfaces, it will be easier to maintain and to evolve. Of course this is not a fixed rule, but it works most of the time.

 Feed java.net RSS Feeds