Design Patterns

Discussion in 'Java' started by Christine Mayer, Sep 21, 2006.

  1. Does it make sense to use design patterns like the strategy pattern for
    jave beans (as simple data containers) too?
    Or maybe just inheritance? Or interfaces?
    Or nothing at all, as we are just speaking of plain simple getter and
    setter method classes?

    Any idea, what serves best?
    Christine Mayer, Sep 21, 2006
    #1
    1. Advertising

  2. > Does it make sense to use design patterns like the strategy pattern for
    > jave beans (as simple d for a containers) too?
    > Or maybe just inheritance? Or interfaces?
    > Or nothing at all, as we are just speaking of plain simple getter and
    > setter method classes?


    Strategy pattern targets instance behaviour, how to apply that to a java
    bean? Maybe the best is just semantically correct inheritance, interfaces
    are not useful most of the time as the beans cannot be instanciated by
    reflection anymore, you need a factory. Most frameworks just call the
    no-arg-constructor for model classes.

    Regards,

    Tobias
    Tobias Schierge, Sep 21, 2006
    #2
    1. Advertising

  3. Maybe the best is just semantically correct inheritance, interfaces
    > are not useful most of the time as the beans cannot be instanciated by
    > reflection anymore, you need a factory. Most frameworks just call the
    > no-arg-constructor for model classes.



    > What means "instanciated by reflection?"



    >Maybe the best is just semantically correct inheritance ....you need a

    factory.

    Simple inheritance, or factory?
    Anyway, for beans that are just used once, there is no need for a
    factory, imho.

    >Most frameworks just call the
    > no-arg-constructor for model classes.


    what?


    Anyway, what I also wanted to ask was, does it make any sense to make
    a simple thing such as a Java Bean - consisting of nothing more then get
    and set methods, more complicated by using inheritance, a pattern, or
    whatsoever.

    Using composition might help explaning and documentating the application,
    like Animal.fur.getColor() instead of animal.getColor() -

    but not sure if that really makes sense for getter methods.
    =?ISO-8859-1?Q?Martin_M=FCcke?=, Sep 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josh28
    Replies:
    0
    Views:
    459
    Josh28
    Nov 29, 2004
  2. Siz
    Replies:
    1
    Views:
    7,080
    Catherine Lowery
    Dec 12, 2004
  3. crichmon
    Replies:
    4
    Views:
    477
    Mabden
    Jul 7, 2004
  4. Tim Smith
    Replies:
    2
    Views:
    852
    Tim Smith
    Dec 15, 2004
  5. John
    Replies:
    0
    Views:
    592
Loading...

Share This Page