Saturday, October 14, 2006

Coding now for future functionality

I have a major challenge in my current non-day-job project in that it needs to go live quite soon, but I need the ability to very easily add functionality to each aspect of it. The following practices make it infinitely easier to do this:

3NF
The Rails1 library defaults to using database schemas (schemata? whatever) following the 3rd normal form quite strictly, and does so for very good reasons. Relationships can easily get added or removed without affecting the stored data. Updating data in one table does not affect any other table's data. This means that I can easily add on new ways to use existing data without impacting the original data or the code that manages it.
Modular Design
The fewer files touched by an upgrade, the better. When fixing bugs, of course, some files have to get patched. But when adding functionality, existing files shouldn't have to change. A live site can have thousands, if not millions, of live users and needs to keep downtime to an absolute minimum. Additional functionality should come at the flick of a switch, rather than the replacement of dozens of files getting hit several times each second. Central controllers help (me, at least) immensely in following modular design.
Laziness Kills
At least when it comes to performance. When writing a web app, performance starts dragging when you cut corners and then add more functionality to a single hit. It inevitably happens, but when you keep it to a minimum, you can at least keep it under control. Instead of relying on low-performance functions to achieve something (PHP's include_once and preg_match, I mean you), you can create high-performance alternative calls without even doing much work. Sure, sometimes you actually need to use the functions as written, but 90% of the time I've seen low-performance calls (those two functions especially), an alternate could have replaced it with a trivial amount of work.

1I do not use Rails, but it provides a very good, very prominent example of 3NF enforced in a framework.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home