Your SlideShare is downloading. ×
0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Introducing Zend Framework 2.0
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introducing Zend Framework 2.0

50,765

Published on

Overview of Zend Framework's history, and the variety of reasons driving the rewrite for version 2.0.

Overview of Zend Framework's history, and the variety of reasons driving the rewrite for version 2.0.

Published in: Technology
3 Comments
45 Likes
Statistics
Notes
No Downloads
Views
Total Views
50,765
On Slideshare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
876
Comments
3
Likes
45
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • American Revolutionary War-era propaganda poster
  • Thanks to Fabien Potencier for coining the phrase and inspiring me with it.
  • Wand Company, Ltd. (Kymera Magic Wand)
  • Wisconsin Historical Images
  • ZF baseline performance has (mostly) declined from minor version to minor version
  • You may also specify vendor prefixes, using the “prefixes” key. This allows you to use code written for ZF1 natively in ZF2.
  • MVC: includes Zend_Form, and potentially addition of alternate view engines.
    I18n/L10n is to use native PHP 5.3 facilities as much as possible, as well as to optimize for performance.
    Testing focuses on better suite strategies and asset organization, as well as better strategies for temporary file generation.
    Documentation we covered earlier
    Packaging focusses on automating per-component PEAR package generation for distribution via a PEAR channel
    Migration tools addresses the story of migrating from ZF1 to ZF2
  • Transcript

    • 1. 3 November 2010 Matthew Weier O'Phinney Project Lead Ralph Schindler Software Engineer IntroducingIntroducing Zend Framework 2.0Zend Framework 2.0
    • 2. 2 Some History Summer 2005: Coding begins on Zend Framework, with a  handful of cherry­picked partners.
    • 3. 3 Some History Fall 2005: First annual ZendCon Andi and Zeev announce the PHP Community  Process, which includes involvement in the  Eclipse Foundation, a relaunch of Zend's  Developer Zone, and Zend Framework.
    • 4. 4 Some History March 2006: Zend Framework 0.1.0 released Project opened up to the public for  contributions; contributions require a  Contributor License Agreement.
    • 5. 5 Some History July 2007: Zend Framework 1.0.0 released Project includes MVC stack, Table and Row  Data Gateways, loads of Service APIs,  Authentication and Authorization layers, service  providers, and more. Still largely deemed a work in progress. 
    • 6. 6 Some History March 2008: Zend Framework 1.5.0 released Includes Zend_Form and Zend_Layout, and  many Zend_View enhancements. 
    • 7. 7 Some History September 2008: Zend Framework 1.6.0 released Includes Dojo Toolkit integration, functional test  utilities.
    • 8. 8 Some History November 2008: Zend Framework 1.7.0 released Includes AMF support, performance  improvements.
    • 9. 9 Some History April 2009: Zend Framework 1.8.0 released Includes Zend_Application, Zend_Tool. First release widely seen as providing a full  stack.
    • 10. 10 Some History July 2009: Zend Framework 1.9.0 released Includes reworked feed component,  Zend_Feed_Reader, and tons of community­ driven enhancements.
    • 11. 11 Some History October 2009: First monthly community bug hunts launched.
    • 12. 12 Some History January 2010: Zend Framework 1.10.0 released Includes Zend_Feed_Writer, re­organized  documentation, and community­driven  improvements.
    • 13. 13 Some History February 2010: Development on Zend Framework 2.0 begins
    • 14. 14 Some History June 2010: Formation of the Community Review Team
    • 15. 15 Some History November 2010: Zend Framework 1.11.0 released Includes mobile support and  SimpleCloud API.
    • 16. 16 Some History The future?
    • 17. Revolution?Revolution?
    • 18. Evolution.Evolution.
    • 19. 19 Incremental Improvements Autoload only (strip require_once calls) Conversion to PHP namespaces  Refactor and standardize exceptions usage Refactor and consistently implement a  single plugin loading strategy Refactor to use PHP 5.3­specific paradigms  where they fit
    • 20. Rewrite only Rewrite only  where it makes where it makes  sensesense
    • 21. 21 Zend_Db Difficult to get the underlying connection  and share it between instances or different  classes. Difficult to get schema metadata in a consistent fashion. Difficult to extend. Difficult to add pre/post tasks.
    • 22. 22 Zend_Session Black­box design != testable Namespace storage incompatible with  $_SESSION  Many incompatibilities with ext/session
    • 23. 23 use ZendSessionSessionManager, ZendSessionContainer as SessionContainer; $manager = new SessionManager(array( 'class' => 'MyCustomSessionConfiguration', 'storage' => 'MyCustomSessionStorage', )); $container = new SessionContainer('Foo', $manager); $container['somekey'] = 'somevalue'; $container->setExpirationHops(2); use ZendSessionSessionManager, ZendSessionContainer as SessionContainer; $manager = new SessionManager(array( 'class' => 'MyCustomSessionConfiguration', 'storage' => 'MyCustomSessionStorage', )); $container = new SessionContainer('Foo', $manager); $container['somekey'] = 'somevalue'; $container->setExpirationHops(2);
    • 24. 24 Filters and Validators Static access and chain usage were mixed  in the same object Did not use common plugin loading  methodology Paradigms required in Filter_Input and  Form were not supported
    • 25. 25 namespace ZendValidator; if (StaticValidator::execute($value, 'int')) { // passed validation } $chain = new ValidatorChain(); $chain->addValidator(new Int(), true) ->addValidator(new GreaterThan(10)); if ($chain->isValid($value)) { // passed validation } namespace ZendValidator; if (StaticValidator::execute($value, 'int')) { // passed validation } $chain = new ValidatorChain(); $chain->addValidator(new Int(), true) ->addValidator(new GreaterThan(10)); if ($chain->isValid($value)) { // passed validation }
    • 26. AddAdd features favoring features favoring  extensibilityextensibility
    • 27. 27 Examples SignalSlot FilterChain SPL extensions (SplStack, SplQueue) PluginBroker
    • 28. Favor the ExplicitFavor the Explicit Okay, not Okay, not thatthat kind of explicit kind of explicit……
    • 29. Magic is Magic is  sometimessometimes too arcanetoo arcane
    • 30. 30 echo $this->headLink()->appendStylesheet('foo.css'); /** * Hits Zend_View::__call() * Calls Zend_View::getHelper() * Calls Zend_View::_getPlugin() * Calls Zend_Loader_PluginLoader::load() * Calls Zend_Loader::isReadable() * Calls call_user_func (hits autoloader...) * which calls Zend_Loader::loadClass * which calls Zend_Loader::loadFile * which calls include_once * Instantiates helper * Calls method on helper via call_user_func_array() * Returns helper instance * Call method on instance (hits __call...)) */ echo $this->headLink()->appendStylesheet('foo.css'); /** * Hits Zend_View::__call() * Calls Zend_View::getHelper() * Calls Zend_View::_getPlugin() * Calls Zend_Loader_PluginLoader::load() * Calls Zend_Loader::isReadable() * Calls call_user_func (hits autoloader...) * which calls Zend_Loader::loadClass * which calls Zend_Loader::loadFile * which calls include_once * Instantiates helper * Calls method on helper via call_user_func_array() * Returns helper instance * Call method on instance (hits __call...)) */
    • 31. (hidden) automation (hidden) automation  makes learning hardmakes learning hard
    • 32. 32 class FooController extends Zend_Controller_Action { public function someAction() { $this->view->foo = 'bar'; } } class FooController extends Zend_Controller_Action { public function someAction() { $this->view->foo = 'bar'; } } Where is  this defined? When is  it rendered? What about layouts?
    • 33. Explicit code isExplicit code is…… easier to easier to  understandunderstand $this->broker('head_link') ->appendStylesheet('foo.css'); /** * Hits PhpRenderer::broker() * Calls HelperBroker::load() * Calls HelperLoader::load() * Hits autoloader * which simply does an include_once * Instantiates helper * Calls method on helper $this->broker('head_link') ->appendStylesheet('foo.css'); /** * Hits PhpRenderer::broker() * Calls HelperBroker::load() * Calls HelperLoader::load() * Hits autoloader * which simply does an include_once * Instantiates helper * Calls method on helper
    • 34. Explicit code isExplicit code is…… easier toeasier to profileprofile
    • 35. Explicit code isExplicit code is…… easier toeasier to maintainmaintain
    • 36. Optimize for Optimize for  performanceperformance
    • 37. 37
    • 38. 38 Profiling Profile to determine  where the pain  points are Look for big gains  primarily Fix them
    • 39. 39 Autoloading: Problems Class Maps are fastest But they require maintenance Using the include_path is slow Not using it requires maintenance Using the include_path is most flexible But slower than alternatives
    • 40. 40 Autoloading: Solutions Ship a ClassMapAutoloader by default Class maps for full ZF library, and per­component Tools for generating class maps Ultimate in performance StandardAutoloader requires  namespace/path pairs Flexibility and performance during development StandardAutoloader can act as a fallback  autoloader Flexibility at the cost of performance
    • 41. 41 // .classmap.php return array( 'FooSomeController' => __DIR__ . '/foo/controllers/SomeController.php', 'FooModelBar' => __DIR__ . '/foo/models/Bar.php', ); // ClassMapAutoloader require_once 'Zend/Loader/ClassMapAutoloader.php'; $loader = new ZendLoaderClassMapAutoloader( './.classmap.php'); $loader->register(); $bar = new FooModelBar(); // .classmap.php return array( 'FooSomeController' => __DIR__ . '/foo/controllers/SomeController.php', 'FooModelBar' => __DIR__ . '/foo/models/Bar.php', ); // ClassMapAutoloader require_once 'Zend/Loader/ClassMapAutoloader.php'; $loader = new ZendLoaderClassMapAutoloader( './.classmap.php'); $loader->register(); $bar = new FooModelBar();
    • 42. 42 // StandardAutoloader require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new ZendLoaderStandardAutoloader(array( 'namespaces' => array( 'Foo' => __DIR__ . '/library/Foo'), )); $loader->register(); $bar = new FooModelBar(); // StandardAutoloader require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new ZendLoaderStandardAutoloader(array( 'namespaces' => array( 'Foo' => __DIR__ . '/library/Foo'), )); $loader->register(); $bar = new FooModelBar();
    • 43. 43 Plugin Loading: Problems Path stack­based autoloading is sloooow Prefix paths are hard to grasp Particularly when coupled with stacks Overriding the paths without propagating  paths is hard Case sensitivity becomes an issue
    • 44. 44 Plugin Loading: Problems Current solution only solves the class  loading aspect of plugin loading Instantiation happens differently per  component Persistence happens differently per  component
    • 45. 45 Plugin Loading: Solutions Class alias based maps by default Loaders are coupled with brokers Handle instantiation, including arguments Act as registry Allows attaching single broker to many  objects
    • 46. 46 /* class loader */ namespace MyComponent; use ZendLoaderPluginClassLoader, ZendLoaderPluginBroker; class ComponentLoader extends PluginClassLoader { protected $plugins = array( 'foo' => 'MyComponentFoo', 'foo_bar' => 'MyComponentFooBar', ); } /* class loader */ namespace MyComponent; use ZendLoaderPluginClassLoader, ZendLoaderPluginBroker; class ComponentLoader extends PluginClassLoader { protected $plugins = array( 'foo' => 'MyComponentFoo', 'foo_bar' => 'MyComponentFooBar', ); }
    • 47. 47 /* class broker */ namespace MyComponent; use ZendLoaderPluginClassLoader, ZendLoaderPluginBroker; class ComponentBroker extends PluginBroker { protected $defaultClassLoader = 'MyComponentPluginClassLoader'; protected function validatePlugin($plugin) { if (!$plugin instanceof Adapter) { throw new ExceptionRuntimeException(); } /* class broker */ namespace MyComponent; use ZendLoaderPluginClassLoader, ZendLoaderPluginBroker; class ComponentBroker extends PluginBroker { protected $defaultClassLoader = 'MyComponentPluginClassLoader'; protected function validatePlugin($plugin) { if (!$plugin instanceof Adapter) { throw new ExceptionRuntimeException(); }
    • 48. 48 /* factory */ namespace MyComponent; class Factory { /* Not shown: setBroker() and broker() methods */ public function get($adapter, array $options) { return $this->broker() ->load($adapter, $options); } } /* factory */ namespace MyComponent; class Factory { /* Not shown: setBroker() and broker() methods */ public function get($adapter, array $options) { return $this->broker() ->load($adapter, $options); } }
    • 49. Ease the learning curveEase the learning curve
    • 50. 50 Common Documentation Complaints Options are (often) not documented. Available functionality (typically, methods) is  not presented. Inconsistent structure between  documentation of different components. Examples do not show common use cases,  only using the component individually. No examples showing complete application  development.
    • 51. 51 Common Learning Problems Magic (“__” methods) is hard to learn  (just ask Harry Potter). Uncertainty where and when to extend or  implement extension points – and how to  get ZF to use them. Some patterns are non­obvious in usage  (Zend_Form decorators…).
    • 52. 52 Proposed Solutions Coding: Refactor where usage patterns differ  from design Reduce number of magic calls Refactor for consistency Refactor unclear APIs
    • 53. 53 Proposed Solutions Documentation Standards: Introduction Quick Start Options Methods Examples
    • 54. The RoadmapThe Roadmap
    • 55. 55 Completed Milestones Migration to Git for ZF2 development Stripping of require_once calls Migration to PHP 5.3 namespaces Including SPL additions, Session rewrite, and  addition of SignalSlot Autoloading and plugin loading/brokering Including View rewrite Exceptions In fact, we've just released a new  development milestone snapshot!
    • 56. 56 Completed Milestones Zend Framework 2.0.0dev2: http://bit.ly/zf2dev2
    • 57. 57 Remaining Milestones MVC Refactoring/Rewrite Internationalization and Localization Testing Documentation Packaging Migration tools
    • 58. How How  YOU YOU  can can  helphelp
    • 59. 59 Contribute to ZF2! ZF2 wiki: http://bit.ly/zf2wiki zf­contributors mailing list: zf­contributors­subscribe@lists.zend.com IRC:  #zftalk.dev on Freenode
    • 60. 60 ZF2 Git Git guide:  http://bit.ly/zf2gitguide GitHub:  http://github.com/zendframework/zf2 Official repo:  git://git.zendframework.com/zf.git http://git.zendframework.com/ You still need to sign a CLA!
    • 61. Thank you!Thank you! http://framework.zend.comhttp://framework.zend.com Feedback: http:://joind.in/2287Feedback: http:://joind.in/2287 Twitter:Twitter: weierophinney, weierophinney,  ralphschindlerralphschindler

    ×