Don’t Overcomplicate Things

A gentle reminder to myself: don’t make things more complicated than they need to be.

I’m in the process of creating a JSP tag to render a dynamic tree list, similar in intent to the JTree in Swing, but for JSPs. For one reason or another, I can’t seem to find one out there that already exists that does what I want.

In any case, having got a mocked-up HTML page with all the Javascript working, I need to turn it into a JSP. One part of what I’m going to need is data to construct the tree dynamically from. So, thinking of JTree, I start creating a TreeModel-like interface.

Then it hits me: all I want from the tree is a display value and a real value, and to be able to look up the display value from the real value. In other words, all I need is a Map. If the user (me) cares about order (yes), they can use a SortedMap or a LinkedHashMap.

This will save me a bucket of time later, especially because the data I will derive the tree list from is already a Map.

Simplicity really does help.

Leave a Reply

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

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com 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