4 ms·
> JVM forces classes Fair enough but it does suck that it has to be that way. But yeah, fair enough. > Classes allow namespacing This is the same mode of iss
by diatone 4y ago
> JVM forces classes
Fair enough but it does suck that it has to be that way. But yeah, fair enough.
> Classes allow namespacing
This is the same mode of issue as the above: when your language doesn’t support arbitrary namespacing or (hello Python, hello Java) then yes classes can get used as namespaces in disguise. It sucks that it has to be this way in these languages, but we play the hand we’re dealt. Great point
> My colleagues have stylistic preferences
I’m struggling to understand this one. Are you saying that your colleagues prefer instantiating classes over functions, just because, or is there a technical reason for that convention?
- mjburgess 4y agoI dont think `class` as a module keyword, in python, sucks. It just requires learning being open to python as python. Eg., class EG: NORTH, SOUTH, EAST, WEST = 1, 2, 3, 4 def move(a, b): return a-b EG.move(EG.NORTH, EG.WEST) etc.
- zelphirkalt 4y agoThat would be a case for an enumeration, not a plain class. This usage would make me think: "And where does it get instantiated?" It is a fake class and this usage should be avoided.
- mjburgess 4y agopython -- syntax doesnt just correspond to one idea, the class keyword has a semantics entirely independent of an OO interpretation the whole point of design patterns is, exactly, to reuse "class etc." syntax for essentially non-OO purposes
- stickfigure 4y ago> It sucks that it has to be this way in these languages Not really? I don't see why it matters whether the namspacing keyword is `namespace` or `module` or `class`. If all you want is modularity, they work pretty much the same. This feels like a bikeshed issue. There's nothing fundamentally wrong with `Math.min()` or just `min()` with a static import.