Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SymfonyInsight: How to setup quality processes ...

SymfonyInsight: How to setup quality processes in Symfony apps

Titouan Galopin

July 09, 2020
Tweet

More Decks by Titouan Galopin

Other Decks in Programming

Transcript

  1. insight.symfony.com | July 9th 2020 | Titouan Galopin Setting up

    quality processes with Symfony Using the experience of the framework in your applications
  2. Agenda 1. Let’s talk about quality 2. OOP principles 3.

    Symfony processes 4. Using SymfonyInsight to monitor quality 3
  3. 7 Good code is able to handle change Code change

    over time Change in the execution environment
  4. 9 Handling change = Being able to update the code

    efficiently to apply a change
  5. 12 OOP helps you to create independent components inside your

    architecture, thus improving your code’s ability to handle change
  6. 13 By designing a good architecture, you will be able

    to update a class without changing the others
  7. 15 Ability to handle change Without OOP principles Difficult Updating

    the implementation Difficult Adding new features Difficult Removing features
  8. 17 In computer science, object composition (or encapsulation) is a

    way to combine simple objects or data types into more complex ones. — wikipedia.com
  9. 18 interface PersisterInterface { /* ... */ } interface MailerInterface

    { /* ... */ } class RegistrationManager { private $persister; private $mailer; public function __construct( PersisterInterface $persister, MailerInterface $mailer ) { $this->persister = $persister; $this->mailer = $mailer; } public function register() {/* ... */} }
  10. 23 Dependency Injection is where components are given their dependencies

    through their constructors, methods, or directly into fields. Those components do not get their dependencies themselves, or instantiate them directly. — picocontainer.com/injection.html
  11. 24 A dependency injection container is an object that enables

    to standardize and centralize the way objects are constructed and configured in an application. — symfony.com
  12. 27 interface MailerInterface { /* ... */ } class RegistrationManager

    { private $persister; private $mailer; public function __construct( PersisterInterface $persister, MailerInterface $mailer ) { $this->persister = $persister; $this->mailer = $mailer; } public function register() {/* ... */} }
  13. 28 interface MailerInterface { /* ... */ } class RegistrationManager

    { private $persister; private $mailer; public function __construct( PersisterInterface $persister, MailerInterface $mailer ) { $this->persister = $persister; $this->mailer = $mailer; } public function register() {/* ... */} } Updating the code of the Mailer will not require you to change the RegistrationManager (if you keep the interface)
  14. 29 Ability to handle change Without OOP principles With OOP

    principles Difficult Easy Updating the implementation Difficult Difficult (requires interface change) Adding new features Difficult Difficult (requires interface change) Removing features
  15. 34 Version 5.1.8 • Increase the Major number when... ◦

    making incompatible API changes (interface updated)
  16. 35 Version 5.1.8 • Increase the Major number when... ◦

    making incompatible API changes (interface updated) • Increase the Minor number when... ◦ adding features (interface added)
  17. 36 Version 5.1.8 • Increase the Major number when... ◦

    making incompatible API changes (interface updated) • Increase the Minor number when... ◦ adding features (interface added) • Increase the Patch number when... ◦ fixing bugs (no interface change)
  18. 38 Humans are better at focusing than remembering In your

    applications, try to group breaking changes together in time (a single PR)
  19. 42 But it also means major versions contains 2 years

    of breaking changes at once => more complex upgrade path
  20. 43 Deprecations = Messages in minor versions about features that

    are going to be removed in the next major
  21. 46 Sometimes, refactorings are too large to be done at

    once In your applications, use deprecations to keep legacy code running and allow tools to help you remove its usages over time
  22. 47 Ability to handle change Without OOP principles With OOP

    principles Difficult Easy Updating the implementation Difficult Difficult (requires interface change) Adding new features Difficult Difficult (requires interface change) Removing features With Symfony processes Easy Easier Easier
  23. SymfonyInsight is a static and dynamic code analyzer Analyse the

    code without executing it Run the code to better understand it
  24. It analyzes your code on each commit to help you

    maintain a high quality and upgrade your dependencies more easily
  25. SymfonyInsight has 3 mains aims Providing suggestions, validating your quality

    Monitoring quality and velocity Creating upgrade plans
  26. Webinar attendee promo code To thank you for attending our

    SymfonyInsight webinar, get -20% on any new yearly plan: SFI-WEBINAR-0907 Use this coupon during the payment process
  27. Need help applying these architectural concepts? Find a training program

    with our partner SensioLabs University: https://university.sensiolabs.com/e-learning-platform Use the promo code SLUINSIGHT30 to get -30% on the e-Learning Platform