Taking that idea a little further philosophically, we can say that for a given set of requirements there does not appear to be a single best solution (tool) to meet them. However, as requirements are increased I beleive solutions will converge to a single best |
When treated as a multicriteria optimisation problem, it is just the opposite. If you have just one criterion there is usually a single best tool. When you add more requirements, you get a set of pareto-optimal tools. Programmers assign different weights to the requirements, so you get the endless language holy wars: "C++ is faster than Java", "But in Java you write code faster", and so on. And don't forget that familiarity with the given language is also a criterion. Someone who knows C very well and doesn't know Java would be more productive in C than in Java until he learns Java to some level.
Outside of the OO Paradigm there's no point discussing Java constructs. |
Because outside of OO paradigm, they are equivalent to the procedural paradigm, just as in the code I posted. The only distinction is writing "class" or "object" instead of "namespace". You could say they are not equivalent only if to write purely procedural code in Java you would have to put more effort than in a pure procedural language (like C). But this is not the case. It is even less code in Java, because in C and C++ you have to write function prototypes to allow intermodular calls, and in Java not. Java supports procedural and modular paradigms fully. Just think of classes as namespaces and ignore all the rest.
BTW 1: Why are compiled C files called "objects" and get an ".o" extension?
BTW 2: Java is a multiparadigm language just as C++, so restricting discussion to OOP only is plain stupid. Supported paradigms: procedural, modular, OO, generic. If you try hard enough you can also do FP (to some very limited extent, but at least it supports closures, while C++ does not) or AOP in it.