Nando's blog
About Nando Nando's blog Posts about video, movies etc. Posts about computing Posts about music Posts about literature Philosophical posts Posts about programming

Java’s opinion of Python

I read some guy talking about Java, “the greatest language in the world”, just like an ugly American might say “the greatest country in the world”. He has motivated me to become an ugly Pythonista.

A Javer and a Cee-Sharper meet a Pythonista and consider Python for a brief moment.

Oracle Certified Java Programmer: ― I guess writing code in Python is quicker, but it might create maintenance nightmares later. Python is optimized for productivity and Java for maintainability.

Microsoft Certified Professional: ― Actually, the absence of great IDEs for Python, such as Visual Studio, might slow down the production of code.

Oracle Certified Java Programmer: ― “Rigid” languages such as Java make you write more code, but that code stays legible till the end of the project lifecycle.

Python apologist guy: ― You are wrong. I chose Python exactly because it is the most readable language available...

Microsoft Certified Professional: ― Nah, creating properties is very hard without an IDE. Another problem in Python is the lack of Generics. I am proud of writing in a language that has LINQ. Python is also missing a nice Reflection library such as the ones in C# and Java! That shows how much more powerful these languages are.

Oracle Certified Java Programmer: ― Yeah, I like Java because I get to program in XML. Hey, in Python you never know the type of a variable or parameter. Java is more explicit, therefore Java code is more readable.

Python apologist guy realizes the hopelessness of it: ― You are right, of course, but you can always use Hungarian Notation: s_name = ‘Nando’; i_age = 33;

Microsoft Certified Professional: ― I don’t like Python or Java. I prefer the C family of languages, invented by Microsoft, that includes C, C++ and C#.

Python apologist guy: ― Wait, in Python you can continue to type a semicolon at the end of every line.

Oracle Certified Java Programmer: ― Hmm, it must have copied Groovy. But that makes Python better than I figured...

Python apologist guy tries to ignore him: ― You can have strongly typed variables too. And braces. See this example:

# MyClass.py
# Proud author: nosklo (Clovis Fabricio)
class MyClass(object):#{
    def __init__(self, s_name, i_age):#{
        assert isinstance(s_name, str);
        assert isinstance(i_age, int);
        if (i_age > 20):#{
            print s_name;
        #}
    #}
#}

Microsoft Certified Professional: ― Hmm, the eye sees the #{ combination easily. OK, this code is readable. But I like .net because it is extremely multi-language.

Python apologist guy: ― Don’t worry, you can even have goto if you wish. Here is a VB-like alternative:

# MyClass.py. Proud author: nosklo (Clovis Fabricio)
class MyClass(object):
    def __init__(self, s_name, i_age):
        assert isinstance(s_name, str)
        assert isinstance(i_age, int)
        if (i_age > 20):
            print s_name
        #end if
    #end function
#end class

Microsoft Certified Professional: ― You can’t convince me because Python is an interpreted language, and I only like compiled languages, like C#. Furthermore, I like when enterprise libraries are ready so I don’t have to write them myself. ― Goes away.

OCJP waits until MCP is far enough. ― Never mind him, he never even understood the importance of Checked Exceptions. Hey, I see there are 2 classes in this file. This must be a maintenance nightmare! The only true way is one class per file.

Python apologist guy: ― Yeah, namespaces are one honking great idea ― let’s do more of those!

Oracle Certified Java Programmer: ― As much as I might like your language, I could never give up world-class enterprise-ready buzzword compliance and a BIG company backing us up.

Python apologist guy: ― Good for you!

Ruby developer: ― Excuse me, I couldn’t help but hear your conversation. I just wanted to say that if you ever need a dynamic language, consider Ruby ― it is more powerful.

Python apologist guy turns his back to OCJP and attacks Ruby developer:Die, heretic scum!