3 ms·
But when you learn Java, there aren't any powerful language features you can use to solve many problems. I know it's not pure, but Java does force you to think
by molbioguy 13y ago
But when you learn Java, there aren't any powerful language features you can use to solve many problems.
I know it's not pure, but Java does force you to think in an object-oriented way. And there are problems where that's an advantage.
- chriswarbo 13y agoEvery Java file consists of a load of package imports followed by a class definition. In Java, packages and classes are not objects. The majority of a class's definition is spent defining methods. In Java, methods are not objects. A large amount of method code is spent looping, branching and exception handling. In Java, loops, branches and exception handlers are not objects. Scattered liberally throughout all of this, there are type annotations. In Java, types are not objects. Could you please explain how Java forces me to think in an object-oriented way?
- peterashford 13y agoRiiiight. So by that metric, C++ and Smalltalk are OOP either. What exactly is OOP in your world?
- chriswarbo 13y agoC++ isn't particularly OO. Smalltalk is, since numbers, booleans, etc. are objects, classes are objects, methods (and functions in general, known as "blocks" in Smalltalk parlance) are objects. Likewise, the only control flow mechanism is the method call. Branching (if/then/else) is a method of the boolean objects. Loops are done via the "times" method of numbers. It's turtles all the way down.