Let the code work for you.

The past two/three days (work days), I have been plagued with the task of working on a complex portion of a project. The piece I am working on, I did not start, but I did write the foundation of it for 5 other projects and its’ success and easy maintenance was largely due to how I designed it.

To keep a long story short, the architecture I used was not followed in this piece and now I am paying the price for something I didn’t do. The original code was developed so the code would do 50-70% of the work for me dynamically. Yes, this has performance cost implications but they were minimal (1-2 seconds at best), but the time it saves is nearly 60-75% of development time.

Now the particular piece I am referring to does a lot of output work. It takes the data inputted by the user and develops a results page to the user describing the information the user typed. Now, to make my life easier, I build a hash table of the user’s values and associate them with a code. The code is related to a table that defines the text to display regarding that entry.

By creating code to associate the hash table data with the database table, the results page can be generated dynamically saving me the countless time of programming each possibility the user can come up with.

Thus, sometimes it is smarter to go a dynamic route at the cost of performance, than it is to develop the most efficient masterpiece you can imagine.

That is my food for thought.

1 comment so far ↓

#1 Pelagia on 10.28.08 at 8:26 am

Good post.

Leave a Comment