Recommendation for Object-Oriented systems to study

Marko Rauhamaa marko at pacujo.net
Sun May 29 15:42:57 EDT 2016


Alan Evangelista <alanoe at linux.vnet.ibm.com>:

> if the interest is learning OOP concepts (and not OOP in Python), IMHO
> Java is better.
>
> - Java forces everything to be implemented in OO model (classes)

In practice, so does Python. Even if you chose to write code outside
classes, the standard library operates on objects and methods so you
can't escape them.

OTOH, Java resorts to silly tricks to implement plain function, "main()"
being a notorious example.

> - Java widely uses interfaces and abstract classes. Python has not the
> concept of interface, as it favors EAFP and duck typing instead of
> creating base classes which establish contracts.

That in no way makes Java obviously better or more OO. In my opinion,
Java has interfaces mainly as a mundane optimization technique, at a
conceptual cost, not to mention typing pain.

> Python also allows multiple inheritance, which is *usually* a bad
> idea, unless the base classes are interfaces.

Bad or not, multiple inheritance troubles OO in general, not Python in
particular.

> - In Java, interface/implementation separation is *usually* a bigger
> concern (eg getters and setters are common in Java code, rare in
> Python code) .

I think getters and setters often indicate a flawed object model.

> I know that Python developers see Python as more pragmatic, more
> flexible and quicker/easier/less bureaucratic to develop than Java, so
> my opinion may be controversial.

Java *is* bureaucratic. It is done for the primary reason of allowing
faster execution. The secondary reason is to put junior programmers in a
straitjacket in the hopes of preventing them from doing too much damage.

Python is loftier, conceptually more pure, and idiomatically to the
point, an elegant weapon for a more civilized age.


Marko



More information about the Python-list mailing list