The value of knowledge
I’ve also been adding to my PHP models, enabling me to navigate database objects using simple, readable code. Take, for example, an organization’s leagues and tournaments. Since the tables are all separated (`organization`, `competition`, and `organization_competition`), writing the query logic every time would get old real fast. By adding the logic to the PHP model, I’m able to get them by simply writing $organization->competitions.
This makes the code read like a book, almost. I like to work this way, “backwards” in a sense, where I write my business logic as I would like to read it. I tend to write my blog posts and emails much like I’ve wrote reports and resumes, with drafts and proofreading. The same is done with my code. When you’re dealing with a lot of code–so far I’ve hand-written roughly 64,000 lines (admittedly, “expanded” lines)–it is imperative that return visits are comprehensible and easy to pick back up.
Once I determine how to best write the end logic, I go back and update the PHP models to add the necessary properties and methods that enable the business logic I wrote to run. Certainly, there are areas for improvement, though. I’m fairly certain that will always be the case, however.