this is not a blog

I Reckon This Must be the Place, I Reckon

Details of the architecture

Where to Start

There are many places to start a creative writing adventure (writing code is after all, or should be, an adventure) — one need not start at the beginning. But at the beginning for this little side path is a good place to start.

Start Architecture

The INDEX.PHP here is only 50 lines long but it has a specific architecture — we are working on a name, but for now call it Complete. All of the code's include files are there; the entire application loads and is initialized there; the last function call runs the site and at that point the application is in a working state and all URL data has been validated.

This Completeness means that the start process is not spread out over multiple files in multiple directories (more on that to come), and this all stems from a kind of learning disability we share: being easily confused. We never liked having to view multiple files just to "see" the basics of an application's starting process. We never liked seeing nested include files. We like code as APIs all neatly lined up in columns and rows.

We like small, complete, single file APIs, not because we are smart or anything, on the contrary, we need them to understand what we are doing.

Of course, it also helps to have code that has no globals and no classes — more on that later.

A Hint of Style

Something else of note in INDEX.PHP is a bit of a coding style we use that we call Lazy Programming, an example of which is how the included files are included:

PHP code foreach (glob('inc/*.php') as $inc)

There was at first a list of the files to be included, and every so often one would change or a new one added — and the list had to be edited each time. Ah, no. Let the code do the work. This one small thing saves time. Rename a file? Rename the file. Add a file? Add the file.

There two types of include files. Files in INC/ are complete, standalone APIs, creating and using no data. Files in MOD/ are considered "Modules", which do create data and are "the application's API".

Modules were at first included by a list too, and they were order dependent, as each one initialized itself when included, and some modules called other modules. Basically, that meant subtle dependency errors every so often as the code was updated.

Anyway, eventually a few Modules need a explicit call after loading.

PHP code foreach (glob('mod/*.php') as $inc)


These ideas of Completeness and Laziness are memes used throughout the code, and are a good introduction to this code.

The code is, though, far from finished, but it does work. There are odd things, complicated things and strange things (and occasionaly dumb things slip through).

More of the code architecture will be detailed here in the future.

  1. As soon as an image editor or whatever the program is that is required is acquired drawings will be made.