The Artima Developer Community
Sponsored Link

Interface everywhere?

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Interface everywhere?

Posted by Sebastian Nguyen on 15 Dec 1998, 5:25 PM

Hi everybody:

I've been a lurker in your discussion group for a while, and
let me say that the issues discussed are right on target
and that this forum is a great medium to discuss it in. The
people here articulate themselves clearly and are knowledgable.

Now for the question.

So interfaces are great. They separate implementation from
class signatures, allowing us more freedom to change our
implementation. So should I use an interface to wrap every
class whose implementation might change in the future?
Depending on your level of paranoia about implementation changes,
this could include almost every class of a program.

For example, suppose we pretend Java's File class does not
exist. Should a File class that I might write be have an
interface? Surely the implementation of delete() method
that allows a file to remove itself will change if I decide
to port my application from UNIX (rm) to DOS (del).

What is the rule of thumb for setting this level of paranoia?

Sebastian




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us