Press "Enter" to skip to content

Programming Improvement 10 – If something looks like it might ever be dynamic, put it in a database table

A project I’m working on had a few places where there was a short list of possible values.

When I asked if these lists would ever change, or if they were always going to be the same, I was told they’d always be the same.  So I went ahead and built the code around those lists of values never changing.

Now, a couple months later, I’ve been told several of them need to by dynamic.  The users need to be able to add new ones, change existing values, and (possibly) inactivate them.

Now I have to change several objects – and their underlying database structures – to accommodate for this.

What I should have done originally is just build the tables for these lookup values.  Then, when the requirements inevitably change, it wouldn’t be a big deal.  The other objects would be ready and the database would be ready.  All I’d need to do is add the screens to add/edit/delete/etc., and a couple of simple methods to do the inserts and updates.

Leave a Reply

Your email address will not be published. Required fields are marked *