Writing Extensible Applications

Writing Extensible Applications

How to make your application extensible using modular design, event-driven architecture and by providing extensions.

6d1d6c68fd6df4614c2f07b7ffa0a7b0?s=128

Andrey Yatsenco

February 12, 2016
Tweet

Transcript

  1. Presentation title here Writing Extensible Applications

  2. Presentation title here About me about me… Andrey Yatsenco •

    PHP Developer at Oro Inc. • 3 years with Symfony • 6 years with PHP https://www.facebook.com/yatsenco https://github.com/anyt
  3. Presentation title here Writing Extensible Applications Agenda • Definition •

    Common solutions • What Symfony offers
  4. 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
  5. 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
  6. Presentation title here Extensible design is to accept that not

    everything can be designed in advance
  7. Presentation title here Why code must be extensible?

  8. Presentation title here Typical problems of not extensible apps •

    Difficult to replace part of an app • Difficult to scale an application
  9. Presentation title here Common solutions • Abstractions and DI •

    Modular design • Extensions provider • Event-driven architecture
  10. Presentation title here Common solutions • Abstractions and DI •

    Modular design • Extensions provider • Event-driven architecture
  11. Presentation title here Abstractions and DI Abstractions: Dependency Injection:

  12. Presentation title here Common solutions • Abstractions and DI •

    Modular design • Extensions provider • Event-driven architecture
  13. Presentation title here Modular design Examples: • Symfony • ZF

    • Yii • Drupal • Joomla • Wordpress • etc. Naming: • modules • bundles • packages • plugins • service providers • etc.
  14. Presentation title here Modular design Make your framework modular: •

    Symfony HttpKernel component (bundles)
  15. 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.
  16. Presentation title here Modular design Bad practices: • High Cohesion

    • Circular references
  17. Presentation title here Modular design Bad practices: How to avoid

    this?
  18. Presentation title here Modular design Bad practices: How to avoid

    this? • Event-driven architecture
  19. Presentation title here Event-driven architecture • Observer • Mediator

  20. Presentation title here Event-driven architecture Observer:

  21. Presentation title here Event-driven architecture Mediator

  22. Presentation title here Modular design Bad practices: How to avoid

    this? • Event-driven architecture • Providing extensions
  23. Presentation title here Providing extensions

  24. Presentation title here What Symfony offers? • Bundles • Service

    container • Event dispatcher
  25. Presentation title here What Symfony offers? Service container • Dependency

    Injection
  26. Presentation title here What Symfony offers? Service container • Overriding

    classes of services with the same dependencies with parameters
  27. 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
  28. Presentation title here What Symfony offers? Service container • Decorating

    services (new in Symfony 2.5)
  29. Presentation title here What Symfony offers? Service container • Providing

    bundle configuration
  30. Presentation title here What Symfony offers? Event dispatcher (mediator pattern)

  31. 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
  32. Presentation title here Conclusion • Extensions helps you to make

    addition and modification of your application while minimizing impact to existing functionality.
  33. Presentation title here Conclusion Common solutions • Abstractions and DI

    • Modular design • Extensions provider • Event-driven architecture
  34. Presentation title here Conclusion Symfony offers • Bundles • Service

    container • Event dispatcher
  35. 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.
  36. 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
  37. Presentation title here ?