Design from a database perspective

The project is starting to snowball now. All the preparation and initial work helped to create the momentum that I have now. I’m really pleased with how it is coming along, but I am quickly grounded by the reality of how huge the scope has become. Naturally, I’m not coding all of my wildest ideas, but I did create a database schema that is incredibly well-thought-out, in terms of scalability and flexibility.

I had a hard time deciding on an database architecture that satisfied both my desire to be “official” and my desire to complete the project. For example, discussions with my brother lead me to research database normalization, specifically the 6th normal form, in order to address the quandary that is having NULLs in your database. On the one hand, not having NULLs eliminates potential issues, but normalizing the nullable attributes to the 6th normal form would instantly double the number of tables in the database and add a magnitude of complexity in every query that requires them. Needless to say, I decided to allow NULLs in certain situations, while making both a mental note and documentation that, when removing these attributes, I should ensure that the query restores the attribute value to a NULL state. This bothers me greatly, but I figured for the sake of future understanding and simplifying the initial development phase, I had made the right decision.

After the entire database was mapped out with all the appropriate relationships and indexes, I went proceeded to create all of the object models in PHP that represent the database objects, such as a User object, a Competition object, and an Organization object. All of this effort is preparatory effort, meaning little visible progress could be made for a few days. It was tough, but I came up with a good hierarchy of objects that utilize PHP’s magic methods, getters and setters, public and private properties, and even static methods. Just being able to use all of those terms in a sentence makes me feel great, simply because it represents how much I’ve learned and and continue to grow. This is the best software I’ve ever produced.

Once I created all of the objects, I went back and updated some of the pages I had been working on, in order to utilize the new object models appropriately. This is an ongoing process, but having all of the methods and properties make developing the pages much easier. I even created some custom objects for form fields, like text input boxes and selectable option lists, which make validation and all of my controller logic really easy to understand. From a programmer’s perspective, it reads as much like a book as I can possibly make it.