3 ms·
Every 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
by chriswarbo 13y ago
Every 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.