On 8/10/05, Dave Newton <[EMAIL PROTECTED]> wrote: > Laurie Harper wrote: > > > As a more general example, consider if you wrote all your code to use > > ArrayList and later found, after profiling, that you needed to switch > > to LinkedList for performance reasons. You'd have to update all your > > code -- including all the clients of all the methods that accepted or > > returned an ArrayList. > > > > Conversely, if you coded to the List interface, you would only need to > > change the implementation code. All the client code would be > > unaffected. That's Dave's point about being able to switch X for Y > > with minimal impact. > > That was a much better example than mine :) I could have typed so much less!
Or even shorter: for polymorphic usage of similar but different classes ;-) Problem with interfaces is they they are fixed. Once you define an interface, you have to follow it. Say, you defined (er... I defined ;) ) an CRUD interface and forgot to define crudReset() method. Now even if crudReset() method is defined in implementing class, it cannot be polimorphically used for every class implementing CRUD interface. Bummer. Interfaces should be designed with much greated attention than regular class hierarchies. If inteface is extended, then classes using it has to switch to new interface explicitly. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]