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.

Advertisements

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 18 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 16 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

Leave a Reply

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

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 )

Google+ photo

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

Connecting to %s