3 ms·
> I was under the impression that even today, most code is written in an object-oriented style (or at least, written in languages that support OOP). Whoa there
by josephg 2y ago
> I was under the impression that even today, most code is written in an object-oriented style (or at least, written in languages that support OOP).
Whoa there - those are very different claims! Most modern languages are multi-paradigm. You can write Python in an OO way, or a data oriented way, or a functional way, or whatever you like. The same is true of JavaScript/typescript. And modern Java. And lots of languages.
Just because the language has the class keyword doesn’t mean everything can be subtyped. If you have an entity-component system, you can’t necessarily inherit from your Entity type. Likewise I can’t inherit from a react component, just because JavaScript has classes. (At least not using modern react)
- kllrnohj 2y ago> Most modern languages are multi-paradigm. [..] And modern Java. Modern Java is still very definitely OOP and not multi-paradigm. Other JVM languages, like Scala or Kotlin, add more multi-paradigm features to that ecosystem, but modern Java doesn't.
- diroussel 2y agoIt tries to be OOP, but you can still implement a program with int, int[] and static methods. And you can’t subtype those. Other JVM languages, like scala, are more OO than Java.
- tkcranny 2y agoJava has made some big strides here to catch up with the functional and data-oriented features other languages are all adding. I was pretty surprised and impressed to see a modern example lately. There’s Record data types, stronger type inference with `var`, pretty great structural pattern matching, switch expressions (that return a value), stream apis for map, filter, and reduce etc. All of these move it further away from strictly OOP. And separate but still cool is a pretty neat virtual thread system too. Java has definitely had a bit of a glow up since I learned it in uni.
- pansa2 2y ago> Whoa there - those are very different claims! I suspect that the stronger claim is true - but even the weaker claim would invalidate the article's statements that "existing programming languages have little or no subtyping" and that OOP was a "fad" and has been left in the past.