The current architecture of TYPO3 5.0

10,195 views
10,052 views

Published on

These are the slides of the presentation of the current TYPO3 5.0 architecture from the TYPO3 Developer Days in Dietikon, Switzerland in 2007. Please refer to the 5.0 documentation for a more detailed explanation of the features and some code examples.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
10,195
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

The current architecture of TYPO3 5.0

  1. 1. Gimme Five!architecture of TYPO3 5.0The currentThe road to TYPO3 5.0 „Phoenix“TYPO3 Developer Days 25.-29.04.2007, Dietikon / Switzerland Inspiring people to share
  2. 2. The current architecture? we don‘t build buildings – design decisions can be changed most of the time refactoring is already an important part of our daily development with architecture we are referring to the design decisions we have taken so far for the core of TYPO3 5.0 Inspiring people to share
  3. 3. The current architecture„ Software is not limited by physics, like buildings are. It is limited by imagination, by design, by organization. In short, it is limited by properties of people, not by properties of the world. ” Martin Fowler Inspiring people to share
  4. 4. Tower of Babel
  5. 5. Ubiquitous language The common vocabulary is an important prerequisite for successful collaboration Use the same words for discussion, modeling, development and documentation Any vocabulary you know from TYPO3 4.x ? Inspiring people to share
  6. 6. Ubiquitous language in TYPO3 4.x Frontend Page Extension Content Plugin Element Page System Tree Folder Backend TypoScript Module dardTemplate Object Stan p Wra Record TER File rks pace Mount Wo beer Inspiring people to share
  7. 7. Ubiquitous language in TYPO3 5.0 Page Package Plugin Content Element Page System Tree Component Folder TypoScript dard Object Stan p Template WraConfigura TPR tion orks pace Resource espres so W Inspiring people to share
  8. 8. Domain-Driven Design The domain of our software is content management We create a model of our domain which is described by the vocabulary of our ubiquitous language The PHP code is tightly related to our model which gives it meaning and makes the model relevant Inspiring people to share
  9. 9. Domain-Driven Design „Set the Modification Date of each Content Element of the Page with the Unique Identifier 1 to the current time“ $page = $pageRepository->findByUid(1); foreach ($page->getContentElements() as $contentElement) { $contentElement->setModificationDate(time()); } Inspiring people to share
  10. 10. Layered Architecture This is the point of important! our soft ware, the hom e This is the real point of our software f the model o Domain Inspiring people to share
  11. 11. Layered Architecture Domain Data source Inspiring people to share
  12. 12. Layered Architecture Presentation Domain Data source Inspiring people to share
  13. 13. Layered Architecture Presentation Domain Data source Inspiring people to share
  14. 14. Layered Architecture ViewPresentation Controller Application Logic (Service Layer) Domain Domain Model (Domain Layer) Data Mapper Data source Data Source Abstraction Inspiring people to share
  15. 15. Caching DebuggingInfrastructure Profiling Messaging Transaction Management Package Resource Logging Versioning Management Management Object Object Data Source MVC Error RelationalManagement Abstraction Framework Handling Mapping PHP Inspiring people to share
  16. 16. Infrastructure frameworks For the infrastructure of TYPO3 we need a lot of features, which are probably covered by existing frameworks we can use: Object Mgm. / Dependecy Injection: Seasar, Pico Container Model, View, Controller: Agavi Aspect Oriented Programming: Seasar, GAP, aspectPHP, ... Database / -model Abstraction: Propel, Creole ... and many more Inspiring people to share
  17. 17. Why re-invent the wheel? Inspiring people to share
  18. 18. Re-invent the wheel because ... some of the frameworks follow a weird, unclean or inconsistent approach some of the frameworks are not mature enough or badly documented / coded. some of the frameworks don‘t offer all the features we want some projects don‘t have a stable community and support we want a whole, component-based, feature-rich framework offering a consistent interface to the developer which increases quality, speed and ease of development Inspiring people to share
  19. 19. Innovated, not re-invented Not just a re-invention, we ... ... looked at the best wheels which exist today (other programming languages have nice wheels, too) ... studied the history of wheels and what experience others made while using them ... added our own creativity and expertise Recipe: Take the best wheels, attach them to a lean, yet powerful vessel (framework) and add the TYPO3 flavour Inspiring people to share
  20. 20. Inspiring people toshare
  21. 21. C MS ew ork Fram 5.0 1.0 Inspiring people to share
  22. 22. Focussing on our domain Framework and CMS: exist as independent packages Enforces clean separation of infrastructure and business logic The Framework can be used without the TYPO3 CMS and serve as a foundation for any enterprise PHP application Packages contain additional functionality for CMS- and other applications The TYPO3 Package Repository can be used independently from the TYPO3 CMS Inspiring people to share
  23. 23. TYPO3 Framework
  24. 24. TYPO3 Framework Components Packages Aspect Oriented Programming Model, View, Controller Resources Reflection Utility Inspiring people to share
  25. 25. TYPO3 Framework Inspiring people to share
  26. 26. TYPO3 Framework Inspiring people to share
  27. 27. Components Components are re-usable, properly encapsulated objects which are managed by the Component Manager (Almost) all classes in the TYPO3 context are components Components are configurable They allow for Dependency Injection Inspiring people to share
  28. 28. Components: Configuration The Component Manager controls the life cycle of a component The scope of a component is just a matter of configuration: prototype, singleton or session A component is referred to by its name, the implementation class is configurable: comparable to the XCLASS mechanism in TYPO3 4.x implementations sharing the same interface act as true drop- in replacements Inspiring people to share
  29. 29. Components: Configuration Packages/MyPackage/Classes/T3P_MyPackage_MyComponent.php class T3P_MyPackage_MyComponent { protected $counter = 0; public function increaseAndGetCounter() { return $this->counter ++; } } Inspiring people to share
  30. 30. Components: Configuration Packages/MyPackage/Classes/T3P_MyPackage_MyComponent.php Packages/MyPackage/Classes/Components.conf class T3P_MyPackage_MyComponent { [T3P_MyPackage_MyComponent] scope = prototype = 0; protected $counter public function increaseAndGetCounter() { return $this->counter ++; } } Inspiring people to share
  31. 31. Components:Dependency Injection Inverse of Control or Hollywood Principle: „Don‘t call us, we call you“ Your component needs access to a Logger Usual case: Your code asks the framework to deliver a logger instance With Dependency Injection: Your code just gets an instance of the logger injected Inspiring people to share
  32. 32. Components:Dependency Injection class tx_myextension_pi1 { protected $logger; public function __construct() { $this->logger = t3lib_div::makeInstance(’tx_log_logger‘); } public function main() { $this->logger->log(’Hello log file‘); } } Inspiring people to share
  33. 33. Components:Dependency Injection class tx_myextension_pi1 { protected $logger; public function __construct() { $this->logger = tx_log_logger::getInstance(); # Custom Singleton implementation } public function main() { $this->logger->log(’Hello log file‘); } } Inspiring people to share
  34. 34. Components:Dependency Injection class T3P_MyPackage_MyComponent { protected $logger; public function __construct(T3P_Log_LoggerInterface $logger) { $this->logger = $logger; } public function main() { $this->logger->log(’Hello log‘); } } Inspiring people to share
  35. 35. Components:Dependency Injection Different ways of injection: Constructor injection Setter injection Dependencies are resolved automatically Classes are loaded automatically ... of course: configurable Inspiring people to share
  36. 36. Packages Extensions are now called Packages A package is any combination of meta data, code, documentation, media and other resources Packages can be up- and downloaded from the Package Repository Documentation is stored as DocBook The exchange format for packages is a plain ZIP file Inspiring people to share
  37. 37. Packages: Package Manager Manages packages - replacement for the Extension Manager Accessible through command line and SOAP The package manager can even upgrade the Framework package, ie. it can upgrade itself Inspiring people to share
  38. 38. Aspect Oriented Programming AOP is a programming paradigm complements OOP by separating concerns to improve modularization OOP modularizes concerns: methods, classes, packages AOP addresses cross-cutting concerns Inspiring people to share
  39. 39. AOP: Cross-cutting concerns Presentation Domain Data source Inspiring people to share
  40. 40. AOP: Cross-cutting concerns Presentation The concerns live here Domain Data source Inspiring people to share
  41. 41. AOP: Cross-cutting concernsGuestbook Forum Domain News Content Parties Inspiring people to share
  42. 42. AOP: Cross-cutting concernsGuestbook Forum News Content Parties Security Logging Inspiring people to share
  43. 43. AOP: Cross-cutting concernsGuestbook Security Forum News Content Parties Logging Inspiring people to share
  44. 44. AOP: Cross-cutting concernsGuestbook Security Forum News Content Parties Logging Inspiring people to share
  45. 45. AOP: Method interception Hypothetical code exampleclass T3P_User_AccountManagement { public function deleteAccount($accountId) { $this->accountRepository->delete($accountId); }} Inspiring people to share
  46. 46. AOP: Method interceptionclass T3P_Security_RightsManager { public function hasEnoughRights($situation) { $account = $this->accountManager->getCurrentAccount(); return $account->hasEnoughRightsForSituation($situation); }} Inspiring people to share
  47. 47. AOP: Method interceptionclass T3P_User_AccountManagement { public function deleteAccount($accountId) { $account = $this->accountManager->getCurrentAccount(); if ($account->hasEnoughRightsForSituation($situation)) { $this->accountRepository->delete($accountId); } else { throw new NotEnoughtRightsException(’Access denied’); } }} Inspiring people to share
  48. 48. AOP: Implementation details TYPO3 makes use of dynamic proxies for weaving Our AOP Framework does not require any pre-processing or a special PHP extension to run Standards are used where they made sense, other parts are simplified or adapted to the PHP capabilities only low performance loss because weaving is a one-time operation which can be cached Inspiring people to share
  49. 49. AOP Where it makes sense: Cross-cutting concerns Extending legacy code Caveats: Scattered code, multiple extensions check out clean OOP alternatives Inspiring people to share
  50. 50. Model, View, Controller MVC Framework is work in progress Some design decisions taken: Request Handler with filter chain Dispatcher with interceptor chain One controller per plugin, multiple actions per controller Code is on the way ... Inspiring people to share
  51. 51. Inspiring people toshare
  52. 52. Resources Resource Manager for centralizing resource access Media, documents, generic files and other resources are available as resource objects File resources from the packages are detected and managed automatically Allows for fine-grained rights management and performance optimization Status: Pending Inspiring people to share
  53. 53. Reflection Extended reflection capabilities Allow for accessing tags in doc comments directly Will feature some caching mechanism in the future Maybe an annotation manager will be added Inspiring people to share
  54. 54. Utility Home of t3lib_div-like tools Some functions have already been ported Inspiring people to share
  55. 55. TYPO3 CMS Currently working on the model / node types TypoScript 2.0 Content Repository Inspiring people to share
  56. 56. Some project ideas Implement the TYPO3 Package Repository as 5.0 package Create a 5.0 implementation of the Party Information Framework Integrate 5.0 as a 4.x frontend plugin Create a bootstrap-like, everything-works-auto-installer Inspiring people to share
  57. 57. Recommended literature Gamma et al.: Design Patterns Elements of Reusable Object- Oriented Software Addison Wesley 1995 Inspiring people to share
  58. 58. Recommended literature Martin Fowler: Refactoring Improving the Design of Existing Code Addison Wesley 1999 Inspiring people to share
  59. 59. Recommended literature Kent Beck: Test-Driven Development By Example Addison Wesley 2002 Inspiring people to share
  60. 60. Recommended literature Martin Fowler: Patterns of Enterprise Application Architecture Addison Wesley 2002 Inspiring people to share
  61. 61. Recommended literature Eric Evans: Domain Driven Design Tackling Complexity in the Heart of Software Addison Wesley 2002 Inspiring people to share
  62. 62. Recommended literature Inspiring people to share
  63. 63. Thanks for listening Robert Lemke <robert@typo3.org> Inspiring people to share
  64. 64. Gimme Five!The road to TYPO3 5.0 „Phoenix“

×