Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XP] accessors and Java interfaces

Expand Messages
  • azami@speakeasy.net
    ... interface that ... Data supplier: read-only interface. Users don t care from whence the data comes, just how to get it. Implementations would also offer
    Message 1 of 7 , Mar 30, 2001
      --- In extremeprogramming@y..., David Rosenstrauch <darose@o...>
      wrote:
      > Still seems weird, though. What's the point of providing an
      interface that
      > only specifies implementation-specific details, and no high-level
      > behavior? Why not just use a class? You can't really vary the
      > implementation of an interface like that very much.

      Data supplier: read-only interface. Users don't care from whence the
      data comes, just how to get it. Implementations would also offer
      write access (either in the constructor for an immutable object or in
      mutators for a mutable object).

      Example: Listbox display code needs to know how to get data from the
      list model, but not generally how to set it. Describe the model as a
      read-only interface. The "core" code instantiates an implementation
      that allows adding/removing items, and provides the read-only
      interface to the UI. Since the core knows what the model really is
      (its concrete type), it can add and remove items at will. Since the
      UI only knows its interface, it can't. This makes the jealous core
      code happy and secure knowing everyone can look but no one can touch.
      :-)

      -Matthew
      azami@...
    Your message has been successfully submitted and would be delivered to recipients shortly.