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

Messy data != Messy code

Messy data != Messy code

The role of our API in Switzerland is to consume a lot of data that was not meant for a digital age and to transform it into beautiful output, for one of the biggest retailers in Switzerland. This is a journey of consuming a lot of data and APIs from different sources and in different formats. Some of them made us laugh, some of us got migraines. We built a smooth architecture to consume and output data. I am proud of our architecture that we seamlessly upgraded to keep the latest versions, now Symfony 4 along the way. I want to share with you how we managed to keep this API up to date for over 5 years and the architecture that we use to make it happen.

Avatar for Michelle Sanver

Michelle Sanver

February 20, 2020
Tweet

More Decks by Michelle Sanver

Other Decks in Programming

Transcript

  1. Messy Data != Messy Code An API built in Symfony,

    for one of the biggest retailers of Switzerland PHPUK 2020 @michellesanver
  2. @michellesanver “We build a product that improves the way that

    Swiss people do shopping” - Michelle Sanver
  3. @michellesanver Disclaimer: 
 I do a lot of “ranting” in

    this talk. Retailer data is a complex business. We have nothing against our data providers.
  4. @michellesanver Agenda – The project: A retailer of Switzerland –

    Challenges – Big API: Solving the serializer bottleneck – Importing: When your 3rd party data provider “lies” to you – Mapping: Contain the mess! – Evolving with Symfony in a long term project
  5. DEV: Rae Knowler DEV: Tobias Schultze DEV: Christian Riesen DEV:

    Thereza Scherrer DEV: Martin Janser DEV: Emanuele Panzeri DEV: Michelle Sanver “Cloud Tamer”: Chregu PO: Timur Erdag PO: Colin Frei SM: Léo Davesne DEV: David Buchmann Team: 8 developers, 2 PO’s 1 SM, and… Chregu @michellesanver
  6. @michellesanver /src /Api /Client /Infrastructure /Migration / … A few

    lose things that makes sense, like Serializer Structure & Naming
  7. @michellesanver bin/console messenger:consume From a crazy amount of commands, making

    bin/console difficult to overview without grep to… This:
  8. @michellesanver • Missing spaces • String instead of int •

    Array instead of object • Object instead of string • Differently named fields • Required data missing • … And more
  9. @michellesanver • Missing spaces • String instead of int •

    Array instead of object • Object instead of string • Differently named fields • Required data missing • … And more
  10. @michellesanver Config of all the mappers, in order. 7 depends

    on 3 4 depends on 1 25 depends on basically everything 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ProductFactory
  11. @michellesanver Data From MySQL Clean Data To store in ES

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ProductFactory * 3
  12. @michellesanver An overall performance gain of 55% over JMS for

    our use-case 390 ms => 175 ms
 CPU and I/O wait both down by ~50%. Memory gain: 21%, 6.5 MB => 5.15 MB
  13. @michellesanver Contribute to Open Source Feel good to give something

    back And… Have some control over our tools