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

Better Code Design in PHP

Better Code Design in PHP

Are you tired of spending hours reading code just to find the right place to make a small change? Are you forced to split your application into several just so that devs don't step on each other's toes? This talk unites theory with practice to show you how to structure your code so that it is easy to read, to test and to maintain. You will step out with concrete ideas of how to improve your code design.

Anna Filina

November 27, 2023
Tweet

More Decks by Anna Filina

Other Decks in Programming

Transcript

  1. Anna Filina • Coding since 1997. • PHP, Java, C#,

    etc. • Legacy archaeology. • Test automation. • Talks and workshops. • YouTube videos. • Filina Consulting.
  2. Design Drive • Avoid complexity until I need it. •

    Do I understand what’s going on in terms of the business use case?
  3. Project • Marketplace for short-term rental: • Search properties for

    rent by city, date and number of guests. • Reserve & pay.
  4. Simple Code • No need for framework. • No need

    to design the database. • No need to have a UI. • Code the business rules.
  5. Handle HTTP Request Return HTTP Response 2 adults in Lviv

    on Jan 1 to Jan 7 Results containing “Lviv for 4”
  6. Handle HTTP Request Return HTTP Response 2 adults in Lviv

    on Jan 1 to Jan 7 Results containing “Lviv for 4”
  7. A complex system that works is invariably found to have

    evolved from a simple system that worked. — John Gall
  8. PropertySearchHandler Lviv, Lviv Oblast, Ukraine Validate anyway. Convert to coordinates.

    CitySearchHandler Lviv Lviv, Lviv Oblast, Ukraine Lviv Boulevard, Oshawa, ON
  9. PropertySearchHandler 49.8397, 24.0297 Longitude: -180 to +180 Latitude: -90 to

    +90 CitySearchHandler Lviv Lviv, Lviv Oblast, Ukraine 49.8397 24.0297