Next Up: Universal look-up tables
30 June 2008I know it’s been a long time since I said that I wanted to get back to building things, and then I went right out and started playing with SQL instead, but it’s still better late than never. Today I’m thinking about those little tables of codes and values that we all end up creating over and over again for various systems. You know the ones: they feed the drop-downs and the pick lists and the raidio buttons and the pop-up data pickers and all of the other various and sundry controls, widgets, and doo-dads that we put on our screeens to qualify data as being in this category or in this state or in this group or part of this subsystem or whatever else it is that we do to qualify the data that we process. Everyone who has developed software of any level of complexity has had to come up with a list of something, whether it be months of the year or life-levels of a game character or pay cycles for employees — they are all basically the same: little lists of valid values for other columns in other tables of the database.
Basically, they are the same, but there are often little nuances of differences between one and the other. For example, a list of status codes might simply be your basic two-column look-up table: one column for the code and one column for the meaning of the code. A table of Months, on the other hand, might have a number of columns for things like the month number, the month name, the month abbreviation, and the number of days in the month. Still a simple little table, but not your basic two-column look-up table anymore. I’m looking for a solution that will handle both the basic two-column look-up table as well as those occasional needs for a few extra columns for some specialized needs.
My other requirement is that it pass the “while it’s running” test. The key here is that, if I want to define another look-up table for some new code that I now need, I want to be able to sign on to the system and do that, while it’s running. I don’t care how easy it is to do, I don’t want to have to go into my IDE and create a new version of the software, even if it can be done by just clicking on one button. I want to be able to add, change, and delete whole look-up tables on the fly in real time without ever deploying a new version of the code. I want the development and maintenance of both simple and complex look-up tables to be an operational procedure, not a software development activity.
I’m pretty sure that I can do that with two tables in the database: one containing a list of tables, and the other containing the content of those tables. We’ll also need a couple of URLs to identify the REST resources, one for the tables and one for the table entries, but we should be able to handle that with something like this:
http://<serverName>/<contextRoot>/tbl/<tableId> http://<serverName>/<contextRoot>/tbl/<tableId>/<entryId>
That’s the theory, anyway. Now all I have to do is build it!
Sorry, the comment form is closed at this time.





