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

Defensive Code Design @ Phpro weekend

Defensive Code Design @ Phpro weekend

In this presentation, I'll take you through a journey of "How to make changing a username complex …".
We'll discover some design patterns together whilst refactoring a legacy god controller into smaller well designed chunks.
Will the result actually be complexer? Come and find out!

In a second chapter, we'll handle some insane never-changing business requirements together. Spoiler alert: The requirements will change ...

Parental Advisory : The presentation will contain random memes and buzzwords like : hexagonal architecture, commandbus, functional programming, immutability, pure functions, ...

Avatar for Toon Verwerft

Toon Verwerft

October 11, 2019
Tweet

More Decks by Toon Verwerft

Other Decks in Technology

Transcript

  1. Question  :   Dude  …  you  are  very  optimistic  about

     the   connection How  can  we  log  stuff?
  2. Level Urgency Notification Debug / / Info / / Notice

    / / Warning / / Error 1d / Critical 2-­‐4h Push Alert 2h Push Emergency <1h Push
  3. Positive: • Every  function  does  1  thing • Every  class

     does  1  thing • Easy  to  test • Easy  to  debug • Easy  to  extend Negative: • We  made  a  simple  task   complex  (but  not  really) • It  takes  a  lot  of  boilerplate   code • You  have  to  know  what  you   are  doing!
  4. Example  :   The  total  price  of  an  invoice is

     20  EUR  per  invoiced  items.
  5. Next  feature  request:   Please  make  it  25  EUR  per

     invoice  line! Ah  yea:  only  the  even  lines  count