> -----Original Message-----
> From: Martin Gainty [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 07, 2006 10:19 AM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: FRIDAY #1 JavaBeans/Model
> 
> Good Morning Martin-
> 
> I would say you're definitely on the right track
> and would inquire th reasons for combiinge 2 tables into one bean
> 
> If the DB is designed so that someone built table1 and for 
> some reason built table2 which is basically an extension of the 
> attributes for table1 then your bean should include both tables
> But this begs the question why split like minded attributes 
> into 2 tables when you should denormalise them both into 1
> for architectural, performance and functional reasons
> 
> If the functional characteristics of the 2 tables are not 
> related I would suggest using 2 separate beans
> 

Wow :) I am really glad you asked that! I actually came to Java
Development from a DBE background. Normalization is actually one of my
favorite topics of discussion, and I think this actually stifles my Java
development from time to time because I tend to think in terms of
'normalized db' rather than 'good OO' (I can't be the only one that does
this). This is likely one of those cases.

Anyways, the particular scenario that made me to believe this might be
necessary is a dynamic attribute setup. In this instance, let's say it's
a character in a story. All characters will have certain common
attributes (name, age, motivations, aspirations, etc.), but the author
may want the capability to define their own characteristics. Maybe the
character is an alien and has four legs and eight eyes (in a sci-fi
story of course). The character will usually be described by the main
Character table, but these 'extended attributes' will be placed in a
joined table sort of like key/value pairs. This way, if a character has
no extended attributes, no storage is wasted, and each character has the
capability of any number of attributes. 

I figured the business logic bean representing a character would have a
method 'Characteristics[] getExtendedCharacteristics().' I could just
make two beans, but this made sense to me. 

-Wes

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to