I follow quite a few blogs of various people that make headlines and have a coding background. One person in particular that somehow made the list many moons ago that I have failed to remove is Leah Culver. I think it was her ties to the midwest and the fact that she seems to be putting her ass out there with Pownce (which has since had to close its doors).
In her latest post, she talks about writing a plugin for Django. If you are unfamiliar with django, it is a web framework written in python which loosely follows the model-view-controller design pattern (source).
Before I go on trashing the comments in the post, I’d like to note, I’m not a django developer and never have been. But I think that my overall points come back to good design and practices.
Ok, May I direct your attention to this comment made by Leah.
Let’s take the only advantage first, “can update on the fly, no server restart”. This is a web framework correct? Why the hell are you restarting!?!?! I’m clearly missing something here but for all the web apps that I have created, a restart isn’t required. A reload of my web browser is, but I’ve never had to restart my application or web server. I’m really not sure what she is referring to here exactly so I’m guessing I’m missing something major here. Maybe the application she is developing for requires an application server that needs to be restarted in which case it would make sense. But for some reason, I’m not thinking that is the case. Someone please explain this one to me in the comments.
In the disadvantages of using a DB, I have a big problem with #1, “slooooow”. If your database is slow, it is usually one of four issues:
- Bad Code/Database Design – This is usually where people screw up. Maybe they have never run an application where there are several million inserts in a day. Or maybe they’ve never seen the affects of table vs row level locking on updates. Maybe they don’t understand why their query doesn’t match any of the indexes that they have setup. The developer may not understand what an index even is! This is why developers and DBAs need to be on the same page in the database / code design. Even if you don’t have a DBA, there are plenty of web sites out there that can help you figure out how to tune your application and find slow points in your database code.
- Improper Database Tuning – This is where a skilled DBA can save your ass. If you don’t have one on staff, contract this out. There are consultants out there that are worth it. Find a good one, pay him his price and you will be amazed at what they can do. If you happen to have a development crew that is fanatical on code optimization and speed, they will probably make up for having a DBA on staff. But it never hurts even to bring a DBA in for a day or two, have him look at the DB, make some suggestions and turn it into a training session to help your developers grow.
- Database Load – Let’s face it, some databases are very large and have grown to the point where it is time to expand the design.
- Slow/Old DB Server – At a certain point, its not worth your time to spend weeks tweaking every query on a server that is 2-3 years old. Throw new hardware at it and let the improvements there increase your performance.
I don’t really have a major issue with the rest of her list, they all seem to be fairly logical. But I just didn’t understand the advantages fully and the first disadvantage, well, as you can tell it drove me up the freaking wall. If the database is slow, there is a good reason for it all of which are fixable.
Now, with all that being said, I do kind of agree with her. IF the data is not going to change, why store it in a database. Having a flat config file is not the end of the world people. Its fast, saves a query, and never changes! But that last part is pretty critical. If the data may expand which very well could in this instance, it proabably makes sense to put it in the database even though it doesn’t fully seem like it needs to go there. if you have your database design in order, you should be fine and never notice a performance hit getting this data.