Results 1 to 3 of 3

Thread: Interfaces

  1. #1
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default Interfaces

    I'm reading about Interfaces.

    By any chance does anyone have any document which maps class types (in terms of business real world objects) to interfaces that are commonly implemented?

    For example, it makes sense that classes that store dictionary-type objects (e.g. Encyclopedia, ShoppingList) implement comparable.

  2. #2
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    how about animal as the interface and dog and cat and fish are classes that implement animal.
    My IP address is 127.0.0.1

  3. #3
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    7

    Default

    I would actually see the "animal" concept as an abstract class with "dog" as a concrete implementation. I would also make whatever "functionality" "animal" has to implement part of some interface:
    Java Code:
    public abstract class Animal implements Eater, Walker, etc...
    {
        ...
    }
    In my opinion interfaces should be used to define collections of related method signatures that together define a functionality.
    Classes should be used to define actual "actors". And the "actors" present "functionalities" by implementing interfaces.
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

Similar Threads

  1. interfaces..
    By sireesha in forum New To Java
    Replies: 5
    Last Post: 01-16-2008, 05:52 PM
  2. Implementing more than one interfaces
    By eva in forum New To Java
    Replies: 2
    Last Post: 12-24-2007, 09:50 AM
  3. Interfaces
    By Kavana Krishnappa in forum New To Java
    Replies: 7
    Last Post: 12-11-2007, 04:28 PM
  4. Interfaces
    By imran_khan in forum New To Java
    Replies: 5
    Last Post: 07-30-2007, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •