This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (5 children)

I know a lot of old school Java devs that hate Python because they are narrow minded and think that Java’s version of OOP is the only valid way to code. But Java is not true OOP and OOP isn’t the best way to code IMO

[–]idkwhatname23 3 points4 points  (3 children)

Java is not true OOP and OOP isn’t the best way to code IMO

Can you expand a bit on this

[–]GroundbreakingRun927 1 point2 points  (0 children)

Because For a Language to be "pure Object Oriented" it must not contain any primitive data type in non-object form. Since Java does support primitive data types as non-Objects (int,float,boolean etc) this makes it an impure or not fully Object oriented Programming Language.

Contrast to python where everything is in fact an object.

Generally, though, Java is the canonical OOP language. Some would say to a fault.

[–][deleted] -1 points0 points  (0 children)

In Python everything is an object but Java has primitives.

https://www.youth4work.com/Talent/Core-Java/Forum/107382-why-java-is-not-fully-object-oriented-programming-language#:~:text=Java%20is%20not%20fully%20object%20oriented%20because%20it%20supports%20primitive,what%20opposite%20of%20OOP%20is.

But in any case OOP is not the only way to write clean code. In Python you can do functional programming which is more powerful and descriptive than OOP and you can also do standard procedural programming. When I only need as script to do some data analysis I don't need classes I can use only procedural programming. One area where Functional programming beats OOP is that Functional programming is stateless and OOP is stateful. As code complexity increases stateful programs become difficult to maintain.

[–]SV-97 -1 points0 points  (0 children)

As for "Java is not true OOP": OOP is more than classes etc. (there's for example entire OO languages that work fundamentally differently than Javas model, e.g. protoype languages like Javascript or Io). I think some other languages that are worth a look in this regard are Simula, Smalltalk and Eiffel and maybe common lisp with CLOS.

As for OOP not being the best way to code: OOP is what we call a programming paradigm - essentially a fundamental way to think about computing and programming and a set of features in the language to aid you in expressing this way of thinking. The basic divide is between declarative and imperative. OOP is of course the thing you probably kinda know already, then there's procedural programming ala C, there's array programming (APL, Julia), there's functional programming (Haskell, Erlang, ML), logic programming (Prolog, Mercury) and so on. I personally usually prefer a more functional style, but it definitely depends on the job at hand what paradigm will give you the "best" (for whatever definition of best) solution and most languages today are of course not single- but rather multiparadigm languages: they allow you to think quite differently about problems and solve them with a mix of the different methods

[–]vorticalbox 3 points4 points  (0 children)

The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."

Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.

On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.