@vlucas Business: http://actridge.com PHP dev since 1999 (PHP 3) I love good OOP code and concepts, but hate the complexity it brings 2 Wednesday, March 30, 2011
You are an Object-Oriented Programming Purist You don’t care how complex code is as long as it’s “correct” OOP (because some guy’s book said so) You LOVE using Zend Framework, Symfony, or FLOW3 You LOVE XML and Dependency Injection Containers You are looking for a component library 4 Wednesday, March 30, 2011
think frameworks like Zend, Symfony, or FLOW3 make some things too difficult and cumbersome You don’t think any PHP framework has it quite right You don’t like “too much magic” You want to know what your framework is doing You value ease of use over everything else You want good OOP code that follows known coding standards that is still easy to use and understand 5 Wednesday, March 30, 2011
Minimum code, maximum impact Use OOP principles and design, but don’t over-do it PHP is not Java with dollar signs Explicitness > “Magic” Easier to understand & see what is going on Design patterns should never trump user experience or get in the way Users over “correctness” 6 Wednesday, March 30, 2011
Hierarchical MVC (HMVC) Easy to understand and use Easy to make REST APIs and HTML pages No config/setup necessary, works anywhere Follow PEAR/Zend Coding Standards Strike a balance between good OOP concepts and ease of use with low learning curve 7 Wednesday, March 30, 2011
a single top-level named folder No separate “controllers”, “models” and “views” directories at same level Unlimited levels of nesting Easier distributable packages 10 Wednesday, March 30, 2011
in your app \Kernel() - only global-scope function in Alloy Multiple uses: Config access Lazy-loading Factory / Service Locator Extension Point for Modules and Plugins Sole Dependency 11 Wednesday, March 30, 2011
callbacks added at runtime via __call Enables all kinds of custom functionality Factory methods for loading & using 3rd party libs Exposing plugin methods for global use Helper or utility methods 14 Wednesday, March 30, 2011
fulfill a single request Solves the “widget problem” Sidebar content can be self-contained module Ads, tag clouds, blog headlines, etc. Encourages module re-use & helps DRY Not strictly “hierarchical” - more like nested Hierarchy is not tracked or enforced in any way 20 Wednesday, March 30, 2011
that handles requests Special name “scope” for web-accessible actions GET = <action>Action POST, PUT, DELETE, etc = <action>Method Ensures HTTP methods are required for access Alloy\Request object is first parameter All named params from route set on Request object 24 Wednesday, March 30, 2011
implicitly loaded No views, models, or anything else Explicitly return response or content to send Controllers are not factories Controllers are extremely lightweight Controllers do not hold the context of their requests 25 Wednesday, March 30, 2011
Base Alloy\Module\Response that view templates and resources extend from Can set custom layout, errors, headers, etc. using a fluent interface just like templates and resources 32 Wednesday, March 30, 2011
template from ‘newAction’ No forwarding or other indirection necessary Object return lets you modify it further before display through fluent interface 35 Wednesday, March 30, 2011
returned is not yet rendered so we can modify it at will Change path to a local template Change layout Add errors Change response code or headers, etc. Very flexible 36 Wednesday, March 30, 2011
the template is not yet rendered, we can even pull out values that have been set and re-use them however we want to We don’t even have to render the dispatch result at all No wasted resources 37 Wednesday, March 30, 2011
to Module::action No PREG matching overhead Path can include slashes and be as long as necessary Router does not split URL into segments 42 Wednesday, March 30, 2011
Extensions of view templates Generic HTML template markup with custom functions that accept Closures to enable fully custom PHP markup in designated areas (like table cells) with no special syntax or recursive includes You don’t have to use them, but they can be huge time-savers if you do 48 Wednesday, March 30, 2011