Hacker News new | ask | show | jobs
by p2t2p 1913 days ago
> The same with class Math, such as Math.floor and Math.ceil.

I still want to group them somehow and this "somehow" better have name "Math" so other people would see what it is.

Why are people so attached to name "class". Call it "namespace with state capabilities" if you're annoyed by "class" so much. Or just use namespaces like in C#. You still want namespaces, that's the point.

And speaking about your example. More often than not, we've got quite a bit of functionality attached to program startup and I'd rather have it focused in one single module "Start"/"Application"/"Runner" whatever you want to call it but I want it to be _focused_ and easily searchable, not floating in a see of function.

And by the way, same argument can be made about functions, why do I have to create "main()" at all, why not just start writing instructions like in bash script or python?

1 comments

> Why are people so attached to name "class". Call it "namespace with state capabilities" if you're annoyed by "class" so much.

The central, first-class “namespace with state capabilities” in OOP is an object. A class is a namespace with state capabilities that may (or may not, because pure static classes are a thing) be an object factory, may or may not be an object or first class entity, and, probably, if the language has static types, is also a type.

And all of that is also true of objects, except the last, and objects are always first class in OOP. So, aside from static typing, classes are superfluous, unless they are just a name for objects with certain common feature.