Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Jab12 - Joomla! architecture revealed

2,907 views

Published on

J and Beyond 2012 - Joomla! architecture revealed by Ofer Cohen

Published in: Technology
  • Be the first to comment

Jab12 - Joomla! architecture revealed

  1. 1. Joomla Architecture Revealed! Ofer Cohen @oc666 ongage.com jomland.com
  2. 2. About me, Joomla and Arch● Open source volunteer since 2006.● Joomla volunteer since 2007.● CMS & Platform Code contributor● JBS team member● GSoC mentor of Joomla● Extensions Developer (check TP2 at Jomland) 
  3. 3. Not enough?● Joomla Hebrew translation coordinator● Joomla Israeli community leader● Joomla!Day Israel organiser● OSM board member● Daily job: R&D manager in the Start-Up nation.
  4. 4. Joomla!● 2.8% of all websites, worldwide● Object Oriented● Components based on MVC design pattern● What else?
  5. 5. Architecture?● Architecture the process and product of planning, designing and construction...● Software architecture depiction of the system that aids in the understanding of how the system will behave● Website architecture approach to the design and planning of websites...
  6. 6. Revealed?● Who cares? It Just Works! (TM)
  7. 7. Revealed!● Why is my Joomla! site slow? hacked?..● Want to build a complicated website?● What are the abilities of Joomla?● What cant I do with Joomla?● I just love to research and learn!
  8. 8. Object Oriented● Data structures consisting of data fields and methods together with their interactions● Programming techniques include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.● This approach make your program more easy to build and implement tricks.
  9. 9. Tricks?The tricks are design patterns - reusablesolutions to commonly occurring problemswithin a given context in software design.(wikipedia)
  10. 10. Step back.... J! index.php1. constants and defines declared2. configuration loaded3. application init triggered (lang, editor)4. routing parsed the request (url, arguments)5. dispatch the component6. render the template7. echo the response output
  11. 11. Looks simple, but whats inside?1. Component is first dispatched and then buffered.2. Template render with their modules and then set output into response (object).3. Events trigger between each step.
  12. 12. Template Walk... --> How is a template rendered?1. The index.php of the template is rendered.2. Parsing jdoc statements.3. Each jdoc statement rendered separately, iteratively, according to its type.4. Component & head are parts of the iteration, but have different rendering.
  13. 13. VMC... MCV... WTF? Prefer BMW?● MVC - Model-View-ControllerDivide the software into 3 layers: ○ M=>Logic ○ V=>User interface ○ C=>Request handler
  14. 14. MVC - advantages● Easier to extend.● Less spaghetti code.● Great approach on upgrades and new features.● Easier collaboration between multiple developers.
  15. 15. Plugin=Observer● Events handling● Simple dispatcher can be called● It fires events to Joomla plugins on basic triggers.● For example, after content creation, before user delete, etc.
  16. 16. Factory● Supplier of the main entities of Joomla: ○ Session ○ User ○ Cache ○ Database...● Each entity is singleton
  17. 17. Singleton● Only one instance of an object is kept.● Saves system memory usage & cpu
  18. 18. Bridge● Decouple an abstraction from its implementation.● Useful for implementation encapsulation.● Especially when the program decides how to implement on run time.
  19. 19. Bridge - example● J!Database instance built by its instantiator method input.● The method will return its nested inheritance object● The object type would be unknown, only the methods we can call would be known.
  20. 20. Bridge - code example from J!DBabstract class JDatabase { public static function getInstance($options) { $class = JDatabase . ucfirst($options[driver]); $instance = new $class($options); self::$instances[$signature] = $instance; return self::$instances[$signature]; }}
  21. 21. Adapter● Adapter translates one interface for a class into a compatible interface.● For example DB adapter for DB such as MySQL, MSSQL, Postgre.● Another example would be Renderer object for rendering output of module, component, header, etc.
  22. 22. Future● HMVC - reuse of each part of the MVC pattern.● Traits - the long tail story● UCM - want to select from articles content and virtumart products at the same query. ORM-Like methods (NOSQL).
  23. 23. Conclusion● The only complicated thing is the problem.● The solution must be simple.● If you have a complicated solution, you probably chose the wrong solution (KISS)

×