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 / April 2007

Tip: Looking for answers? Try searching our database.

A design problem

Thread view: 
novice_root - 11 Apr 2007 17:21 GMT
Hi

I am trying to make a small issue tracker to for learning JSP/
Servelets. I am trying to follow MVC architecture for the same and I
am stuck in a design issue with model classes.

Here is the scene....

There is a entity "IssueAtribute", which represents elements in a
Issue. (Basically entity "Issue" contains a Ordered List of
"IssueAttributes").

Now "IssueAttribute" can be of various types eg. TextIssueAttribute,
LongTextIssueAttribute, DateIssueAttribute, etc. The "View" in the MVC
will probably use this information to render the issue attribute. eg.
A JSP might create a Calendar widget for DateIssueType and TextArea
for LongTextIssueType etc.

So the design decision that i am struck with is how design class
hierarchy for "IssueAttribute" and its types. I considered using
inheritance for all its types as that way I can keep all
"IssueAttributes" in "Issue" as a single ArrayList but that will loose
its type information unless is do a check at runtime (using
instanceOf) which i think is in elegant.

So any idea/criticism is most welcome.

Thanks
Andrew Thompson - 11 Apr 2007 18:26 GMT
Sub:  A design problem

If multi-posting messages to usenet newsgroups
is part of the design, it is fatally flawed.
Please cross-post, in future.
<http://www.physci.org/codes/javafaq.html#xpost>

(X-post to c.l.j.p./h., w/ f-u to c.l.j.p. only)

Andrew T.
Oliver Wong - 12 Apr 2007 18:59 GMT
> Now "IssueAttribute" can be of various types eg. TextIssueAttribute,
> LongTextIssueAttribute, DateIssueAttribute, etc. The "View" in the MVC
[quoted text clipped - 8 lines]
> its type information unless is do a check at runtime (using
> instanceOf) which i think is in elegant.

   What situation are you thinking of where you need to know the type
information and thus use the instanceof operator?

   - Oliver


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.