Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Design Patterns

Reply
Thread Tools

Design Patterns

 
 
Christine Mayer
Guest
Posts: n/a
 
      09-21-2006
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?

 
Reply With Quote
 
 
 
 
Tobias Schierge
Guest
Posts: n/a
 
      09-21-2006
> 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
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Martin_M=FCcke?=
Guest
Posts: n/a
 
      09-22-2006

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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anybody here read Design Patterns Explained: A New Perspective on Object-Oriented Design John Java 0 06-01-2007 02:45 PM
Design Pattern Relationship Diagram - Design Patterns - Gang of Four Tim Smith C++ 2 12-15-2004 05:22 PM
ebook on Software Design Patterns (C#.NET) Siz ASP .Net 1 12-12-2004 09:32 PM
New open source software to use Design Patterns Josh28 ASP .Net 0 11-29-2004 10:54 AM
where to find good patterns and sources of patterns (was Re: singletons) crichmon C++ 4 07-07-2004 10:02 PM



Advertisments