Programming to interfaces with beans?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • l-EE

    Programming to interfaces with beans?

    If I'm writting a bean - and I mean just a plain old Java Bean not an EJB or
    anything like that - is there any merit to seperating the interface out of
    the class? I do this with pretty much every other kind of class I write but
    Beans...


  • Edward Diener

    #2
    Re: Programming to interfaces with beans?

    l-EE wrote:
    If I'm writting a bean - and I mean just a plain old Java Bean not an EJB or
    anything like that - is there any merit to seperating the interface out of
    the class? I do this with pretty much every other kind of class I write but
    Beans...
    Just like any class, if you separate out the interface you can have
    other developers implement the interface in order to extend your
    JavaBean ideas. Of course you might also want to provide an empty
    implementation of the interface as a convenience class of those who just
    want to extend the interface with just a subset of changes from the default.

    Another advantage of separating out an interface, as a common idea, is
    that you can have collections of the interface quite easily, and this
    sort of collection will extend to other developers building JavaBeans
    from your interface.

    Comment

    Working...