Getting My Kicks With MVC

It’s taken me six months to finally wrap my mind around the Model View Controller design pattern. That may seem like a long time but, damn! Design patterns have to be one of the most confusing concepts since potty training.

I started with the Observer pattern which Colin Moock describes in his book, Essential Actionscript (http://www.oreilly.com/catalog/0596006527/index.html) and on his site (http://moock.org/lectures/introToPatterns/). Pretty basic introductory pattern after about the fifth read through.

Then I decided my Object Oriented skills lacked a fundamental something, so I bought Learning Java (http://www.oreilly.com/catalog/learnjava3/) with the hopes of acquiring some basics from a language where a lot of OOP concepts stem from. I can’t emphasize enough how valuable it is to read beginner books even when you think you know it all. Still haven’t finished this book but I got what I needed for now.

After my little refresher I bought Design Patterns (http://www.oreilly.com/catalog/hfdesignpat/index.html) and Professional PHP5 (http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764572822.html). Never did I think I could read a book with the word “professional” in the title. Didn’t finish reading either one but I pulled what I needed. I also started using phpPatterns (http://www.phppatterns.com/).

Ever so slowly things became clearer and I started having ah! ha! moments. Things like: abstraction, beans, factories, templates, and overall orthogonality started to click. I still have a ton more to understand.


Why go through all of this? Less redundant code and better separation of data and display. Allows for rapid building of pages and quicker debugging. Build up of class libraries which can be reused across projects. This is definitely a can of worms I recommend prying open.