Hacker News new | ask | show | jobs
by chamomeal 27 days ago
Sounds like a sick CS department. We had to do Java. The whole first year was just OOP day in and day out. If I’d never seen python I really would have thought all programming is OOP, and probably would’ve dropped it for good
1 comments

> If I’d never seen python I really would have thought all programming is OOP

But isn't Python object-oriented? I mean, it's arguably more object-oriented than Java, since unlike Java, everything in Python is an object and it supports multiple inheritance. It's totally fair to not like Java, but if you like Python, then I doubt that OOP itself is what made you dislike Java.

Python is an object-oriented language in the broader meaning, but object-oriented programming is a particular style that java pushes you into, that python doesn't. It doesn't just mean "everything is an object", it's more like "everything is done in terms of objects that contain data and functions (methods)". Python has objects and could be done in that way, but a more basic imperative style with functional programming elements is more common, where objects are just one component instead of the driving force.
Java has better support for non-OOP paradigms than Python does. Map, filter, and reduce are built into the language rather than exiled to an external library. It supports multiline anonymous functions, and it has block scoping, so there are fewer surprises when using them. Java also has record types, exhaustiveness checks in pattern matches via sealed interfaces, built-in types for managing effects and errors (Optional<>, Try<>, Result<>), and type inference. It also has excellent interop with multiple programming languages where pure functional programming is idiomatic. It's a way more comfortable language in which to do FP than Python is.