Download - Writing extensible applications
![Page 1: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/1.jpg)
Presentation title here
Writing Extensible Applications
![Page 2: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/2.jpg)
Presentation title here
About meabout me…
Andrey Yatsenco
● PHP Developer at Oro Inc.● 3 years with Symfony ● 6 years with PHP
https://www.facebook.com/yatsencohttps://github.com/anyt
![Page 3: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/3.jpg)
Presentation title here
Writing Extensible Applications
Agenda● Definition● Common solutions● What Symfony offers
![Page 4: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/4.jpg)
Presentation title here
When applications should be extensible?
When you write:● a lot of similar apps● requirements change a lot● a lot of features in one app● open-source
![Page 5: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/5.jpg)
Presentation title here
provide for change (enhancements)● while minimizing impact to existing system
functions.● is a design principle where the
implementation takes future growth into consideration.
● extensions can be through the addition of new functionality or through modification of existing functionality
Extensibility
![Page 6: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/6.jpg)
Presentation title here
Extensible design is to accept that not everything can be designed in advance
![Page 7: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/7.jpg)
Presentation title here
Why code mustbe extensible?
![Page 8: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/8.jpg)
Presentation title here
Typical problems of not extensible apps
● Difficult to replace part of an app● Difficult to scale an application
![Page 9: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/9.jpg)
Presentation title here
Common solutions
● Abstractions and DI● Modular design● Extensions provider● Event-driven architecture
![Page 10: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/10.jpg)
Presentation title here
Common solutions
● Abstractions and DI● Modular design● Extensions provider● Event-driven architecture
![Page 11: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/11.jpg)
Presentation title here
Abstractions and DI
Abstractions: Dependency Injection:
![Page 12: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/12.jpg)
Presentation title here
Common solutions
● Abstractions and DI● Modular design● Extensions provider● Event-driven architecture
![Page 13: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/13.jpg)
Presentation title here
Modular design
Examples:● Symfony● ZF● Yii● Drupal● Joomla● Wordpress● etc.
Naming:● modules● bundles● packages● plugins● service providers● etc.
![Page 14: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/14.jpg)
Presentation title here
Modular design
Make your framework modular:● Symfony HttpKernel component (bundles)
![Page 15: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/15.jpg)
Presentation title here
Modular design
Separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
![Page 16: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/16.jpg)
Presentation title here
Modular design
Bad practices:● High Cohesion● Circular references
![Page 17: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/17.jpg)
Presentation title here
Modular design
Bad practices: How to avoid this?
![Page 18: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/18.jpg)
Presentation title here
Modular design
Bad practices:
How to avoid this?● Event-driven architecture
![Page 19: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/19.jpg)
Presentation title here
Event-driven architecture
● Observer● Mediator
![Page 20: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/20.jpg)
Presentation title here
Event-driven architecture
Observer:
![Page 21: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/21.jpg)
Presentation title here
Event-driven architecture
Mediator
![Page 22: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/22.jpg)
Presentation title here
Modular design
Bad practices:
How to avoid this?● Event-driven architecture● Providing extensions
![Page 23: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/23.jpg)
Presentation title here
Providing extensions
![Page 24: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/24.jpg)
Presentation title here
What Symfony offers?
● Bundles● Service container● Event dispatcher
![Page 25: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/25.jpg)
Presentation title here
What Symfony offers?
Service container● Dependency Injection
![Page 26: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/26.jpg)
Presentation title here
What Symfony offers?
Service container● Overriding classes of services with the
same dependencies with parameters
![Page 27: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/27.jpg)
Presentation title here
What Symfony offers?
Service container● Overriding services in compiler passes with
the same interface or by extending the original one in Compiler Passes
![Page 28: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/28.jpg)
Presentation title here
What Symfony offers?
Service container● Decorating services (new in Symfony 2.5)
![Page 29: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/29.jpg)
Presentation title here
What Symfony offers?
Service container● Providing bundle configuration
![Page 30: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/30.jpg)
Presentation title here
What Symfony offers?
Event dispatcher (mediator pattern)
![Page 31: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/31.jpg)
Presentation title here
What Symfony offers?
You still can provide extension.There is no out of the box solution, because you don’t need it. You can check examples:● Twig● Form
![Page 32: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/32.jpg)
Presentation title here
Conclusion
● Extensions helps you to make addition and modification of your application while minimizing impact to existing functionality.
![Page 33: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/33.jpg)
Presentation title here
Conclusion
Common solutions● Abstractions and DI● Modular design● Extensions provider● Event-driven architecture
![Page 34: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/34.jpg)
Presentation title here
Conclusion
Symfony offers● Bundles● Service container● Event dispatcher
![Page 35: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/35.jpg)
Presentation title here
P.S.
Ideal OO code not the answer, because of performance.You can scale your infrastructure, because it's cheaper than development in some situations but usually not for a long time.
![Page 36: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/36.jpg)
Presentation title here
References
● The Philosophy of Extensible Software● Github - PHP Design Patterns● Wikipedia - Extensibility● Wikipedia - List of software development philosophies● Wikipedia - SOLID● SO - Designing extensible software● Java Docs - Creating Extensible Applications● Symfony Books
![Page 37: Writing extensible applications](https://reader031.vdocument.in/reader031/viewer/2022021921/58f3883b1a28ab70778b4581/html5/thumbnails/37.jpg)
Presentation title here
?