Climbing KilimanjaroeZ Publish 5: Introduction & Architecture
About the speakers       André Rømcke, eZ Systems, @andrerom       Petar Spanja, NetGen, @periklo!   Presenter: André Rø...
Agenda Wednesday    eZ Publish 5: Introduction & Architecture               −   Using eZ Publish 5: Public API          ...
Architecture of eZ Publish 5.xWhy a new architecture?!   Presenter: André Rømcke   !   09/04/12   4
Why a new architecture?Code speaks better then words?                                     * NOTE: you have to provide the ...
Architecture of eZ Publish 5.xBefore we begin..!   Presenter: André Rømcke   !   09/04/12   6
First: A warning!eZ Publish 5.0 is still in heavy development until October, so:       Concepts might still change somew...
Second: A small 4.x -> 5.x glossary           (Content) object                    Content           (Content) class       ...
Architecture of eZ Publish 5.xFrom top to down!   Presenter: André Rømcke   !   09/04/12   9
Architecture of eZ Publish 5.x: Bird-eye view!   Presenter: André Rømcke   !   09/04/12      10
Architecture of eZ Publish 5.x: GIT organization       eZ Publish 5.x meta repository:          − https://github.com/ezsy...
Architecture of eZ Publish 5.x: ezsystems/ezpublish5appsrcvendor       composer       doctrine       ezsystems      ...
Architecture of eZ Publish 5.x: ezsystems/ezp-nextdoceZ       Publish          − API          − Core          − SPIset...
Architecture of eZ Publish 5.xUsing eZ Publish 5!   Presenter: André Rømcke   !   09/04/12   14
Using eZ Publish 5.x: Public APIInterfaces & abstracts       Documents the API       Makes it possible to “hide” Implem...
Using eZ Publish 5.x: Public API <Concepts>Separation of concern       Layered architecture       Implies use of Depend...
Using eZ Publish 5.x: Public API <Concepts> By code example #1Instead of:public function viewLocation( $locationId, $view...
Using eZ Publish 5.x: Public API <Concepts> By code example #2It would become:public function viewLocation( $locationId, ...
Architecture of eZ Publish 5.xExtending eZ Publish 5!   Presenter: André Rømcke   !   09/04/12   19
Extending eZ Publish 5.x: SPI’s Service Provider Interface Just like the API a bunch of   Interfaces & abstracts       ...
Architecture of eZ Publish 5.xHacking eZ Publish 5!   Presenter: André Rømcke   !   09/04/12   21
Hacking eZ Publish 5: Core“Kernel” implementation of API and SPI’sTo be considered private       Classes should not be ...
Hacking eZ Publish 5: Core Contains #1FieldType (SPI)IO (SPI)       Legacy (4.x compatibility, uses eZClusterHandler)  ...
Hacking eZ Publish 5: Core Contains #2Persistence (SPI)       Legacy (4.x compatibility, uses 4.x DB schema)       InMe...
Hacking eZ Publish 5: CorePersistenceLegacyUses Zeta Database Component       In the future it could use Doctrine DBALC...
Hacking eZ Publish 5: CoreMVC“HMVC”       Using Symfony’s http centric request & response frameworkA Legacy implementat...
Architecture of eZ Publish 5.xLast words..!   Presenter: André Rømcke   !   09/04/12   27
Missing features in 5.x stack in 5.0Info collectorsWorkflowNotificationsGUI’s       Admin & Front end editing (availa...
Use cases 5.0 can be used forPossible with pure 5.x stack:       Content repository via REST/Public API       Websites ...
Coding example<?php/** * Get a Container pre configured with settings (script should be executed from “ezp-next” root) * @...
Links for getting started on CodingSome resources:       http://confluence.ez.no/display/EZP       https://github.com/e...
Upcoming SlideShare
Loading in …5
×

eZ publish 5[-alpha1] Introduction & Architecture

3,099 views
2,966 views

Published on

eZ publish 5 Introduction & Architecture presentation held during eZ Summer Camp 2012 in Bol, Croatia. Gives and introduction to eZ Publish 5 and orientation on where the different parts currently exists for alpha1.

Updated prestentions will be held during eZ Conferance Köln on October 17th 2012.

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

No Downloads
Views
Total views
3,099
On SlideShare
0
From Embeds
0
Number of Embeds
42
Actions
Shares
0
Downloads
58
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • This session is the first and will cover eZ Publish Architecture and Public API specifically.Presentation of the why&amp;#x2019;s and the how&amp;#x2019;s by Andr&amp;#xE9; first for about 60 minutes, then introduction and help on setting things up by Petar and in the end a code workshop.\n
  • \n
  • overdue: Also worth nothing that despite the PHP founder&amp;#x2019;s view that PHP is a view language, PHP ecosystem has catched up on 15 years of knowledge of how to build software. ref concepts introduced by Fowler and others are now getting a grip on how people develop in PHP. In other words PHP has become more mature, especially in regards to Enterprise development, which is an alias for &amp;#x201C;Proper product development&amp;#x201D; imo.\n* Reverse: See Google trends.\n** To be able to refactor a product you at least need to have 1 layer: an api, something you can have so many unit tests for that you can guarantee it still works after the change\n\n
  • top: Errors don&amp;#x2019;t throw, they give errors often ignored which causes often big [performance|consistency] problems later for implementers, or in worst case the customer.\nleft: Business, persistence and db layer is one and the same causing lots of duplicated code and 0 possibility of NoSQL migration\nbottom: This is considered a &amp;#x201C;clean template&amp;#x201D; in eZ Publish terms, but templates have much more business logic then they should, this leads to issues long term, much more template code to maintain, is difficult to test and impossible to get html knowledgeable designers/hackers to help out on.\n\nAdditional:[Business/Market]\n- As eZ is and has for some year been focusing on the Enterprise market, re factor the product to better serve this market today and in the future\n- Use PHP 5 and 5.3 features from day one, also being able to removing features that can now be handled by PHP or other parts of the stack\n- Start to use industry patterns and technologies that have been getting foothold in PHP over the last 3+ years\n- Much higher focus on testing up front in form of Unit tests, integration tests and function testing, + layered architecture with separation of concern; reducing code duplication dramatically\n- Adoption of some PSR standards, use of composer, use of Symfony Framework\n\n
  • It might look like a difficult climb, but in comparison 4.x would be mt. Everest, which has a much higher death rate each year &amp;#xF04A;\n
  • \n
  • Documentation is something that won&amp;#x2019;t receive full attention before October even as most engineers that will work on it is currently busy on implementation, it will be possible for community to help out on this and more by then.\nUser Domain and Location Domain might see some changes as we start to review api and make sure it can:\n 1. Work with NoSQL\n 2. Be possible to add identity map for Content\n 3. Make sure Permission works and can be used w/o circular reference issues between User and Content\n
  • As one of the first things we defined slightly new names for existing concepts in eZ Publish to move closer to what end users, and what other systems out there where using\nMainly to make sure we can introduce less technical terms at high level as well as low level to make sure everyone eventually speaks the same simplified domain language\nAlso this was done to lower the barrier of entry for new users and developers\n
  • \n
  • orange+blue color signals re-implementation of existing logic from Legacy Stack, aka 4.x\n\n[High level]\nPublic API that is fully documented, and related to earlier remark on giving errors, gives you exceptions early if you do something wrong, handles permissions for you and deals with sql dialects deep down in the storage engine (PDO)\nGreen arrow shows the currently aimed migration / integrations between &amp;#x201C;legacy kernel&amp;#x201D; and new architecture.\n\nThe next slide will show where which git repositories contains these different parts of eZ Publish 5.x\n
  • The meta is purely to pull in all dependencies to create a full eZ Publish 5 installation\nNext slide will drill down eZ Publish 5.x meta repository\n
  • app is project config, cache and logs\n Currently contains eZ Publish 4.x, but this will handled by composer soon\nsrc is project code files\n Currently contains eZ Demo Design bundle, but this will be moved out\nvendor is a folder created by composer when executed as mentioned in Readme.md, will contain all project dependencies\nweb is folder for everything that should be reachable from the web, aka public folder\n\nNext slide will drill down into ezp-next repository\n
  • settings is something you can create to override public API settings at the moment, this is done by creating file settings/override/service.ini\nvendor is a folder created by composer when executed as mentioned in Readme.md\nAPI is what you will use when coding against eZ Publish 5\nCore is internal implementation, and only interesting if you want to hack on the kernel and help out on development of it\nSPI are the interfaces you can use when you want to extend eZ Publish, the handlers to use 4.x terms\n\nNext slide will drill down into the [Public] API\n
  • \n
  • This is mostly what you need to learn for coding against eZ Publish 5\n
  • \n
  • Examples above does not even mention use of inline SQL which sometimes would be the case in eZ Publish 4.x &amp;#x201C;views&amp;#x201D; (aka &amp;#x201C;actions&amp;#x201D; in MVC applications)\n
  • Permissions and input validation are handled by api (Services)\nObject cache aka identity map, and workflows is in the future handled by proxy services\nProxy Services are basically services that encapsulate API services and adds features transparently, think of them as thin layers doing a dedicated tasks\nVarnish/Symfony/.. reverse proxy takes care of view cache, so use of proper http headers for caching is what is needed\n
  • \n
  • See Edi&amp;#x2019;s Presentation and code workshop for a deep dive into how to deal with SPI&amp;#x2019;s, specifically FieldTypes, aka Datatypes.\n
  • \n
  • For API/SPI&amp;#x2019;s it is the interfaces &amp; abstracts combined with Integration tests that provide the &amp;#x201C;contract&amp;#x201D; for how eZ Publish 5 will behave, despite how the implementation is done.\n
  • All SPI&amp;#x2019;s are plural, there can be many implementations, for instance there is currently 22 FieldType implementations, xmltext, author, int, float, ...\n
  • - The settings are stock settings for the Core implantation, can be overridden as defined in config.php.\n- Repository is THE API for 5.0, but in the future there might be others as well.\n- All API and SPI implementations should contain own tests, ultimately these should be mock based tests testing the implementations only, currently some of them are more or less integrations tests (loads whole stack and executes tests agains methods on API / SPI implementations)\n
  • - Doctrine DBAL which is a successor to Zeta DB\n- Handlers refer to the SPI\\Persistence equivalent of Repository Services, they are Domain specific, examples: Content handler, Section handler, Search Handler\n- The reason for having a separation here was to be able to inject optimized Gateways for specific Databases in the future\n
  • \n
  • \n
  • Info collectors will most likely be solved in a completely different way in the future\nWorkflows and Notifications will most likely be part of 5.1 and will depend on events / signals triggered by Kernel, or be done as Proxy Services\nGUI: 5.1 will receive first version of new editorial interface, this will open the possibility of creating a simplified admin GUI on 5.x stack in the future\nPerformance: Is already better in the case of view cache, but Public API needs further tuning in form of identity map and reduce number of backend calls pr API call before it can really shine compared to 4.x\n
  • So despite missing feature in 5.x stack, thanks to 4.x being bundled, all of the features are accessible using misc methods of Legacy fallback( to be covered during eZ Conference in K&amp;#xF6;ln)\n
  • \n
  • \n
  • eZ publish 5[-alpha1] Introduction & Architecture

    1. 1. Climbing KilimanjaroeZ Publish 5: Introduction & Architecture
    2. 2. About the speakers  André Rømcke, eZ Systems, @andrerom  Petar Spanja, NetGen, @periklo! Presenter: André Rømcke ! 09/04/12 2
    3. 3. Agenda Wednesday  eZ Publish 5: Introduction & Architecture − Using eZ Publish 5: Public API − Extending eZ Publish 5: SPI’s − Hacking eZ Publish 5: Core − Public API Code Workshop  Extending eZ Publish 5: Deep dive into Datatypes Thursday  Symfony  eZ Publish 5 & Symfony Friday  REST API  Hackaton! Presenter: André Rømcke ! 09/04/12 3
    4. 4. Architecture of eZ Publish 5.xWhy a new architecture?! Presenter: André Rømcke ! 09/04/12 4
    5. 5. Why a new architecture?Code speaks better then words? * NOTE: you have to provide the following attributes: * contentobject_id * contentobject_attribute_id * * @param array $row * @return object */ static function create( $row = array() ) { if ( !isset( $row[contentobject_id] ) ) eZDebug::writeError( Missing contentobject_id parameter!, __METHOD__ );! Presenter: André Rømcke ! 09/04/12 5
    6. 6. Architecture of eZ Publish 5.xBefore we begin..! Presenter: André Rømcke ! 09/04/12 6
    7. 7. First: A warning!eZ Publish 5.0 is still in heavy development until October, so:  Concepts might still change somewhat  Code examples will break  Several unit tests are still failing, and lots are still skipped/ incomplete  Documentation is not by any means polished or complete yet  Note: Come by eZ Conference, Köln in October for an updated and refined deep dive into 5.0! Presenter: André Rømcke ! 09/04/12 7
    8. 8. Second: A small 4.x -> 5.x glossary (Content) object Content (Content) class Content Type (Content) attribute Field (Content) class attribute Field Definition Data type Field Type Node Location (Content) class group Content Type Group! Presenter: André Rømcke ! 09/04/12 8
    9. 9. Architecture of eZ Publish 5.xFrom top to down! Presenter: André Rømcke ! 09/04/12 9
    10. 10. Architecture of eZ Publish 5.x: Bird-eye view! Presenter: André Rømcke ! 09/04/12 10
    11. 11. Architecture of eZ Publish 5.x: GIT organization  eZ Publish 5.x meta repository: − https://github.com/ezsystems/ezpublish5 − eZ Publish 5.x Core: https://github.com/ezsystems/ezp-next − eZ Publish 4.x “LS” repository: https://github.com/ezsystems/ezpublish! Presenter: André Rømcke ! 09/04/12 11
    12. 12. Architecture of eZ Publish 5.x: ezsystems/ezpublish5appsrcvendor  composer  doctrine  ezsystems − ezpublish <- This is “ezp-next“ at them moment  symfony  twig  zetacomponentsweb! Presenter: André Rømcke ! 09/04/12 12
    13. 13. Architecture of eZ Publish 5.x: ezsystems/ezp-nextdoceZ  Publish − API − Core − SPIsettingsvendor! Presenter: André Rømcke ! 09/04/12 13
    14. 14. Architecture of eZ Publish 5.xUsing eZ Publish 5! Presenter: André Rømcke ! 09/04/12 14
    15. 15. Using eZ Publish 5.x: Public APIInterfaces & abstracts  Documents the API  Makes it possible to “hide” ImplementationTested with “integration tests”  Code examples generated based on theseLong life cycle  Conservative deprecation -> removal process! Presenter: André Rømcke ! 09/04/12 15
    16. 16. Using eZ Publish 5.x: Public API <Concepts>Separation of concern  Layered architecture  Implies use of Dependency injectionDomain driven design  API gives you a repository consistent of: − Domain Services, with: − Methods for all operations you can perform on a domain (Section, Location, Content, Language, ... ) − Loaded Domain objects are Value objects, hence immutable − Factory methods to create new create/ update “structs” for changing data! Presenter: André Rømcke ! 09/04/12 16
    17. 17. Using eZ Publish 5.x: Public API <Concepts> By code example #1Instead of:public function viewLocation( $locationId, $viewType ){ // Permission check (usually w/o limitations) if ( !$this->user->hasAccessTO( ... ) ) { .... } // Fetch using hard coupling on the “Service” to get a node $location = eZContentObjectTreeNode::fetch( $locationId ); // if $location is null handle error { ... } // Trigger workflow { ... } // Generate view and view cache { ... }}! Presenter: André Rømcke ! 09/04/12 17
    18. 18. Using eZ Publish 5.x: Public API <Concepts> By code example #2It would become:public function viewLocation( $locationId, $viewType ){ // Get location (checks permissions, service proxies can optionally handle cache/events/workflow) $location = $this->repository->getLocationService()->loadLocation( $locationId ); // Execute View, which generates Response, which is cached by Symfony / Varnish}! Presenter: André Rømcke ! 09/04/12 18
    19. 19. Architecture of eZ Publish 5.xExtending eZ Publish 5! Presenter: André Rømcke ! 09/04/12 19
    20. 20. Extending eZ Publish 5.x: SPI’s Service Provider Interface Just like the API a bunch of Interfaces & abstracts  Documents the SPI’s  A contract for how the handlers should be implementedThe “Handlers” of eZ Publish 5.x  Persistence  IO  Limitations  FieldTypes  ...! Presenter: André Rømcke ! 09/04/12 20
    21. 21. Architecture of eZ Publish 5.xHacking eZ Publish 5! Presenter: André Rømcke ! 09/04/12 21
    22. 22. Hacking eZ Publish 5: Core“Kernel” implementation of API and SPI’sTo be considered private  Classes should not be used directly from this namespace if outside  Methods exposed here but not in API or SPI’s are by definition private  Can be re-factored at any given timeUses dependency injection so it is possible to inject alternative implementations of almost anything! Presenter: André Rømcke ! 09/04/12 22
    23. 23. Hacking eZ Publish 5: Core Contains #1FieldType (SPI)IO (SPI)  Legacy (4.x compatibility, uses eZClusterHandler)  InMemory (unit testing)Limitation (SPI)MVC  Legacy (Wrapper for 4.x kernel and functionality)  Symfony (“5.x” kernel, extensions for Symfony Framework)! Presenter: André Rømcke ! 09/04/12 23
    24. 24. Hacking eZ Publish 5: Core Contains #2Persistence (SPI)  Legacy (4.x compatibility, uses 4.x DB schema)  InMemory (unit testing)  Solr (future Search handler)Repository (APIRepository)REST  Client  Serversettings! Presenter: André Rømcke ! 09/04/12 24
    25. 25. Hacking eZ Publish 5: CorePersistenceLegacyUses Zeta Database Component  In the future it could use Doctrine DBALConsists of 3 parts in all handlers  The Domain specific handler  Gateway which deals with the SQL  Mapper which maps sql data to SPI value objects, & back! Presenter: André Rømcke ! 09/04/12 25
    26. 26. Hacking eZ Publish 5: CoreMVC“HMVC”  Using Symfony’s http centric request & response frameworkA Legacy implementation that wraps around 4.x(More on this Thursday)! Presenter: André Rømcke ! 09/04/12 26
    27. 27. Architecture of eZ Publish 5.xLast words..! Presenter: André Rømcke ! 09/04/12 27
    28. 28. Missing features in 5.x stack in 5.0Info collectorsWorkflowNotificationsGUI’s  Admin & Front end editing (available via LS though)Performance (as of 5.0-alpha1)  Full potential not reached, but comparable to 4.xScalability (as of 5.0)  New Persistence & IO handlers needed to reach full potential! Presenter: André Rømcke ! 09/04/12 28
    29. 29. Use cases 5.0 can be used forPossible with pure 5.x stack:  Content repository via REST/Public API  Websites w/o user generated contentWith use of LegacyStack fallback:  Websites with user generated content  Info collector  ...  anything! Presenter: André Rømcke ! 09/04/12 29
    30. 30. Coding example<?php/** * Get a Container pre configured with settings (script should be executed from “ezp-next” root) * @var eZPublishAPIContainer $container This is all you need to get code completion */$container = require(bootstrap.php);// Get Repository & log in as admin (for permissions to create content)$repository = $container->getRepository();$repository->setCurrentUser( $repository->getUserService()->loadUser( 14 ) );// Get Blog ContentType (aka content class)$contentTypeService = $repo->getContentTypeService();$blogContentType = $contentTypeService->loadContentTypeByIdentifier( "blog" );// Create Content struct & Location (node) struct with parent id = 2$contentService = $repository->getContentService();$contentCreateStruct = $contentService->newContentCreateStruct( $blogContentType, "eng-GB" );$contentCreateStruct->setField( "name", "Hello world" );$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( 2 );// Create both structs in db with createContent()$content = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) ); ! Presenter: André Rømcke ! 09/04/12 30
    31. 31. Links for getting started on CodingSome resources:  http://confluence.ez.no/display/EZP  https://github.com/ezsystems/ezp-next/wiki/codingstandardsCode examples  By Petar: https://gist.github.com/pspanja  By Gaetano: https://gist.github.com/gggeek  Generated from all integration tests: http://t.co/mHTqC8bAFollow up talk on FieldTypes:  http://t.co/zSpdVwdHGetting started on Symfony stack:  See GETTING_STARTED in ezpublish5 repo & confluence! Presenter: André Rømcke ! 09/04/12 31

    ×