Make Code Explicit and Stupid
There is one thing that surprises me in software development.
We, as developers, go at great lengths, explaining how event-centric architectures are so better than CRUD-based ones: you don't need to reverse engineer behaviors from state, since you express them explicitly (as events) and can project to any structural form.
At Lokad we leverage this heavily for web UIs, that tend to be slightly more intuitive because of that.
However, when things get to the code, we suddenly change our minds to the opposite and vastly favor implicit conventions and smart heuristics to discover and wire components in an application.
Maybe this is because, we are so good with solving complex problems, that we see them in every single problem?
(this is only a part of the picture, component instantiation is in another class).
We say, that such approach is smart, generic and reduces friction (when such approach is pushed to extreme, it is called Inversion of Control Container). That it generally is a better alternative than this:
Seriously, is it?
An important remark: Both pieces of code were written by me. At the moment of writing of each one, I was extremely proud of the approach being used :)
Published: February 06, 2012.
🤗 Check out my newsletter! It is about building products with ChatGPT and LLMs: latest news, technical insights and my journey. Check out it out