What I've learned from Tux CMS
After two years of work on Tux CMS in total (a year and a half of “official” work), I’ve learned a lot, both about life, and about software development. That little penguin friend of mine has taught me more than I ever thought possible, and for anyone interested out there, I thought I’d share what I’ve learned with you.
Database structures are far easier to change than directory structures
To the unknowing developer, the idea of changing your database structure once it’s done is daunting, especially across versions. Keep this in mind though: it takes only half an hour to write a database update script. The pain a directory structure change can cause lasts a lifetime.
dirname(),realpath(), and the__FILE__constant can be lifesavers (or, absolute paths work best for includes)!Includes across a complex directory structure can be a pain. Don’t ever touch the include path, it gets far too messy. You know your application’s directory structure, so therefore, you can create relative paths yourself. From there,
realpath()can give you an absolute path.Ask not what you need not be told
If you can 100% reliably figure something out for yourself, don’t ask the user to tell you to save work. I am constantly shocked by the number of web applications that ask the user to confirm (or even enter—the horror!) the document root directory of the application. Figure it out for yourself, it’s not that hard.

Store only what cannot be efficiently figured out at each run
There are some things that you need to know at every run—for example, database connection information. Document root, however (for example
), can be figured out at runtime with almost no performance tax. Never store a document root, either in a config file, or your database. Your users will thank you if they ever decide to relocate their software.Centralize what you can
There’s no need to reinvent the wheel with every request. Centralize whatever necessary configuration information, functions, constants, etc. you can to increase performance. Personally, I recommend either a startup script, or a common script included on every file in your blog. In Tux CMS, I have a script that defines constants that contain my directory structure, so I can easily form paths from any script. Seeing a pattern?

Think first, do later
Both in life, and in development, things go better when you have a plan. After-thought development might work well for LEGOs, but it fails miserably with software. The more you know about how you’re going to do something, the faster it is to develop, and the better it comes out.
Markdown is an absolutely amazing tool
The syntax is simple and beautiful. It will definitely find its way into Tux CMS v0.2. ‘nuff said.
Clearly, there’s a trend in my points.
Directory structure is important, don’t ever take it for granted. Beyond that, plan out what you want to do, and have fun with it!
May 29th, 2007 at 11:21pm Well
this was a thoroughly geeky entry
June 11th, 2007 at 5:10pm Indeed it was.
Is that a problem?