4 ms·
> Instead you want to build your functionality and identify where you have commonalities in state. Then you should start thinking, "Hey these are using similar
by LandR 8y ago
> Instead you want to build your functionality and identify where you have commonalities in state. Then you should start thinking, "Hey these are using similar state. Are they related? Would it be more cohesive if I grouped them together?"
Unfortunately in most OOP langauges, this isn't an option. Free functions aren't a thing, for the most part.
An object is the smallest unit, so if you need a single function you end up creating an object to hold it. Which results in an explosion of FooHelper, FooUtilities etc
This objects as the smallest unit also can end up in an explosion of regular classes, all only slightly different.
It's madness.
- zozbot123 8y agoStatic methods are a thing - all they need is a "module"-like unit to hold them, but no that's not the "smallest unit" in any real sense.
- LandR 8y agoIn a language like C# you still need to put those static methods in a class. Even extension methods need to go in a class (albeit a static class). It would be nice if you could define functions that lived in a namespace.
- sparkie 8y agoJust treat the static class with static only member as if it were a namespace. C# now even has support for omitting the need to type the class name because you can import it as if it were a namespace (`using static`). Seems like a trivial complaint.