Hacker News new | ask | show | jobs
by QuackingJimbo 2611 days ago
You getting downvoted for this completely inoffensive (at worst) comment is pretty sad

I swear C++ gets a bad rap because most people have only seen a gross mixture of C++98 and C in their codebases

A fully modern C++11 codebase is a beautiful thing

2 comments

Why are you so sure the downvotes are not coming from the opinion of the "ridiculously pedantic OO of Java"?
Maybe because no body had commented as such until now? I am rather practical about this: I don't really like Java because it forces things that make more sense as functions to be under an object. What if I just want a simple global utility function, and don't want to make every single class inherit from a class containing only that? It's a lot of unnecessary hassle for something like that. I'm not saying OO is bad, I said it was too pedantic. I like languages which allow you to do what makes sense.
and don't want to make every single class inherit from a class containing only that

That's not how having a global utility function works in any OO language I can think of.

You could also make a class of global functions and use that, but I think the point still stands: it forces square pegs into round holes, so to speak.
> You could also make a class of global functions and use that

I'm not sure I understand your issue with doing this. You need to put your global (i.e. public static) functions in classes not because Java is forcing OO practices into everything, but because classes effectively serve as Java's translation units. I think they serve this purpose pretty well in practice.

Classes being Java's only translation units are one of the downsides that I'm mentioning. Really my objection is more that it doesn't allow use of the right tool for the job (which is not always an object).
Any point can still stand if you completely change what you supposedly meant. It's an unassailable, impenetrable point.

A class with some static methods is just a namespace. In Java it pretty much turns OO off.

> A fully modern C++11 codebase is a beautiful thing

Can you point to an example of such? It would be nice as someone who’s been away from C++ for a long time.