Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Design Patterns

Thread view: 
Christine Mayer - 21 Sep 2006 14:34 GMT
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?
Tobias Schierge - 21 Sep 2006 19:14 GMT
> 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
Martin Mücke - 22 Sep 2006 06:08 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.