Introducing Zend Framework 2.0
Some History <ul><li>Summer 2005: </li><ul><li>Coding begins on Zend Framework, with a handful of cherry-picked partners. ...
Some History <ul><li>Fall 2005: </li><ul><li>First annual  ZendCon
Andi and Zeev announce the PHP Community Process, which includes involvement in the Eclipse Foundation, a relaunch of Zend...
Some History <ul><li>March 2006: </li><ul><li>Zend Framework  0.1.0  released
Project opened up to the public for contributions; contributions require a Contributor License Agreement. </li></ul></ul>
Some History <ul><li>July 2007: </li><ul><li>Zend Framework  1.0.0  released
Project includes MVC stack, Table and Row Data Gateways, loads of Service APIs, Authentication and Authorization layers, s...
Still largely deemed a work in progress.  </li></ul></ul>
Some History <ul><li>March 2008: </li><ul><li>Zend Framework  1.5.0  released
Includes Zend_Form and Zend_Layout, and many Zend_View enhancements.  </li></ul></ul>
Some History <ul><li>September 2008: </li><ul><li>Zend Framework  1.6.0  released
Includes Dojo Toolkit integration, functional test utilities. </li></ul></ul>
Some History <ul><li>November 2008: </li><ul><li>Zend Framework  1.7.0  released
Includes AMF support, performance improvements. </li></ul></ul>
Some History <ul><li>April 2009: </li><ul><li>Zend Framework  1.8.0  released
Includes Zend_Application, Zend_Tool.
First release widely seen as providing a full stack. </li></ul></ul>
Some History <ul><li>July 2009: </li><ul><li>Zend Framework  1.9.0  released
Includes reworked feed component, Zend_Feed_Reader, and tons of community-driven enhancements. </li></ul></ul>
Some History <ul><li>October 2009: </li><ul><li>First monthly community bug hunts launched. </li></ul></ul>
Some History <ul><li>January 2010: </li><ul><li>Zend Framework  1.10.0  released
Includes Zend_Feed_Writer, re-organized documentation, and community-driven improvements. </li></ul></ul>
Some History <ul><li>February 2010: </li><ul><li>Development on Zend Framework  2.0  begins </li></ul></ul>
Some History <ul><li>June 2010: </li><ul><li>Formation of the Community Review Team </li></ul></ul>
Some History <ul><li>November 2010: </li><ul><li>Zend Framework  1.11.0  released
Includes  mobile  support and  SimpleCloud  API. </li></ul></ul>
Some History <ul><li>The future? </li></ul>
Revolution?
Evolution.
Incremental Improvements <ul><li>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 </li></ul>
Rewrite only where it makes sense
Zend_Db <ul><li>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. </li></ul>
Zend_Session <ul><li>Black-box design != testable
Namespace storage incompatible with  $_SESSION
Many incompatibilities with  ext/session </li></ul>
use   ZendSessionSessionManager , ZendSessionContainer   as   SessionContainer ; $manager   =   new   SessionManager ( arr...
Filters and Validators <ul><li>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 </li></ul>
namespace   ZendValidator ; if   ( StaticValidator :: execute ( $value ,   'int' )) { // passed validation } $chain   =   ...
Add features favoring extensibility
Examples <ul><li>SignalSlot
FilterChain
SPL extensions (SplStack, SplQueue)
PluginBroker </li></ul>
Favor the Explicit Okay, not  that  kind of explicit …
Magic is sometimes too arcane
echo   $this -> headLink ()-> appendStylesheet ( 'foo.css' ); /** * Hits Zend_View::__call() *  Calls Zend_View::getHelper...
(hidden) automation makes learning hard
class   FooController     extends   Zend_Controller_Action { public function   someAction () { $this -> view -> foo   =   ...
Explicit code is … easier to  understand $this -> broker ( 'head_link' )   -> appendStylesheet ( 'foo.css' ); /** * Hits P...
Explicit code is … easier to profile
Explicit code is … easier to maintain
Upcoming SlideShare
Loading in...5
×

zend

1,119

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,119
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
65
Comments
0
Likes
0
Embeds 0
No embeds

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
  • zend

    1. 1. Introducing Zend Framework 2.0
    2. 2. Some History <ul><li>Summer 2005: </li><ul><li>Coding begins on Zend Framework, with a handful of cherry-picked partners. </li></ul></ul>
    3. 3. Some History <ul><li>Fall 2005: </li><ul><li>First annual ZendCon
    4. 4. 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. </li></ul></ul>
    5. 5. Some History <ul><li>March 2006: </li><ul><li>Zend Framework 0.1.0 released
    6. 6. Project opened up to the public for contributions; contributions require a Contributor License Agreement. </li></ul></ul>
    7. 7. Some History <ul><li>July 2007: </li><ul><li>Zend Framework 1.0.0 released
    8. 8. Project includes MVC stack, Table and Row Data Gateways, loads of Service APIs, Authentication and Authorization layers, service providers, and more.
    9. 9. Still largely deemed a work in progress. </li></ul></ul>
    10. 10. Some History <ul><li>March 2008: </li><ul><li>Zend Framework 1.5.0 released
    11. 11. Includes Zend_Form and Zend_Layout, and many Zend_View enhancements. </li></ul></ul>
    12. 12. Some History <ul><li>September 2008: </li><ul><li>Zend Framework 1.6.0 released
    13. 13. Includes Dojo Toolkit integration, functional test utilities. </li></ul></ul>
    14. 14. Some History <ul><li>November 2008: </li><ul><li>Zend Framework 1.7.0 released
    15. 15. Includes AMF support, performance improvements. </li></ul></ul>
    16. 16. Some History <ul><li>April 2009: </li><ul><li>Zend Framework 1.8.0 released
    17. 17. Includes Zend_Application, Zend_Tool.
    18. 18. First release widely seen as providing a full stack. </li></ul></ul>
    19. 19. Some History <ul><li>July 2009: </li><ul><li>Zend Framework 1.9.0 released
    20. 20. Includes reworked feed component, Zend_Feed_Reader, and tons of community-driven enhancements. </li></ul></ul>
    21. 21. Some History <ul><li>October 2009: </li><ul><li>First monthly community bug hunts launched. </li></ul></ul>
    22. 22. Some History <ul><li>January 2010: </li><ul><li>Zend Framework 1.10.0 released
    23. 23. Includes Zend_Feed_Writer, re-organized documentation, and community-driven improvements. </li></ul></ul>
    24. 24. Some History <ul><li>February 2010: </li><ul><li>Development on Zend Framework 2.0 begins </li></ul></ul>
    25. 25. Some History <ul><li>June 2010: </li><ul><li>Formation of the Community Review Team </li></ul></ul>
    26. 26. Some History <ul><li>November 2010: </li><ul><li>Zend Framework 1.11.0 released
    27. 27. Includes mobile support and SimpleCloud API. </li></ul></ul>
    28. 28. Some History <ul><li>The future? </li></ul>
    29. 29. Revolution?
    30. 30. Evolution.
    31. 31. Incremental Improvements <ul><li>Autoload only (strip require_once calls)
    32. 32. Conversion to PHP namespaces
    33. 33. Refactor and standardize exceptions usage
    34. 34. Refactor and consistently implement a single plugin loading strategy
    35. 35. Refactor to use PHP 5.3-specific paradigms where they fit </li></ul>
    36. 36. Rewrite only where it makes sense
    37. 37. Zend_Db <ul><li>Difficult to get the underlying connection and share it between instances or different classes.
    38. 38. Difficult to get schema metadata in a consistent fashion.
    39. 39. Difficult to extend.
    40. 40. Difficult to add pre/post tasks. </li></ul>
    41. 41. Zend_Session <ul><li>Black-box design != testable
    42. 42. Namespace storage incompatible with $_SESSION
    43. 43. Many incompatibilities with ext/session </li></ul>
    44. 44. use ZendSessionSessionManager , ZendSessionContainer as SessionContainer ; $manager = new SessionManager ( array ( 'class' => 'MyCustomSessionConfiguration' , 'storage' => 'MyCustomSessionStorage' , )); $container = new SessionContainer ( 'Foo' , $manager ); $container [ 'somekey' ] = 'somevalue' ; $container -> setExpirationHops ( 2 );
    45. 45. Filters and Validators <ul><li>Static access and chain usage were mixed in the same object
    46. 46. Did not use common plugin loading methodology
    47. 47. Paradigms required in Filter_Input and Form were not supported </li></ul>
    48. 48. 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 }
    49. 49. Add features favoring extensibility
    50. 50. Examples <ul><li>SignalSlot
    51. 51. FilterChain
    52. 52. SPL extensions (SplStack, SplQueue)
    53. 53. PluginBroker </li></ul>
    54. 54. Favor the Explicit Okay, not that kind of explicit …
    55. 55. Magic is sometimes too arcane
    56. 56. 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...)) */
    57. 57. (hidden) automation makes learning hard
    58. 58. class FooController extends Zend_Controller_Action { public function someAction () { $this -> view -> foo = 'bar' ; } } Where is this defined? When is it rendered? What about layouts?
    59. 59. Explicit code is … easier to understand $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 */
    60. 60. Explicit code is … easier to profile
    61. 61. Explicit code is … easier to maintain
    62. 62. Optimize for performance
    63. 64. Profiling <ul><li>Profile to determine where the pain points are
    64. 65. Look for big gains primarily
    65. 66. Fix them </li></ul>
    66. 67. Autoloading: Problems <ul><li>Class Maps are fastest </li><ul><li>But they require maintenance </li></ul><li>Using the include_path is slow </li><ul><li>Not using it requires maintenance </li></ul><li>Using the include_path is most flexible </li><ul><li>But slower than alternatives </li></ul></ul>
    67. 68. Autoloading: Solutions <ul><li>Ship a ClassMapAutoloader by default </li><ul><li>Class maps for full ZF library, and per-component
    68. 69. Tools for generating class maps
    69. 70. Ultimate in performance </li></ul><li>StandardAutoloader requires namespace/path pairs </li><ul><li>Flexibility and performance during development </li></ul><li>StandardAutoloader can act as a fallback autoloader </li><ul><li>Flexibility at the cost of performance </li></ul></ul>
    70. 71. // .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 ZendLoader ClassMapAutoloader ( './.classmap.php' ); $loader -> register (); $bar = new FooModel Bar ();
    71. 72. // StandardAutoloader require_once 'Zend/Loader/StandardAutoloader.php' ; $loader = new ZendLoader StandardAutoloader ( array ( 'namespaces' => array ( 'Foo' => __DIR__ . '/library/Foo' ), )); $loader -> register (); $bar = new FooModel Bar ();
    72. 73. Plugin Loading: Problems <ul><li>Path stack-based autoloading is sloooow
    73. 74. Prefix paths are hard to grasp </li><ul><li>Particularly when coupled with stacks </li></ul><li>Overriding the paths without propagating paths is hard
    74. 75. Case sensitivity becomes an issue </li></ul>
    75. 76. Plugin Loading: Problems <ul><li>Current solution only solves the class loading aspect of plugin loading
    76. 77. Instantiation happens differently per component
    77. 78. Persistence happens differently per component </li></ul>
    78. 79. Plugin Loading: Solutions <ul><li>Class alias based maps by default
    79. 80. Loaders are coupled with brokers </li><ul><li>Handle instantiation, including arguments
    80. 81. Act as registry </li></ul><li>Allows attaching single broker to many objects </li></ul>
    81. 82. /* class loader */ namespace MyComponent ; use ZendLoaderPluginClassLoader , ZendLoaderPluginBroker ; class ComponentLoader extends PluginClassLoader { protected $plugins = array ( 'foo' => 'MyComponentFoo' , 'foo_bar' => 'MyComponentFooBar' , ); }
    82. 83. /* class broker */ namespace MyComponent ; use ZendLoaderPluginClassLoader , ZendLoaderPluginBroker ; class ComponentBroker extends PluginBroker { protected $defaultClassLoader = 'MyComponentPluginClassLoader' ; protected function validatePlugin ( $plugin ) { if (! $plugin instanceof Adapter ) { throw new Exception RuntimeException (); } return true ; } }
    83. 84. /* factory */ namespace MyComponent ; class Factory { /* Not shown: setBroker() and broker() methods */ public function get ( $adapter , array $options ) { return $this -> broker () -> load ( $adapter , $options ); } }
    84. 85. Ease the learning curve
    85. 86. Common Documentation Complaints <ul><li>Options are (often) not documented.
    86. 87. Available functionality (typically, methods) is not presented.
    87. 88. Inconsistent structure between documentation of different components.
    88. 89. Examples do not show common use cases, only using the component individually.
    89. 90. No examples showing complete application development. </li></ul>
    90. 91. Common Learning Problems <ul><li>Magic (“__” methods) is hard to learn (just ask Harry Potter).
    91. 92. Uncertainty where and when to extend or implement extension points – and how to get ZF to use them.
    92. 93. Some patterns are non-obvious in usage (Zend_Form decorators … ). </li></ul>
    93. 94. Proposed Solutions <ul><li>Coding: </li><ul><li>Refactor where usage patterns differ from design
    94. 95. Reduce number of magic calls
    95. 96. Refactor for consistency
    96. 97. Refactor unclear APIs </li></ul></ul>
    97. 98. Proposed Solutions <ul><li>Documentation Standards: </li><ul><li>Introduction
    98. 99. Quick Start
    99. 100. Options
    100. 101. Methods
    101. 102. Examples </li></ul></ul>
    102. 103. The Roadmap
    103. 104. Completed Milestones <ul><li>Migration to Git for ZF2 development
    104. 105. Stripping of require_once calls
    105. 106. Migration to PHP 5.3 namespaces </li><ul><li>Including SPL additions, Session rewrite, and addition of SignalSlot </li></ul><li>Autoloading and plugin loading/brokering </li><ul><li>Including View rewrite </li></ul><li>Exceptions
    106. 107. In fact, we've just released a new development milestone snapshot! </li></ul>
    107. 108. Completed Milestones <ul><li>Zend Framework 2.0.0dev2: </li><ul><li>http://bit.ly/zf2dev2 </li></ul></ul>
    108. 109. Remaining Milestones <ul><li>MVC Refactoring/Rewrite
    109. 110. Internationalization and Localization
    110. 111. Testing
    111. 112. Documentation
    112. 113. Packaging
    113. 114. Migration tools </li></ul>
    114. 115. How YOU can help
    115. 116. Contribute to ZF2! <ul><li>ZF2 wiki: http://bit.ly/zf2wiki
    116. 117. zf-contributors mailing list: [email_address]
    117. 118. IRC: #zftalk.dev on Freenode </li></ul>
    118. 119. ZF2 Git <ul><li>Git guide: http://bit.ly/zf2gitguide
    119. 120. GitHub: http://github.com/zendframework/zf2
    120. 121. Official repo: git://git.zendframework.com/zf.git http://git.zendframework.com/
    121. 122. You still need to sign a CLA! </li></ul>
    122. 123. Thank you! http://framework.zend.com Feedback: http:://joind.in/2287 Twitter: weierophinney, ralphschindler
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×