Title: interface for only 1 class
You can not assume that interface is used only for abstraction. Interface can be used for mixin typing, marker, accessibility, etc. The following is an example that the inner class provides two different interfaces to different clients:
 
class Kangaroo
{
    KangarooKittyIF getKitty(){ return new Kitty() ; }
 
    private static class Kitty implements KangarooKittyIF
    {
        public String getName() {...}
 
        private void setName() {...}
    }
}
 
interface KangarooKittyIF
{
    public String getName();
}
 
 
enjoy.
 
 
Jeff Yan
 
 
-----Original Message-----
From: Greg Nudelman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 1:28 PM
To: JDJList
Subject: [jdjlist] Re: interface for only 1 class

It depends.  Let's say you only expect to use Oracle DB in the foreseeble future.  So you write your driver loading, and persistance all over the place, and create it only for the Oracle.  But in 12 months, your business folks decide to try and sell the system to some customer, who just got to have SQL Server.  If you wrote persistence as an interface, it is a snap, otherwise, some work and re-testing af the whole thing may be involved.
 
Sounds funny, but this is a real-life example.
 
Greg
-----Original Message-----
From: James Stauffer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 7:54 AM
To: JDJList
Subject: [jdjlist] interface for only 1 class

Is it good to have an interface if there will only be one class to implement it in the foreseeable future? Does it add unnecessary complexity? It usually isn't much more complex but does that extra complexity add extra value? Agile programming seems to say "don't build it because you won't need it." What do you think?

James Stauffer

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to