Discussion on: Are utils (folder where you put random stuff you don’t know where to put otherwise) a code smell?

noway profile image
Ilia Author

I don't really use namespaces, I kinda a fan of just making every exportable symbol in a project to be unique. Sometimes that means you have names which are slightly longer than appropriate, but I deem that an appropriate trade off against using packages in general, which are way more harder to manage/refactor.
So whatever would be in Utils would be global for me. Trimmer, Validations, Regex, Rules. Most likely it would be named TextTrimmer, TextValidations, TextValidationsRegex, TextValidationsRules etc, in order to avoid collisions with other symbols.
In my view, TextValidationsRegex would be quite possible to even publish as a package, even though it probably would be too opinionated for general use to actually do that, therefore it would just reside in Utils