Well, aside from documenting your code, as we all know is a sure sign of failure, the practice of doing really bizarre things in an effort to save CPU and disk cycles.. Observe a bit of internal notes for my currently-in-progress project (This one’s in PHP, so don’t sneer too loudly; you might hurt my feelings):
// QUICK SYNOPSIS:
//————————-
// RAM: $gl[‘data’][$localid][$var]
// DB: schema->table->myid (pri index)->var
// CONFUSING PARTS:
//————————-
// ‘myid’ is a struct in the database that is an ‘auto increment’ field for the entry.
// ‘localid’ is the ID assigned to the array at the time of loading into memory.
// The whole system is based around the concept of the dynamic ‘localid’,
// except when editing or removing entries, as it will have to talk directly to
// the database, unless placed into the queue for later removal; in this
// case, it will be written into the ‘later’ queue, and processed at the time specified.
// All subroutines may be called with either data for ‘localid’, or the ‘myid’
// system; myid variables are implictly passed, where ‘localid’ are indrect
// references, except in the case of reusable functions, such as imported
// functions DB, HTTP, encryption, display, which don’t need access to
// this information in the first place!
// INTERESTING PARTS:
//————————-
// $gl – Global Variable Array
// $var – Local Variables Array
// $db – All DB related variables here; NEVER expose!
//————————-
// $gl[‘data’] contains the database as read into memory.
// $gl[‘count’] contains the count of how many records are in the database.
// SPECIAL NOTES (OR BUGS):
//————————-
// Uses the new OOP version of my DB shim, which I’ve only rewritten for
// mysqli() and mysql() support; sqlite and postgres have not
// been re-implemented, yet, so don’t try to use them; it will fail.
// Admin interface is raw; has caused outbreak of giardia; do not eat.
If you’ve read thus far, here’s some fun things: It has a fully internal captcha system that only requires libgd w/ jpeg support; uses it’s own dictionary and encryption methods (which are self referencing and 7 bit compatible for bridging over any protocol you might want (XML, XML-RPC, HTTP, uh.. carrier pigeon?), despite any state of initial data), has a non-AJAX/BUZZWORD self-referential link system where it can (will) do many things within a single process (sorry, I still require you to click a submit button; it’s just my way), and contains it’s own socket code and HTTP/1.1 compliant POST/GET retrieval system for use explicitly with url fopen purposely disabled. (However, there’s not much I can do if you don’t have the ability to create, or connect to a socket.)
Oh, yeah, the whole project is under 30k right now, including the abstraction layers – BUT, I’m currently rewriting the admin interface. After prototyping, I decided I needed something better.
I think it’s waaay past time for bed.