Archive for the ‘Application Design’ Category.
15th May 2008, 02:08 pm
I just rolled out some new automation tools for a few projects here at work and so far I've been extremely happy.
Much to my embarrassment, development has previously been outside of source control due to the fact that we develop sites, we don't deploy packaged applications, and we don't have a cohesive IT setup (everyone sets up their desktop to their liking so maintaining consistent development environments across all computers is difficult).
However, thanks to SVN, Xinc and Phing (and DBDeploy), this has changed! Now everything is in source control and automatically deployed to our dev server upon commit. I am currently talking with Arno about perfecting svn tag monitoring to automate staging and (possibly) live deployments, so I'll post about what I did when that's finished.
The great thing about this setup is all pieces are technically interchangeable. If you don't like Xinc you can use CruiseControl. If you don't like Phing you can use Pake, or a shell script even. If you don't like DBDeploy you can roll your own setup or swap it out for your database versioning system of your choice!
However this post will cover Xinc, Phing, and DBDeploy as (a) I have experience with them and none of the others, and (b) they integrate extremely well (Xinc and Phing's primary distribution method of choice are PEAR channels).
Continue reading ‘Automating the Development Workflow’ »
1st May 2008, 04:37 am
One of my favorite features of C# is Partial Classes. For the uninitiated, it is a way of defining a class in two separate locations. Very useful when you have code generation utilities such as LINQ.
Unfortunately, PHP has no such feature (though if anyone's listening it would be a great feature to add to the PHP6 feature list), however thanks to the magic of __call($method, $args), __get($key), and __set($key, $value) overload functions as well as passing by reference (aah the good ol' &) we can imitate partial classes.
The idea behind this partial class hack is to instance a copy of the partial class in question and have our magic functions forward any undefined requests to the partial class.
The partial class (probably with the naming convention Partial_CLASSNAME) will contain a reference to the main class and also have magic functions forwarding undefined requests to the main class. The reason why we have our magic functions in the partial class is so that any internal references can still be made (methods in Partial_CLASSNAME must have access to the methods and members in CLASSNAME).
The constructor in the main class will automatically seek out the partial class (and additional coding can be done to seek out more than 1 partial class as well as do some integrity checking) so that the programmer does not have to intervene to form the 'full class'.
Continue reading ‘Partial Classes in PHP’ »
1st April 2008, 01:34 pm
I am by no means a database expert, such titles are best left to people like Peter Zaitsev and Vadim Tkachenko, however one of my co workers has been asking me for some help on how I come about my database designs, particularly issues concerning normal form.
Whlie I could spend several posts going over the intricacies of 1st, 2nd, 3rd, and 4th normal form as well as "The key, the whole key, and nothing but the key so help me Codd" Boyce-Codd normal form, however reality dictates that time spent strictly to these academic levels is either time wasted (projects with due dates unfortunately cannot spend forever on the database design) or pointless as being reasonably intelligent will bring you very close, if not within 3rd normal form.
If you're really interested, Wikipedia provides a great resource to get started learning the more academic aspects.
I'm going to assume that you have done a bit of database work and at least understand the concept of a join.
The one of the goals of database normalization is to reduce the repetition of information and thereby reduce the complexity of an update of said information. If the same string is in the database N times, we should abstract it so that if we need to update said string due to a typo or anything else, we need to only change but one location.
Continue reading ‘Database Normalization And Design: A Primer’ »
2nd February 2008, 05:03 pm
My (Our, Chris included) slides have been featured on the front page of SlideShare's website!
Small time success yes, but success none the less. Take that Ed Schipul, my slides are right next to yours! (Btw Ed, I still think your presentation you gave to refreshBCS was good, but I still disagree with your thoughts on work days and work weeks).

29th January 2008, 12:04 pm
Slowly but surely my framework is coming off the ground. I decided to adopt a singleton design pattern for my Cache, Template, and possibly any other engines I might have. Originally my design started as a factory, however it is now somewhat of a hybrid as there is a ::load() function that loads arbitrary classes into our singleton (rather than an instance of the same class like a proper singleton).
I wanted the system pluggable so the developer was not beholden to any particular engine, but I also needed to guarantee access to the Cache and Template objects to the models without having to either add to the $GLOBALS[] array or add to a controller's attribute (and call like $controller->cache->...).
So I adopted a singleton design pattern, because (a) one only needs 1 cache or template object and (b) it just looks plain nice.
Continue reading ‘Singleton-Factory Hybrids FTW’ »
26th January 2008, 10:00 am
These are the powerpoint slides from the presentation I gave at Bar Camp Texas, 2008. The slides are currently out of date, I'll publish the fixed ones later.
The slides are licensed under the Creative Commons Attribution-Share Alike 3.0 United States License.
PHP MVC Slides (Powerpoint 2007)
PHP MVC Slides (PDF)
24th January 2008, 05:55 pm
So, crazy me decided to give a talk at BarCamp Texas on MVC design in PHP.
With the prevalence of MVC frameworks becoming more and more ubiquitous in PHP development (CakePHP, Symfony, and the Zend frameworks), I wanted to make sure that (a) the non-developer types were introduced to such styles of PHP development, and (b) introduce those developers with little formal experience (very common in the PHP world) to what MVC actually is and that MVC does NOT require large expansive libraries.
I could do my presentation showing out to setup a basic application with an existing application, however I don't feel that would be beneficial. The idea is knowledge portability, and I feel a good understanding of the basics of OO design will be transferable to any other frameworks, since all the aforementioned frameworks have excellent "getting started" tutorials.
When I finalize my slides, I will post them here for people to take a look at, possibly to berate my retardedness.