modular application architecture - qafoo · confoo.ca 2012 tobias schlitt (@tobysen) march 2nd 2012...
TRANSCRIPT
![Page 1: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/1.jpg)
Modular Application ArchitectureConfoo.ca 2012
Tobias Schlitt (@tobySen)
March 2nd 2012
Modular Application Architecture 1 / 43
![Page 2: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/2.jpg)
About me
I Degree in computer sienceI More than 10 years of professional PHPI Open source enthusiastsI Contributing to various FLOSS projects
Modular Application Architecture 2 / 43
![Page 3: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/3.jpg)
About me
I Degree in computer sienceI More than 10 years of professional PHPI Open source enthusiastsI Contributing to various FLOSS projects
Modular Application Architecture 2 / 43
![Page 4: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/4.jpg)
About me
I Degree in computer sienceI More than 10 years of professional PHPI Open source enthusiastsI Contributing to various FLOSS projects
Modular Application Architecture 2 / 43
![Page 5: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/5.jpg)
Co-founder of
Qafoopassion for software quality
Modular Application Architecture 3 / 43
![Page 6: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/6.jpg)
Co-founder of
Qafoopassion for software quality
Helping people to create high quality web applications.
Modular Application Architecture 3 / 43
![Page 7: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/7.jpg)
Co-founder of
Qafoopassion for software quality
Helping people to create high quality web applications.
I Expert consultingI Individual trainingI . . .
I Software architectureI OO designI Quality assuranceI . . .
Modular Application Architecture 3 / 43
![Page 8: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/8.jpg)
Co-founder of
Qafoopassion for software quality
Helping people to create high quality web applications.
I Expert consultingI Individual trainingI . . .
I Software architectureI OO designI Quality assuranceI . . .
Modular Application Architecture 3 / 43
![Page 9: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/9.jpg)
Co-founder of
Qafoopassion for software quality
Helping people to create high quality web applications.
I Expert consultingI Individual trainingI . . .
I Software architectureI OO designI Quality assuranceI . . .
http://qafoo.com
Modular Application Architecture 3 / 43
![Page 10: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/10.jpg)
Outline
Motivation
Resources
Approaches
Real world
Summary
Modular Application Architecture 4 / 43
![Page 11: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/11.jpg)
Application
Application
Component Component Component
Modular Application Architecture 5 / 43
![Page 12: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/12.jpg)
Modules
Application
Component Component Component
Module Module Module Module Module
Modular Application Architecture 6 / 43
![Page 13: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/13.jpg)
Why modules?
I Need for customizationI Custom setup for customersI 3rd party extensions
I Develop modules seperately from main applicationI External developersI Seperate release cycles
I Slag the main applicationI Raise maintainability
Modular Application Architecture 7 / 43
![Page 14: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/14.jpg)
Why modules?
I Need for customizationI Custom setup for customersI 3rd party extensions
I Develop modules seperately from main applicationI External developersI Seperate release cycles
I Slag the main applicationI Raise maintainability
Modular Application Architecture 7 / 43
![Page 15: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/15.jpg)
Why modules?
I Need for customizationI Custom setup for customersI 3rd party extensions
I Develop modules seperately from main applicationI External developersI Seperate release cycles
I Slag the main applicationI Raise maintainability
Modular Application Architecture 7 / 43
![Page 16: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/16.jpg)
Essential
Modular Application Architecture 8 / 43
![Page 17: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/17.jpg)
Challenges
I Module structureI Registration / configurationI Handling ressourcesI Interaction with core
Modular Application Architecture 9 / 43
![Page 18: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/18.jpg)
Challenges
I Module structure XI Registration / configurationI Handling ressourcesI Interaction with core
Modular Application Architecture 9 / 43
![Page 19: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/19.jpg)
Challenges
I Module structure XI Registration / configuration XI Handling ressourcesI Interaction with core
Modular Application Architecture 9 / 43
![Page 20: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/20.jpg)
Challenges
I Module structure XI Registration / configuration XI Handling ressources −→I Interaction with core
Modular Application Architecture 9 / 43
![Page 21: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/21.jpg)
Challenges
I Module structure XI Registration / configuration XI Handling ressources −→I Interaction with core =⇒
Modular Application Architecture 9 / 43
![Page 22: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/22.jpg)
Outline
Motivation
Resources
Approaches
Real world
Summary
Modular Application Architecture 10 / 43
![Page 23: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/23.jpg)
Dealing with resources
I Typical module resourcesI TemplatesI TranslationsI ImagesI CSS
I Resources handled by code are “easy”I Register “overrides“
I Static file resources are notI Put modules in a web accessible path?I Copy / link static files to htdocs/?I Pipe static files through PHP?I Webserver configuration?
Modular Application Architecture 11 / 43
![Page 24: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/24.jpg)
Dealing with resources
I Typical module resourcesI TemplatesI TranslationsI ImagesI CSS
I Resources handled by code are “easy”I Register “overrides“
I Static file resources are notI Put modules in a web accessible path?I Copy / link static files to htdocs/?I Pipe static files through PHP?I Webserver configuration?
Modular Application Architecture 11 / 43
![Page 25: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/25.jpg)
Dealing with resources
I Typical module resourcesI TemplatesI TranslationsI ImagesI CSS
I Resources handled by code are “easy”I Register “overrides“
I Static file resources are notI Put modules in a web accessible path?I Copy / link static files to htdocs/?I Pipe static files through PHP?I Webserver configuration?
Modular Application Architecture 11 / 43
![Page 26: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/26.jpg)
Outline
Motivation
Resources
Approaches
Real world
Summary
Modular Application Architecture 12 / 43
![Page 27: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/27.jpg)
Outline
ApproachesEvent handlingData handling
Modular Application Architecture 13 / 43
![Page 28: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/28.jpg)
Event handling
I InteractionI Modules register for event typesI Events “fired” (by core or
module)I Registered modules informedI Maybe including dataI Optionally transparent
Application
Module
Module
Module
Event
Modular Application Architecture 14 / 43
![Page 29: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/29.jpg)
Event handling
I InteractionI Modules register for event typesI Events “fired” (by core or
module)I Registered modules informedI Maybe including dataI Optionally transparent
Application
Module
Module
Module
Event
Modular Application Architecture 14 / 43
![Page 30: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/30.jpg)
Event handling
I InteractionI Modules register for event typesI Events “fired” (by core or
module)I Registered modules informedI Maybe including dataI Optionally transparent
Application
Module
Module
Module
Event
Modular Application Architecture 14 / 43
![Page 31: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/31.jpg)
Event handling
I InteractionI Modules register for event typesI Events “fired” (by core or
module)I Registered modules informedI Maybe including dataI Optionally transparent
Application
Module
Module
Module
Event
Modular Application Architecture 14 / 43
![Page 32: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/32.jpg)
Event handling
I InteractionI Modules register for event typesI Events “fired” (by core or
module)I Registered modules informedI Maybe including dataI Optionally transparent
Application
Module
Module
Module
Event
Modular Application Architecture 14 / 43
![Page 33: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/33.jpg)
Subject-Observer
1 <?php23 class Subject4 {
5 public function doSomething ( )6 {
7 $ th is −>n o t i f y ( ’ doSomethingStart ’ ) ;8 / / . . .9 $ th i s −>n o t i f y ( ’ doSomethingEnd ’ ) ;
10 }
11 }
Modular Application Architecture 15 / 43
![Page 34: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/34.jpg)
Subject-Observer
1 <?php23 class Subject4 {
5 protected $observers = ar ray ( ) ;67 public function addObserver ( Observer $observer )8 {
9 $ th is −>observers [ ] = $observer ;10 }
1112 public function n o t i f y ( $event , $data = nul l )13 {
14 foreach ( $ th i s −>observers as $observer )15 {
16 $observer−>$event ( $data ) ;17 }
18 }
1920 public function doSomething ( )21 {
22 $ th is −>n o t i f y ( ’ doSomethingStart ’ ) ;23 / / . . .24 $ th is −>n o t i f y ( ’ doSomethingEnd ’ ) ;25 }
26 }
Modular Application Architecture 16 / 43
![Page 35: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/35.jpg)
Subject-Observer
1 <?php23 class Subject4 {
5 protected $observers = ar ray ( ) ;67 public function addObserver ( Observer $observer )8 {
9 $ th is −>observers [ ] = $observer ;10 }
1112 public function n o t i f y ( $event , $data = nul l )13 {
14 foreach ( $ th i s −>observers as $observer )15 {
16 $observer−>$event ( $data ) ;17 }
18 }
1920 public function doSomething ( )21 {
22 $ th is −>n o t i f y ( ’ doSomethingStart ’ ) ;23 / / . . .24 $ th is −>n o t i f y ( ’ doSomethingEnd ’ ) ;25 }
26 }
Modular Application Architecture 16 / 43
![Page 36: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/36.jpg)
Subject-Observer
1 <?php
3 class Observer4 {
5 public function doSomethingStart ( )6 {
7 / / . . .8 }
910 public function doSomethingEnd ( )11 {
12 / / . . .13 }
14 }
Modular Application Architecture 17 / 43
![Page 37: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/37.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 38: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/38.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 39: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/39.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 40: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/40.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 41: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/41.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 42: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/42.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 43: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/43.jpg)
Pro & Contra
I Benefits:I Transparent – any number of observers can registerI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structs
I Drawbacks:I Fully transparent – you have no idea how long a singal will
take to processI Limited to defined extension pointsI Requires implementation in each subject
Modular Application Architecture 18 / 43
![Page 44: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/44.jpg)
Signal slot
1 <?php23 $handler = new S igna lS lo t ( ) ;45 $handler−> r e g i s t e r (6 ’ UserLoggedIn ’ ,7 ar ray ( new LoginCounterModule ( ) , ’ handleUserLoggedIn ’ )8 ) ;9 $handler−> r e g i s t e r (
10 ’ UserLoggedIn ’ ,11 ar ray ( new OnlineUsersModule ( ) , ’ updatedUserLis t ’ )12 ) ;1314 / / In l o g i n process15 $handler−>emit (16 ’ UserLoggedIn ’ ,17 new UserLoggedInData ( /∗ . . . ∗ / )18 ) ;
Modular Application Architecture 19 / 43
![Page 45: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/45.jpg)
Signal slot
1 <?php23 $handler = new S igna lS lo t ( ) ;45 $handler−> r e g i s t e r (6 ’ UserLoggedIn ’ ,7 ar ray ( new LoginCounterModule ( ) , ’ handleUserLoggedIn ’ )8 ) ;9 $handler−> r e g i s t e r (
10 ’ UserLoggedIn ’ ,11 ar ray ( new OnlineUsersModule ( ) , ’ updatedUserLis t ’ )12 ) ;1314 / / In l o g i n process15 $handler−>emit (16 ’ UserLoggedIn ’ ,17 new UserLoggedInData ( /∗ . . . ∗ / )18 ) ;
Modular Application Architecture 19 / 43
![Page 46: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/46.jpg)
Signal slot
1 <?php23 $handler = new S igna lS lo t ( ) ;45 $handler−> r e g i s t e r (6 ’ UserLoggedIn ’ ,7 ar ray ( new LoginCounterModule ( ) , ’ handleUserLoggedIn ’ )8 ) ;9 $handler−> r e g i s t e r (
10 ’ UserLoggedIn ’ ,11 ar ray ( new OnlineUsersModule ( ) , ’ updatedUserLis t ’ )12 ) ;1314 / / In l o g i n process15 $handler−>emit (16 ’ UserLoggedIn ’ ,17 new UserLoggedInData ( /∗ . . . ∗ / )18 ) ;
Modular Application Architecture 19 / 43
![Page 47: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/47.jpg)
Signal slot
1 <?php23 $handler = new S igna lS lo t ( ) ;45 $handler−> r e g i s t e r (6 ’ UserLoggedIn ’ ,7 ar ray ( new LoginCounterModule ( ) , ’ handleUserLoggedIn ’ )8 ) ;9 $handler−> r e g i s t e r (
10 ’ UserLoggedIn ’ ,11 ar ray ( new OnlineUsersModule ( ) , ’ updatedUserLis t ’ )12 ) ;1314 / / In l o g i n process15 $handler−>emit (16 ’ UserLoggedIn ’ ,17 new UserLoggedInData ( /∗ . . . ∗ / )18 ) ;
Modular Application Architecture 19 / 43
![Page 48: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/48.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 49: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/49.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 50: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/50.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 51: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/51.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 52: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/52.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 53: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/53.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 54: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/54.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 55: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/55.jpg)
Pro & Contra
I Benefits:I Fully transparent – nobody needs to know who is calledI (Documented) clearly defined extension APII . . . optionally with clearly defined transmitted data structsI Can easily be made asynchronous
I Drawbacks:I Fully transparent – you have no idea how long a signal will
take to processI Limited to defined extension pointsI Signal-Slot handler needs to be injected
Modular Application Architecture 20 / 43
![Page 56: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/56.jpg)
Outline
ApproachesEvent handlingData handling
Modular Application Architecture 21 / 43
![Page 57: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/57.jpg)
Data handling
I Data processingI Pipes
I Transport dataI Filters
I Manipulate data
Filter 3
Filter 2
Filter 1
Data
Data
Pipe
Pipe
Modular Application Architecture 22 / 43
![Page 58: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/58.jpg)
Data handling
I Data processingI Pipes
I Transport dataI Filters
I Manipulate data
Filter 3
Filter 2
Filter 1
Data
Data
Pipe
Pipe
Modular Application Architecture 22 / 43
![Page 59: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/59.jpg)
Data handling
I Data processingI Pipes
I Transport dataI Filters
I Manipulate data
Filter 3
Filter 2
Filter 1
Data
Data
Pipe
Pipe
Modular Application Architecture 22 / 43
![Page 60: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/60.jpg)
Popoon
1 <?xml version= ” 1.0 ” ?>23 <sitemap xmlns= ” h t t p : / / apache . org / cocoon / sitemap / 1 . 0 ”>45 <p i p e l i n e s>67 <p i p e l i n e>8 <match type= ” u r i ” pa t t e rn = ” examples . tgz ”>9 <read type= ” tgz ” src= ” . ” name= ” examples . tgz ” />
10 < / match>11 < / p i p e l i n e>1213 <p i p e l i n e >14 <generate type= ” x m l f i l e ” s rc= ” examples . xml ” />15 < t rans form type= ” l i b x s l t ” s rc= ” examples . x s l ” />16 < s e r i a l i z e type= ” html ” />17 < / p i p e l i n e>1819 < / p i p e l i n e s>2021 < / sitemap>
Modular Application Architecture 23 / 43
![Page 61: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/61.jpg)
Popoon
1 <?xml version= ” 1.0 ” ?>23 <sitemap xmlns= ” h t t p : / / apache . org / cocoon / sitemap / 1 . 0 ”>45 <p i p e l i n e s>67 <p i p e l i n e>8 <match type= ” u r i ” pa t t e rn = ” examples . tgz ”>9 <read type= ” tgz ” src= ” . ” name= ” examples . tgz ” />
10 < / match>11 < / p i p e l i n e>1213 <p i p e l i n e >14 <generate type= ” x m l f i l e ” s rc= ” examples . xml ” />15 < t rans form type= ” l i b x s l t ” s rc= ” examples . x s l ” />16 < s e r i a l i z e type= ” html ” />17 < / p i p e l i n e>1819 < / p i p e l i n e s>2021 < / sitemap>
Modular Application Architecture 23 / 43
![Page 62: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/62.jpg)
Popoon
1 <?xml version= ” 1.0 ” ?>23 <sitemap xmlns= ” h t t p : / / apache . org / cocoon / sitemap / 1 . 0 ”>45 <p i p e l i n e s>67 <p i p e l i n e>8 <match type= ” u r i ” pa t t e rn = ” examples . tgz ”>9 <read type= ” tgz ” src= ” . ” name= ” examples . tgz ” />
10 < / match>11 < / p i p e l i n e>1213 <p i p e l i n e >14 <generate type= ” x m l f i l e ” s rc= ” examples . xml ” />15 < t rans form type= ” l i b x s l t ” s rc= ” examples . x s l ” />16 < s e r i a l i z e type= ” html ” />17 < / p i p e l i n e>1819 < / p i p e l i n e s>2021 < / sitemap>
Modular Application Architecture 23 / 43
![Page 63: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/63.jpg)
Popoon
1 <?xml version= ” 1.0 ” ?>23 <sitemap xmlns= ” h t t p : / / apache . org / cocoon / sitemap / 1 . 0 ”>45 <p i p e l i n e s>67 <p i p e l i n e>8 <match type= ” u r i ” pa t t e rn = ” examples . tgz ”>9 <read type= ” tgz ” src= ” . ” name= ” examples . tgz ” />
10 < / match>11 < / p i p e l i n e>1213 <p i p e l i n e >14 <generate type= ” x m l f i l e ” s rc= ” examples . xml ” />15 < t rans form type= ” l i b x s l t ” s rc= ” examples . x s l ” />16 < s e r i a l i z e type= ” html ” />17 < / p i p e l i n e>1819 < / p i p e l i n e s>2021 < / sitemap>
Modular Application Architecture 23 / 43
![Page 64: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/64.jpg)
Popoon
1 <?xml version= ” 1.0 ” ?>23 <sitemap xmlns= ” h t t p : / / apache . org / cocoon / sitemap / 1 . 0 ”>45 <p i p e l i n e s>67 <p i p e l i n e>8 <match type= ” u r i ” pa t t e rn = ” examples . tgz ”>9 <read type= ” tgz ” src= ” . ” name= ” examples . tgz ” />
10 < / match>11 < / p i p e l i n e>1213 <p i p e l i n e >14 <generate type= ” x m l f i l e ” s rc= ” examples . xml ” />15 < t rans form type= ” l i b x s l t ” s rc= ” examples . x s l ” />16 < s e r i a l i z e type= ” html ” />17 < / p i p e l i n e>1819 < / p i p e l i n e s>2021 < / sitemap>
Modular Application Architecture 23 / 43
![Page 65: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/65.jpg)
Pro & Contra
I Benefits:I Clean architectural approachI Might gain high re-usability
I Drawbacks:I Filters might break data easilyI Somewhat forces linear code flow
Modular Application Architecture 24 / 43
![Page 66: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/66.jpg)
Pro & Contra
I Benefits:I Clean architectural approachI Might gain high re-usability
I Drawbacks:I Filters might break data easilyI Somewhat forces linear code flow
Modular Application Architecture 24 / 43
![Page 67: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/67.jpg)
Pro & Contra
I Benefits:I Clean architectural approachI Might gain high re-usability
I Drawbacks:I Filters might break data easilyI Somewhat forces linear code flow
Modular Application Architecture 24 / 43
![Page 68: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/68.jpg)
Pro & Contra
I Benefits:I Clean architectural approachI Might gain high re-usability
I Drawbacks:I Filters might break data easilyI Somewhat forces linear code flow
Modular Application Architecture 24 / 43
![Page 69: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/69.jpg)
Pro & Contra
I Benefits:I Clean architectural approachI Might gain high re-usability
I Drawbacks:I Filters might break data easilyI Somewhat forces linear code flow
Modular Application Architecture 24 / 43
![Page 70: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/70.jpg)
Outline
Motivation
Resources
Approaches
Real world
Summary
Modular Application Architecture 25 / 43
![Page 71: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/71.jpg)
Outline
Real worldHooksPatchingInheritance
Modular Application Architecture 26 / 43
![Page 72: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/72.jpg)
Serendipity hook announcement
1 <?php23 / / . . . i n CSS render ing code . . .45 / / $out i s CSS s t r i n g6 s e r e n d i p i t y p l u g i n a p i : : hook event ( ’ css ’ , $out ) ;78 echo $out ;
Modular Application Architecture 27 / 43
![Page 73: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/73.jpg)
Serendipity hook announcement
1 <?php23 / / . . . i n CSS render ing code . . .45 / / $out i s CSS s t r i n g6 s e r e n d i p i t y p l u g i n a p i : : hook event ( ’ css ’ , $out ) ;78 echo $out ;
Modular Application Architecture 27 / 43
![Page 74: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/74.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 75: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/75.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 76: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/76.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 77: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/77.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 78: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/78.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 79: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/79.jpg)
Serendipity hook reaction
1 class serend ip i t y even t bbcode extends s e r e n d i p i t y e v e n t2 {
3 function event hook ( $event , &$bag , &$eventData ) {4 switch ( $event ) {5 case ’ css ’ :6 i f ( s t rpos ( $eventData , ’ . bb−code ’ ) !== fa lse ) {7 / / c lass e x i s t s i n CSS . . .8 return true ;9 }
10 ?>11 . bb−quote , . bb−code , . bb−php , . bb−code− t i t l e , . bb−php− t i t l e {
12 margin− l e f t : 20px ;13 margin− r i g h t : 20px ;14 /∗ . . . ∗ /15 }
16 /∗ . . . ∗ /17 <?php18 return true ;19 break ;2021 defaul t :22 return fa lse ;23 }
24 }
25 }
Modular Application Architecture 28 / 43
![Page 80: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/80.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 81: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/81.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 82: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/82.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 83: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/83.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 84: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/84.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 85: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/85.jpg)
Pro & Contra
I Benefits:I High flexibilityI Low coding efforts
I Drawbacks:I Plugin can easily break hook dataI No defined data formatsI “Liskov substitution principle” limits what you are allowed to do
Modular Application Architecture 29 / 43
![Page 86: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/86.jpg)
Outline
Real worldHooksPatchingInheritance
Modular Application Architecture 30 / 43
![Page 87: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/87.jpg)
Patching the source
I The naive approachI Works suprisingly well
I For some of the largest module ecosystemsI phpBB
Modular Application Architecture 31 / 43
![Page 88: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/88.jpg)
Patching the source
I The naive approachI Works suprisingly well
I For some of the largest module ecosystemsI phpBB
Modular Application Architecture 31 / 43
![Page 89: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/89.jpg)
phpBB MODx format
1 <?xml version= ” 1.0 ” encoding= ” u t f −8” standalone= ” yes ” ?>2 < !−− . . . −−>3 <mod xmlns= ” h t t p : / /www. phpbb . com/ mods / xml / modx−1 .2 .0 . xsd ”>4 <header>< !−− . . . −−>< / header>5 < !−− . . . −−>6 <open src= ” index . php ”>7 <e d i t>8 <comment lang= ” en ”>Here i s a comment< / comment>9 <comment lang= ” n l ”>Hier i s een s t u k j e commentaar< / comment>
10 < f i n d> t e x t to f i n d< / f i n d>11 <ac t i on type= ” replace−wi th ”> t e x t to be replaced wi th< / ac t i on>12 < / e d i t>13 <e d i t>14 < f i n d> t e x t to f i n d< / f i n d>15 <ac t i on type= ” a f t e r −add ”> t e x t to be added on the l i n e a f t e r< / ac t i on>16 < / e d i t>17 < !−− . . . −−>18 < / open>19 < !−− . . . −−>20 < /mod>
Modular Application Architecture 32 / 43
![Page 90: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/90.jpg)
phpBB MODx format
1 <?xml version= ” 1.0 ” encoding= ” u t f −8” standalone= ” yes ” ?>2 < !−− . . . −−>3 <mod xmlns= ” h t t p : / /www. phpbb . com/ mods / xml / modx−1 .2 .0 . xsd ”>4 <header>< !−− . . . −−>< / header>5 < !−− . . . −−>6 <open src= ” index . php ”>7 <e d i t>8 <comment lang= ” en ”>Here i s a comment< / comment>9 <comment lang= ” n l ”>Hier i s een s t u k j e commentaar< / comment>
10 < f i n d> t e x t to f i n d< / f i n d>11 <ac t i on type= ” replace−wi th ”> t e x t to be replaced wi th< / ac t i on>12 < / e d i t>13 <e d i t>14 < f i n d> t e x t to f i n d< / f i n d>15 <ac t i on type= ” a f t e r −add ”> t e x t to be added on the l i n e a f t e r< / ac t i on>16 < / e d i t>17 < !−− . . . −−>18 < / open>19 < !−− . . . −−>20 < /mod>
Modular Application Architecture 32 / 43
![Page 91: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/91.jpg)
phpBB MODx format
1 <?xml version= ” 1.0 ” encoding= ” u t f −8” standalone= ” yes ” ?>2 < !−− . . . −−>3 <mod xmlns= ” h t t p : / /www. phpbb . com/ mods / xml / modx−1 .2 .0 . xsd ”>4 <header>< !−− . . . −−>< / header>5 < !−− . . . −−>6 <open src= ” index . php ”>7 <e d i t>8 <comment lang= ” en ”>Here i s a comment< / comment>9 <comment lang= ” n l ”>Hier i s een s t u k j e commentaar< / comment>
10 < f i n d> t e x t to f i n d< / f i n d>11 <ac t i on type= ” replace−wi th ”> t e x t to be replaced wi th< / ac t i on>12 < / e d i t>13 <e d i t>14 < f i n d> t e x t to f i n d< / f i n d>15 <ac t i on type= ” a f t e r −add ”> t e x t to be added on the l i n e a f t e r< / ac t i on>16 < / e d i t>17 < !−− . . . −−>18 < / open>19 < !−− . . . −−>20 < /mod>
Modular Application Architecture 32 / 43
![Page 92: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/92.jpg)
phpBB MODx format
1 <?xml version= ” 1.0 ” encoding= ” u t f −8” standalone= ” yes ” ?>2 < !−− . . . −−>3 <mod xmlns= ” h t t p : / /www. phpbb . com/ mods / xml / modx−1 .2 .0 . xsd ”>4 <header>< !−− . . . −−>< / header>5 < !−− . . . −−>6 <open src= ” index . php ”>7 <e d i t>8 <comment lang= ” en ”>Here i s a comment< / comment>9 <comment lang= ” n l ”>Hier i s een s t u k j e commentaar< / comment>
10 < f i n d> t e x t to f i n d< / f i n d>11 <ac t i on type= ” replace−wi th ”> t e x t to be replaced wi th< / ac t i on>12 < / e d i t>13 <e d i t>14 < f i n d> t e x t to f i n d< / f i n d>15 <ac t i on type= ” a f t e r −add ”> t e x t to be added on the l i n e a f t e r< / ac t i on>16 < / e d i t>17 < !−− . . . −−>18 < / open>19 < !−− . . . −−>20 < /mod>
Modular Application Architecture 32 / 43
![Page 93: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/93.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 94: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/94.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 95: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/95.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 96: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/96.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 97: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/97.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 98: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/98.jpg)
Pro & Contra
I Benefits:I Trivial to get started with (high “hackability”)I You can change anything
I Drawbacks:I Will definitely breakI Can lead to unparsable codeI Complex modules require deep knowledge
Modular Application Architecture 33 / 43
![Page 99: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/99.jpg)
Outline
Real worldHooksPatchingInheritance
Modular Application Architecture 34 / 43
![Page 100: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/100.jpg)
Inheritance
I Generally:I Use Aggregation for code re-useI Not inheritance!
I Oxid eSales (OS shop software)I Interesting extension modelI Built entirely on inheritanceI Each module can inherit from “any” classI Each inheriting class will be used everywhereI How can that be possible?
Modular Application Architecture 35 / 43
![Page 101: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/101.jpg)
Inheritance
I Generally:I Use Aggregation for code re-useI Not inheritance!
I Oxid eSales (OS shop software)I Interesting extension modelI Built entirely on inheritanceI Each module can inherit from “any” classI Each inheriting class will be used everywhereI How can that be possible?
Modular Application Architecture 35 / 43
![Page 102: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/102.jpg)
Inheritance
I Generally:I Use Aggregation for code re-useI Not inheritance!
I Oxid eSales (OS shop software)I Interesting extension modelI Built entirely on inheritanceI Each module can inherit from “any” classI Each inheriting class will be used everywhereI How can that be possible?
Modular Application Architecture 35 / 43
![Page 103: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/103.jpg)
Inheritance
I Generally:I Use Aggregation for code re-useI Not inheritance!
I Oxid eSales (OS shop software)I Interesting extension modelI Built entirely on inheritanceI Each module can inherit from “any” classI Each inheriting class will be used everywhereI How can that be possible?
Modular Application Architecture 35 / 43
![Page 104: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/104.jpg)
Inheritance
I Generally:I Use Aggregation for code re-useI Not inheritance!
I Oxid eSales (OS shop software)I Interesting extension modelI Built entirely on inheritanceI Each module can inherit from “any” classI Each inheriting class will be used everywhereI How can that be possible?
Modular Application Architecture 35 / 43
![Page 105: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/105.jpg)
Modular inheritance
I oxnew("ClassName") instead of new ClassNameI Inheritance graph created on-the-flyI Generates intermediate classes
Modular Application Architecture 36 / 43
![Page 106: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/106.jpg)
Example
1 <?php23 class o x A r t i c l e4 {
5 public function c a l c u l a t e P r i c e ( )6 {
7 / / . . .8 }
9 }
1011 class myAr t i c le12 extends o x A r t i c l e13 {
14 / / . . .15 }
1617 class y o u r A r t i c l e18 extends o x A r t i c l e19 {
20 / / . . .21 }
oxArticle
myArticle
yourArticle
Modular Application Architecture 37 / 43
![Page 107: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/107.jpg)
Example
1 <?php23 class o x A r t i c l e4 {
5 public function c a l c u l a t e P r i c e ( )6 {
7 / / . . .8 }
9 }
1011 class myAr t i c le12 extends myAr t i c l e pa ren t13 {
14 / / . . .15 }
1617 class y o u r A r t i c l e18 extends y o u r A r t i c l e p a r e n t19 {
20 / / . . .21 }
oxArticle
myArticle
yourArticle
myArticle_p
yourArticle_p
Modular Application Architecture 38 / 43
![Page 108: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/108.jpg)
Example
1 <?php23 class o x A r t i c l e4 {
5 public function c a l c u l a t e P r i c e ( )6 {
7 / / . . .8 }
9 }
1011 class myAr t i c le12 extends myAr t i c l e pa ren t13 {
14 / / . . .15 }
1617 class y o u r A r t i c l e18 extends y o u r A r t i c l e p a r e n t19 {
20 / / . . .21 }
oxArticle
myArticle
yourArticle
myArticle_p
yourArticle_p
Modular Application Architecture 38 / 43
![Page 109: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/109.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 110: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/110.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 111: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/111.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 112: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/112.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 113: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/113.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 114: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/114.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 115: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/115.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 116: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/116.jpg)
Pro & Contra
I Benefits:I You can extend about everything. . .
I Drawbacks:I About everything will be extended. . .I You may not use the new operatorI Violates object-oriented design principlesI Non-enforcable constraints (parent::method())I Almost untestableI Everything becomes public API
Modular Application Architecture 39 / 43
![Page 117: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/117.jpg)
Outline
Motivation
Resources
Approaches
Real world
Summary
Modular Application Architecture 40 / 43
![Page 118: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/118.jpg)
Summary
I PatchingI HooksI Pipes & FiltersI InheritanceI Subject-ObserverI Signal-Slot
Modular Application Architecture 41 / 43
![Page 119: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/119.jpg)
Thanks for Listening
Questions? Comments? Critics? Ideas?Please rate this talk at
https://joind.in/6102
Modular Application Architecture 42 / 43
![Page 120: Modular Application Architecture - Qafoo · Confoo.ca 2012 Tobias Schlitt (@tobySen) March 2nd 2012 Modular Application Architecture 1 / 43. About me I Degree in computer sience I](https://reader031.vdocuments.us/reader031/viewer/2022011918/6006dcf42fd9616402658832/html5/thumbnails/120.jpg)
Thanks for Listening
Please rate this talk athttps://joind.in/6102
(Slides will be linked there)
Stay in touchI Tobias SchlittI [email protected] @tobySen / @qafoo
Rent a PHP quality expert:http://qafoo.com
Modular Application Architecture 43 / 43