How to handle metadata for UI screens representation

Case: There are multiple graphs to be displayed, depending on a few parameters selected by user graph type, its details and other UI related stuff vary a lot, what remains common is data.
Solution 1:
Create a UI screen for each type of representation, depending on parameter supplied by the user use a particular screen will be loaded
Pros: Very simple, Client is Dubm, each screen has a datasource which gets populated by data send by the server
Cons: Lot of duplication
Solution 2:
Keep metadata, say in XML or DB, about user selection and related UI representation. With help of this metadata prepare a value object containing all information for a graph to be plotted.
Pros: Generic solution, Very flexible
Cons: More coding needed, UI is metadata driven, if UI representation changes alot, this may not be the best approach, Client and server needs to be in contract –how to parse the Metadat, this is client is not that dumb.

What I have used:
I preferred second solution fro following reason:
1. In our team, UI development and Server side development is not segregated, hence having a Smart client is not an issue.
2. Represented metadata in XML and then used JAXB to get Object representation, with help of contract, a single class at client is driving the UI
3. No duplication, all changes are limited to either or all of 1.> Metadata XML, 2.> UI class (fulfilling the contract) or 3.> UI Screen

About ChandanPandey

Try to come up with a good design as by product of good coding practices

Posted on August 31, 2010, in Design and Architecture and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: