File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes A design problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A design problem" Watch "A design problem" New topic

A design problem

ashish sharma

Joined: Apr 11, 2007
Posts: 2

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

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.

I agree. Here's the link:
subject: A design problem
It's not a secret anymore!