Author
sebastian-kurfuerst
View
4.653
Download
3
Embed Size (px)
DESCRIPTION
Überblick über FLOW3, Fluid und die Relation TYPO3 v4 und TYPO3 v5. Es werden wichtige Konzepte wie Dependecy Injection, AOP, TDD vorgestellt. Desweiteren wird Fluid präsentiert.
2. TYPO3 User Group Dresden - 21. Januar 2009 Inspiring people to FLOW3 - der aktuelle Stand share 3. FLOW3 - Der aktuelle Stand 21.01.2009Sebastian Kurfrst Vielen Dank an Robert Lemke fr seine Slides 4. Inspiring people to FLOW3 - der aktuelle Stand share 5. Inspiring people to FLOW3 - der aktuelle Stand share 6. Inspiring people to FLOW3 - der aktuelle Stand share 7. Inspiring people to FLOW3 - der aktuelle Stand share 8. Inspiring people to FLOW3 - der aktuelle Stand share 9. Inspiring people to FLOW3 - der aktuelle Stand share 10. - ACHTUNG -TYPO3-EvangelistInspiring people to FLOW3 - der aktuelle Stand share 11. Inhalt Test DrivenTYPO3 - Einfhrung DevelopmentDependency FLOW3InjectionAspektorientierte Programmierung Fluid - The Zen of TemplatingDomain Driven Synergien TYPO3 v4 und v5 Design & MVCInspiring people to FLOW3 - der aktuelle Standshare 12. Inhalt Test DrivenTYPO3 - Einfhrung DevelopmentDependency FLOW3InjectionAspektorientierte Programmierung Fluid - The Zen of TemplatingDomain Driven Synergien TYPO3 v4 und v5 Design & MVCInspiring people to FLOW3 - der aktuelle Standshare 13. TYPO3 Open Source Content Management SystemAktuelle stabile Version: TYPO3 4.2.360.000 bis 80.000 Downloads pro Monatmehr als 30.000 Nutzer auf typo3.org registriertHchste Verbreitung im Mittelstand, jedoch auch Nutzung in groen Firmen: Dassault Systems, 3M, Sixt, Unesco, Unicef, WWFInspiring people to FLOW3 - der aktuelle Stand share 14. Die Geschichte von TYPO3 seit 199833 Kernentwicklerbisher 500.000 Zeilen Code committedaktuelle Codebase: 300.000 ZeilenInspiring people to FLOW3 - der aktuelle Stand share 15. Warum bentigen wir TYPO3 v5?Inspiring people to FLOW3 - der aktuelle Stand share 16. TYPO3 Heute TYPO3 v4 ist nahezu vollstndig ausgereiftLetzte Releases: Fokus auf Usability-Verbesserungen fr BenutzerInspiring people to FLOW3 - der aktuelle Stand share 17. K. Tuck at http://www.sxc.hu/photo/1135191 Gewachsene Architektur 18. TYPO3 Heute TYPO3 v4 ist nahezu vollstndig ausgereiftLetzte Releases: Fokus auf Usability-Verbesserungen fr BenutzerGewachsene Architektur, keine Unit TestsGroe nderungen sind daher risikoreich / unmglichTYPO3 wird oft als Anwendungsframework verwendet - es ist jedoch ein CMSInspiring people to FLOW3 - der aktuelle Stand share 19. TYPO3 in der Zukunft?Inspiring people to FLOW3 - der aktuelle Stand share 20. Warum sollte man von Null anfangen?Inspiring people to FLOW3 - der aktuelle Stand share 21. Source: The Secret Archives of TYPO3 22. We need a new framework! 23. Zwei auf einen StreichInspiring people to FLOW3 - der aktuelle Stand share 24. TYPO3 in der Zukunft!TYPO3 v5Enterprise CMS FLOW3 Enterprise Application Framework Inspiring people to FLOW3 - der aktuelle Standshare 25. Inspiring people to FLOW3 - der aktuelle Stand share 26. Inhalt Test DrivenTYPO3 - Einfhrung DevelopmentDependency FLOW3InjectionAspektorientierte Programmierung Fluid - The Zen of TemplatingDomain Driven Synergien TYPO3 v4 und v5 Design & MVCInspiring people to FLOW3 - der aktuelle Standshare 27. Flow [fl] (engl. ieen, rinnen, strmen) bedeutet das Gefhl des vlligen Aufgehens in einer Ttigkeit. In diesem Zustand besteht vllige Harmonie zwischen dem limbischen System, das die Emotionen steuert, und dem kortikalen System, dem der Sitz fr Bewusstsein und Verstand zugeordnet wird. FLOW3 [fl'three] Das Web- Anwendungsframework, welches alle Schwierigkeiten lst, sodass man sich auf das Wesentliche konzentrieren kann.Inspiring people toFLOW3 - der aktuelle Standshare http://www.sxc.hu/photo/768249 28. FLOW3 = Anwendungsframework Nicht nur eine Zusammenstellung von Komponenten oder eine Snippet-Librarygeliefert mit einsatzfhiger StandardkongurationPaketbasiert Alph bentigt mindestens PHP 5.3 a3 mit einem mchtigen JSR-283-basierten Content Repository geliefert Inspiring people to FLOW3 - der aktuelle Standshare 29. Geniee das FLOW3-Erlebnis Intuitive APIsLesbarer Quellcode (wie ein Buch)Konsistente Benennung fr Klassen, Methoden und Eigenschaften Inspiring people to FLOW3 - der aktuelle Standshare 30. Fokus auf das Wesentlichedas Framework kmmert sich um den Rest http://www.sxc.hu/photo/59950 31. Die Grundpfeiler von FLOW3 Test Driven Dependency Aspect Oriented Development InjectionProgramming Inspiring people to FLOW3 - der aktuelle Standshare 32. Die Grundpfeiler von FLOW3 Test Driven Development ... means that you write an automated test, thenyou write just enough code to make that onetest pass, then you refactor the code primarilyto improve readability and remove duplication. Henrik KnibergSCRUM and XP from the trenches Inspiring people to FLOW3 - der aktuelle Stand share 33. Die Grundpfeiler von FLOW3 Test Driven Development ... means that you write an automated test, thenyou write just enough code to make that onetest pass, then you refactor the code primarilyto improve readability and remove duplication. Henrik KnibergSCRUM and XP from the trenches Inspiring people to FLOW3 - der aktuelle Stand share 34. Die Grundpfeiler von FLOW3 Test Driven Development Test CaseFAIL Implementation OK Refactoring OK Inspiring people to FLOW3 - der aktuelle Standshare 35. Die Grundpfeiler von FLOW3 Test Driven Development - Demonstration Eine Klasse schreiben, welche eine square-Methode besitzt. Diese multipliziert eine Zahl mit sich selbst und gibt das Ergebnis zurck. Akademisches Beispiel! Inspiring people to FLOW3 - der aktuelle Stand share 36. 1. Test Case schreiben! 37. Achtung - Neue Syntax:veraltete F3MathHelpers::square() Namespace- Syntax! 38. Der Test Case schlgt fehl. 39. 2. Implementieren! 40. Der Test Case ... 41. Design-Problemewerden zeitigergefunden! 42. Unit Tests sind ein Auffangnetz fr dieZukunft 43. Die Grundpfeiler von FLOW3 Test Driven Development zuerst Unit Tests schreiben, dann den zu testenden Code Software-DesignerProgrammierer Inspiring people to FLOW3 - der aktuelle Standshare 44. Die Grundpfeiler von FLOW3 Dependency Injection Hollywood Principle: Dont call us, we call youAnwendung des Inversion of Control-Patterns fr die Erzeugung und Initialisierung von Objekten Inspiring people to FLOW3 - der aktuelle Standshare 45. Die Grundpfeiler von FLOW3Ohne Dependency Injection BookingWeb public function __construct() { Service// Prototype$this->logger = new Logger();// oder als Singleton: $this->logger = Logger->getInstance()} LoggerObjekt 3 Inspiring people toFLOW3 - der aktuelle Standshare 46. Die Grundpfeiler von FLOW3Ohne Dependency Injection Wie schreibt man Unit Tests public function __construct() { fr solch einen Code? // Prototype $this->logger = new Logger(); Wie entscheidet man zur Laufzeit, welcher Logger instanziert wird?// oder als Singleton: $this->logger = Logger->getInstance() } Inspiring people toFLOW3 - der aktuelle Stand share 47. Die Grundpfeiler von FLOW3Mit Dependency Injection BookingWeb Jedes Objekt deklariert, welche anderen ServiceObjekte es bentigt Der IoC Container ...... gibt dem Objekt fertig initialisierteObjekte... entscheidet zur Laufzeit, welche LoggerObjekt 3Klassen instanziert werden IoC ContainerInspiring people toFLOW3 - der aktuelle Standshare 48. Die Grundpfeiler von FLOW3 Mit Dependency Injection Constructor Injectionpublic function __construct(F3FLOW3LogLogger $logger) { $this->logger = $logger; }Das Framework injiziert denLogger Inspiring people to FLOW3 - der aktuelle Stand share 49. Die Grundpfeiler von FLOW3 Mit Dependency Injection Setter Injectionpublic function injectLogger(F3FLOW3LogLogger $logger) { $this->logger = $logger; }Das Framework injiziert denLogger Inspiring people to FLOW3 - der aktuelle Stand share 50. Die Grundpfeiler von FLOW3 Mit Dependency Injection Jede Klasse ist einzeln testbar, indem man die bentigten Abhngigkeiten mit Mocks / Stubs simuliertMan kann kongurieren, ob Klassen sich wie Singletons oder Prototypes verhalten @scope singleton (Standard) @scope prototype Inspiring people to FLOW3 - der aktuelle Stand share 51. Die Grundpfeiler von FLOW3Mit Dependency InjectionMan kann zur Laufzeit entscheiden, welche Klasse verwendet werden soll BookingWebLoggerInterface ServiceFileLoggerDatabaseLogger Inspiring people toFLOW3 - der aktuelle Standshare 52. Die Grundpfeiler von FLOW3 Aspektorientierte Programmierung AOP ist ein Programmierparadigmaergnzt OOPOOP modularisiert concerns (Aufgabenbereiche): durch Pakete, Klassen, MethodenAOP: cross-cutting concernsInspiring people to FLOW3 - der aktuelle Stand share 53. Aspektorientierte Programmierung Cross-cutting concernsPresentationDomainData source Inspiring people to FLOW3 - der aktuelle Standshare 54. Aspektorientierte Programmierung Cross-cutting concernsPresentation The concerns live here DomainData sourceInspiring people to FLOW3 - der aktuelle Stand share 55. Aspektorientierte Programmierung Cross-cutting concernsDomain ModelDomain Model Domain Model SecurityLoggingCONCERNSX-INGInspiring people to FLOW3 - der aktuelle Standshare 56. Aspektorientierte Programmierung PHPs fehlende FunktionalittMit AOP kann man: alle cross-cutting concerns zentralisieren und sauber separieren beliebige Methodenaufrufe abfangen neue Funktionalitt zu Code hinzufgen, ohne diesen zu verndern ... viele weitere Tricks anwendenInspiring people to FLOW3 - der aktuelle Stand share 57. Aspektorientierte Programmierung Exkurs: Das Security-FrameworkPresentation $customer->setName(...)changeCustomerActionSecurity Framework DomainCustomer Data sourceTouchless Security! Inspiring people to FLOW3 - der aktuelle Standshare 58. FLOW3-Module AOPLocaleReectionObject Log ResourceConguration MVC SessionCachePackage UtilityErrorPersistence ValidationEventProperty... und mehr Inspiring people to FLOW3 - der aktuelle Standshare 59. DomainDrivenDesign http://www.sxc.hu/photo/585791 60. Domain Driven Design Domne = Aktivitt oder Geschft des BenutzersEs geht um... den Fokus auf die Domne, und die Logik der Domne die genaue Abbildung der Domnenregeln in Software das Schaffen einer universellen Sprache (Ubiquitous language) zwischen denProjektmitgliedernInspiring people to FLOW3 - der aktuelle Stand share 61. Der Turm zu Babel 62. Domain Driven Design Ubiquitous languageGemeinsames Vokabular ist eine wichtige Grundvoraussetzung, um miteinander zuarbeiten Benutze die selben Wrter fr Diskussion, Modellierung, Entwicklung undDokumentationInspiring people to FLOW3 - der aktuelle Standshare 63. Domain Driven Design Beispiel: Phone BookInspiring people to FLOW3 - der aktuelle Stand share 64. Domain Driven Design Beispiel: Phone Book showEntries() checkIfUserCanDeleteEntry() exportPhoneBook() logChanges() Inspiring people to FLOW3 - der aktuelle Standshare 65. Domain Driven Design Beispiel: Phone Book Nicht in dershowEntries() PhoneBook-checkIfUserCanDeleteEntry() exportPhoneBook()Domne!logChanges() Inspiring people to FLOW3 - der aktuelle Standshare 66. Domain Driven Design Schichtenarchitektur PresentationDomainData source Inspiring people to FLOW3 - der aktuelle Standshare 67. Domain Driven Design Schichtenarchitektur ViewPresentationController Application Logic (Service Layer) DomainDomain Model (Domain Layer) Data Mapper (part of Content Repository)Data sourceData Source Abstraction Inspiring people to FLOW3 - der aktuelle Standshare 68. Domain Driven Design Schichtenarchitektur ViewPresentationController Application Logic (Service Layer) DomainDomain Model (Domain Layer) Data Mapper (part of Content Repository)Data sourceData Source Abstraction Inspiring people to FLOW3 - der aktuelle Standshare 69. Model View ControllerInspiring people to FLOW3 - der aktuelle Stand share 70. MVC Model Objekt, welches Daten und Geschftslogik einer bestimmten Domne enthltenthlt keine Informationen ber die Darstellung der Daten, sondern deniert das Verhaltenin FLOW3 nutzen wir Domain ModelsInspiring people to FLOW3 - der aktuelle Stand share 71. MVC View Darstellung des Models im Web oder in anderen AusgabemedienStellen nur Daten dar, verndern diese nicht. Inspiring people to FLOW3 - der aktuelle Standshare 72. MVC Controller Reagiert auf BenutzereingabenWhlt das Model und verndert dieses wie bentigtWhlt den View aus und gibt diesem die Daten, die er rendern sollDer Standard-Controller fr FLOW3 ist der ActionController Inspiring people to FLOW3 - der aktuelle Standshare 73. MVC und DDD mit FLOW3 Inspiring people to FLOW3 - der aktuelle Standshare 74. DEMOInspiring people to FLOW3 - der aktuelle Standshare 75. MVC und DDD mit FLOW3 DateistrukturInspiring people to FLOW3 - der aktuelle Stand share 76. MVC und DDD mit FLOW3 Domain ModelInspiring people to FLOW3 - der aktuelle Stand share 77. MVC und DDD mit FLOW3 Domain ModelInspiring people to FLOW3 - der aktuelle Stand share 78. MVC und DDD mit FLOW3 Domain ModelInspiring people to FLOW3 - der aktuelle Stand share 79. MVC und DDD mit FLOW3 Domain ModelInspiring people to FLOW3 - der aktuelle Stand share 80. MVC und DDD mit FLOW3 Domain ModelInspiring people to FLOW3 - der aktuelle Stand share 81. MVC und DDD mit FLOW3 Aber - Persistenz?durch einen Persistence Manager werden Objekte gespeichert Transparent fr den Programmierer Inspiring people to FLOW3 - der aktuelle Standshare 82. MVC und DDD mit FLOW3 Aber - Persistenz? AnwendungAnwendungPersistence ManagerJSR-283 Content RepositoryPDO...MySQL Postgres SQLite Inspiring people to FLOW3 - der aktuelle Standshare 83. DEMOInspiring people to FLOW3 - der aktuelle Standshare 84. MVC und DDD mit FLOW3 ControllerNormal: Erben von F3FLOW3MVCControllerActionControllerpublic function indexAction() { // ... } public function listAction() { // ... }Inspiring people to FLOW3 - der aktuelle Stand share 85. MVC und DDD mit FLOW3 Controller-ArgumenteJedes Argument muss explizit deklariert werden Zugriff auf $_GET, $_POST ist nicht erlaubt und wird abgefangen! Inspiring people to FLOW3 - der aktuelle Standshare 86. MVC und DDD mit FLOW3 Controller-Argumente ArgumentregistrierungArgument-Mapping von einfachen Argumentenwird noch schner!public function initializeArguments() {$this->arguments->addNewArgument(tag, Text);}public function listByTagAction() {$tag = $this->arguments[tag]->getValue();// $tag ist ein String!}Inspiring people to FLOW3 - der aktuelle Stand share 87. MVC und DDD mit FLOW3 Controller-ArgumenteArgument-Mapping von einfachen Argumentenpublic function initializeArguments() {$this->arguments->addNewArgument(tag, UUID);}public function listByTagAction() {$tag = $this->arguments[tag]->getValue();// $tag ist eine UUID!} Inspiring people to FLOW3 - der aktuelle Standshare 88. MVC und DDD mit FLOW3Controller-Argumente Argument-Mapping von komplexen Argumenten public function initializeArguments() { $this->arguments->addNewArgument(comment, F3BlogDomainComment); } public function addNewCommentAction() { $comment = $this->arguments[comment]->getValue(); // $comment ist ein Comment-Objekt! } Inspiring people toFLOW3 - der aktuelle Stand share 89. MVC und DDD mit FLOW3 View... ist eine PHP-Klasse, welche von F3FLOW3MVCViewAbstractView erbt es gibt Standardklassen fr marker-basierte Views, Smarty-basierte Views, und... Fluid!Inspiring people to FLOW3 - der aktuelle Stand share 90. Fluid - The Zen of TemplatingInspiring people to FLOW3 - der aktuelle Stand share 91. Inhalt Test DrivenTYPO3 - Einfhrung DevelopmentDependency FLOW3InjectionAspektorientierte Programmierung Fluid - The Zen of TemplatingDomain Driven Synergien TYPO3 v4 und v5 Design & MVCInspiring people to FLOW3 - der aktuelle Standshare 92. Fluid Was ist eine Template-Engine? bernimmt die Darstellung von Datenlebt in der View-KomponenteBekannte EnginesSmarty*TALVelocityDesigner schreiben kein PHP, sondern HTMLInspiring people to FLOW3 - der aktuelle Standshare 93. Source: http://en.wikipedia.org/wiki/Template_engine_(web)Inspiring people to FLOW3 - der aktuelle Standshare 94. Fluid Nachteile existierender Template Engines nicht komplett OOP / brechen OOP-Paradigmen an einigen Stellenschwierig fr nicht-HTML-basierte Templates nutzbarkeine Autovervollstndigung in Editorennicht einfach erweiterbarInspiring people to FLOW3 - der aktuelle Stand share 95. The Zen ofTemplatingsimpel mchtig http://www.sxc.hu/photo/821903 96. The Zen of Templatingintuitiv einfach erlernbarhttp://www.sxc.hu/photo/821903 97. Einfachheit ist die ultimative Vollkommenheit.Leonardo Da Vinci Inspiring people to FLOW3 - der aktuelle Standshare 98. Einfachheit ist die ultimative Vollkommenheit.Leonardo Da Vinci Inspiring people to FLOW3 - der aktuelle Standshare 99. Fluid Ziel Einfache, elegante Template Enginevielfltige Untersttzung fr den Template-Schreibereinfache und saubere Erweiterbarkeitvielerlei Ausgabemedien mglichInspiring people to FLOW3 - der aktuelle Stand share 100. Fluid Grundkonzepte Namespace- Ausgabelogik ist in View Helpers (Tags) gekapselt Deklaration {namespace f3=F3FluidViewHelpers} Administrationsoberche Aufruf einesTags Fluid Core enthlt keine Ausgabelogik!Inspiring people to FLOW3 - der aktuelle Stand share 101. &