if you guys were to have a module for cough utilit...
# naming
c
if you guys were to have a module for cough utility methods (extensions and what not), what would you call it? I'm really trying to avoid calling it a utility module because I feel like that would be like opening a dumping ground. I'm on the fence with
language-support
as in adding things the language doesn't offer but perhaps could.
j
I would be reluctant to have such a module at all. If you can group the extensions under some themes, create a module for each theme, and only use the ones you need. Such groups could be path manipulation, process handling, string manipulation, networking, etc.
If the groups are too small, maybe they are not worth sharing and can just be simple private methods here and there?
e
I have a project with modules such as
stdlib-extensions
,
coroutine-extensions
,
datetime-extensions
, etc.
the module names aren't 100% accurate because we do have a couple things like
fun <T> lexicographicOrder(comparator: Comparator<T>): Comparator<Iterable<T>>
which aren't technically extensions, but it's been working for us - they've stayed pretty small and we've been able to remove some things as the standard libraries have evolved
j
That sounds reasonable, for me the biggest pain with utils modules is when people start adding transitive deps. But with the naming strategy you have here, it seems to exactly group extensions based on their dependencies, so that problem is solved.
c
@Joffrey I think I'm currently on the other side of the pendulum swing! We've had a single module with a single class in because we are very apprehensive of creating a dumping ground, so we've uplifted that to a
language-support
module now. Copying and pasting a few private methods could be a solution, but was really hoping to capitalise on a bit of re-use. I'd 💯 % say the codebase isn't a shining representation of good design choices and I bet if I were to look into the usages of the methods and functions I'm putting into this new module, I'll find that actually the majority of them come from a single module AND the ones that don't likely should anyway. Thanks for the chat guys!