"Program to an interface, not an implementation." 

This concept is different from deciding whether to use Java Interfaces
or abstract classes. The term interface in this context actually means
"type". This is basically the same thing as the Liskov's Substitution
Principle. LSP is a well defined principle whereas the above phrase is
vague and leads to confusion among new developers. The interview with
Erich Gamma on Artima website clarifies this confusion.

So, the term interface could refer to all the public methods in an
abstract class or it could be an interface. This guideline implies that
when you write code, the variable that you declare will be of
appropriate type. If it is too far up the hierarchy you have to cast in
order to use methods that are defined somewhere lower down in the
hierarchy.

Bala Paranj

-----Original Message-----
From: user@struts.apache.org [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 10, 2005 11:03 AM
To: Paranj, Bala
Subject: Why interface


--0-1585081136-1123685253=:83126
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


In Java/J2EE community, it seems that a lot of experienced developers
tend to use a lot of interfaces, however, a lot of junior developers
ignore using interface. I am not sure why interfaces seem to be favorite
to some experienced developers. Can some on
e explain this?Can you give examples where an interface is preferred?

Thanks.

 



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
--0-1585081136-1123685253=:83126--

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to