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.
- Essential Actionscript (http://www.oreilly.com/catalog/0596006527/index.html) - last third of book
- Learning Java (http://www.oreilly.com/catalog/learnjava3/) - first few chapters
- Design Patterns (http://www.oreilly.com/catalog/hfdesignpat/index.html) - first few chapters
- Programming PHP (http://www.oreilly.com/catalog/progphp/index.html) - refresher reference
- Professional PHP5 (http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764572822.html) - first half of book
- Pragmatic Programmer (http://www.pragmaticprogrammer.com/ppbook/index.shtml) - collection of essays
- phpPatterns (http://www.phppatterns.com/) - code examples
- Intro to Design Patterns (http://moock.org/lectures/introToPatterns/) - Moock Lecture
- MVC In Actionscript (http://moock.org/lectures/mvc/) - Moock Lecture
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.