Helper, this word starts my list of the most hated dev words. I am experienced developer who work with many languages, but lately I've sticked longer in Python and particularly in Django. In every project there is the same problem, where to put things and how to name things, helpers are very much about how we can do it wrong.
Very often these reusable things get a name like - utils. I am ok with the name, it means that this are some utilities. Of course like with everything we can do too much and make these utilities a garbage. But this article is not about this problem, but the hated "helper" problem.
So my journey with Django started, and I got this MVC thing which I am familiar with, though in current architecture BE is not responsible for the view part, so Django MVC ends with really MC - we have models and controllers, eventually repositories in the middle - MRC or services MSC. Yes these are just made names, so I have no clue anybody names it like that.
Ok, so going back to helpers. What I was surprise to see was that outside of controllers and models, we have helpers, and developers really put there a lot of staff. This helpers thing is a liquide level of architecture. Everything which doesn't belong to C or M is there. So looks like at least half of the whole codebase lands in helpers 😱. Even more, when developers talk about the code they say - "I will make this and that helper" or "I will use this and that helper". Helpers are everywhere. They are reusable functions, but also classes responsible for specific domain flow. There is nothing consistent in it, or there are no rules where helpers live in the codebase. Helpers can be used by any part of the code, helpers can use third parties, can call database, but can be also reusable pure functions.
What is this helper thing then? Really, after almost 2 years in this environment, I know what is it. It is just everything and nothing, it is just a proof of the whole in the architecture. When some dev tells me - "I will make an helper", I am asking what does it mean? For me saying this is like saying - "I will make a function", or "I will make a class" or just "I will make a thing", it does not say really nothing more.
Of course I forced some improvements, we have introduced the missing part of the architecture so - Service layer which connects our so called Views, but really just end point definitions with models and repositories (QuerySet). This level is now used instead of helpers for all kind of flow managing, actions with side effects, it manages transactions and business procedures. The other things like - reusable functions moved to utils, other things like domain knowledge representations is put now in domain related files. Helpers - I don't write them, and never plan to do it again. If I hear word "helper", my response is WHAAAAT?!.
That article has been written in 20 minutes, sorry for any gramma errors, don't hesitate to point them in comments though.
Top comments (0)