Home » Technology » Why Python is better than Java?

The best way to stay in touch with PuneTech and associated activities is to subscribe and receive most recent updates in your email inbox or via RSS. And, if you are looking for special interest groups, Click here. See our About Page to find out more about what PuneTech is.

Like to chat with PuneTech's founder? Connect now!

Why Python is better than Java?

Dhananjay Nene recently switched over to Python and has discovered that he is much happier writing programs in Python. He has a detailed post over at this blog on the reasons:

I think the most dominant impression from the last few months is that python does make programming feel a lot more easier and often more enjoyable. The feeling is not very different between riding a bicycle without gears then riding one with gears. In the latter case one just feels one can cover a lot more distance much more easily though any physicist will tell you the actual effort is not particularly different. It just feels like one has a much bigger toolbox (ie a wider assortment of tools) to work with and therefore the task seems simpler. Why do I think that way ? I believe the following features of python do help (in no particular order) :

* Concise Coding style : The code typically is much more concise, with much lesser verbosity
* Dynamic typing : You really do not need to worry about declaring data types and making sure the inheritance hierarchies especially for all the interfaces and implementations well laid out. The various objects do not even need to be in the same inheritance hierarchy – so long as they can respond to the method, you can call it. This is a double edge sword, but that doesn’t take away the fact that programming under dynamic types environment does seem a lot easier.
* Easier runtime reflection : Java seems to have all the reflection capabilities but I think these are just way too painful to use as compared to python. In python the entire set of constructs (classes, sequences etc.) are available for easy reflection. In case you need to use metaprogramming constructs, python really rocks.
* More built in language capabilities : Items such a list comprehensions, ability to deal with functions as first class objects etc. give you a broader vocabulary to work with.
* Clean indentation requirement : It took me about 2-3 days to get over it but, it seems that python code is much easier to read since if you do not indent it correctly it will be rejected.

I am a Perl person myself, and think similar thoughts about Perl, and I don’t really care for the forced indentations of Python. But Perl is really for disciplined programmers who don’t get carried away and start doing all the weird things that the language allows. For the indisciplined folks, I guess the forced indentation of Python is probably a good way to keep them in check.

Anyway,  read the whole article. You should also read the post he wrote at the time he chose Python for this next project. In fact, subscribe to his blog. He writes detailed and insightful articles that, as a techie, you would do well to read. If you are interested in programming languages, I would recommend reading “Contrasting java and dynamic languages”, and “Performance Comparison – C++ / Java / Python / Ruby/ Jython / JRuby / Groovy”. And if you are a blogger, check out his tips for software/programming blogging.

Dhananjay is a Pune-based software Engineer with 17 years in the field. Passionate about software engineering, programming, design and architecture. For more info, check out his PuneTech wiki profile.

If you liked this post, subscribe for updates by email or via RSS.

Comments

6 responses to Why Python is better than Java?

  1. Nemo says:

    The “forced indentation” is the exact same indentation as you’d use in any other language. Meanwhile, you get to dispense with brackets, begin/end, or similar nonsense. It’s a huge win with no downside.

  2. ravi chandel says:

    hi,
    i read you article it’s good but i wanted to know which is the best book for python so that i can do programming easily.

    bye

  3. michael says:

    Python is AWSOME. It is the only language out of the mainstream ones I have used I get excited about using.

    YMMV depending on what field your in. Python is very strong for glue work. Has a long way to go in other areas though. Very popular getting for web development – for that I think it may overtake Java.

    To learn I advise getting videos from lynda.com or similar sites to get the basics down. Then go and find other peoples code and just read it. That is really how most people learn programming not from long winded books they just get stuck in working over code from experienced programmers.

    Look for books that teach algorithms, design patterns and frameworks or using python for a purpose you need it for (you will NEVER learn everything any language can do so stick to your area of need). You also learn more actually trying to use it for a specific project than always book reading.

Leave a Reply
Your email address will not be published. All fields marked * are mandatory.


Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.