Last year I built a multitenant system for my employer Spatialest. It was my first time doing a multitenant system, so I researched a lot before doing it. I studied carefully the experience of platforms like Shopify, as their multi tenant requirements were similar to ours. But even after some careful study, I made some mistakes. One of those mistakes is what I’ve come to call tenant pollution. This means that many services or routines need the tenant as an argument in order to do something.
Over the years I have developed a passion for seeing software projects fail. I love the feeling of breakdown and despair they cause to everyone involved in them. Failed projects break teams, make companies loose money, disappoint clients and burn out the people engaged in them. They have a beautiful destructive potential. If you love to to sabotage projects but don’t know how, don’t worry, I’m here to help. I’m going to walk you trough some of the techniques and methods I’ve developed over the years to sabotage my own projects.
The HTTP protocol, the REST architectural pattern and API design are amongst my favorite topics in software development. I closely follow the latest RFCs, technologies and standards built over these, and over the years I’ve learned how not to repeat the mistakes of the past by improving the way I used to to things. Count functionality implemented in a poor way is one of those mistakes. Back in the day I would have my api resources implement a count endpoint like this: GET /some-resource/count.
The Discovery of a Syndrome The past week I had some really nice holidays, but my wife still had to work. That’s nice sometimes because it means staying at home with loads of time to do one of my favorite things: getting myself into learning and coding (I also did some cleaning, cooking and DIYing too!). I was surfing YouTube for good coding talks and one caught my attention. It was Jack Diederich’s PyCon 2012 talk entitled “Stop Writing Classes”.
Introduction: A Tale of Simplicity VS Complexity NOTE: Every time the word array is used in this article I’m referring to the PHP definition of this term. You can also consider that term equivalent, for the purposes of this article only, to use instances of stdClass or instances of classes that contain dynamic public properties, like Active Record Models. This is because the deficiencies pointed with arrays apply to those constructs as well.