To Py or not to Py

Raghu MutalikdesaiPassionate for code
CERTIFIED EXPERT
Published:
Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a primary programming language in an enterprise setup. In doing so, there are few parameters considered and the article revolves around the factors that would perhaps be critical in making the decision.

Code complexity / learning: Python might have an upper hand because of its sheer simplicity, therefore maintainability is quite good. The percentage of backend code is not more than 40% in general (in most of our applications). Therefore, it does not matter much as to what technology we choose for backend (‘non Flex’) code. Python or Java or C# –  result is same.

Links:
http://hathawaymix.org/Weblog/2004-06-16

Verdict:
Python is better in terms of simplicity and maintainability


Performance: Python is known to consume a lot of CPU in comparison with other technologies like Java or Microsoft (Article here explains more http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/). One interesting aspect is multi-threading – Python does support multithreading (but comes with certain limitations, that are perhaps the same with other languages as well: http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/).

Links:
http://mrpointy.wordpress.com/2007/11/06/java-vs-python-performance/
http://www.twistedmatrix.com/~glyph/rant/python-vs-java.html
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=java&lang2=python
http://mail.python.org/pipermail/python-list/2009-May/1205868.html
http://www.python.org/doc/essays/ppt/acm-ws/sld024.htm

Verdict:
With the kind of hardware we have today, it does not matter if a particular technology forces extra CPU/RAM usage. The ideas on which we are working at the moment might not bother on this aspect at all as most of the performance issues we see are in Flex / Flash. Hence, Python or Java or .NET – performance is equally bad / good.


Debugging: Overall, quite poor support for debugging. Few community members have explored the option of enabling debugging within Eclipse IDE for Python, but we have not gone into great detail there.

Links:
http://www.ibm.com/developerworks/opensource/library/os-ecant/
http://cs.calvin.edu/curriculum/cs/106/resources/pythonOnEclipse/5.debugging/

Verdict:
Looks like it is possible to debug Python code using Eclipse. We need to be sure it is possible with our pile of various technologies.


OOP friendliness: Java or C# might be more “strongly typed” than Python per se. The usage of generics (both in Java and C#) have emphasized this aspect (totally missing in Python). Also static variables / constructors are quite tricky (more of workarounds) in Python.

Links:
http://pythonconquerstheuniverse.wordpress.com/2009/10/03/static-vs-dynamic-typing-of-programming-languages/
http://www.daniweb.com/forums/thread93291.html#

Verdict:
Developers might take a while to adopt to this “overtly-simple” approach of Python (might even require some training). Traditionally, guys have strong orientation towards high level languages like C# or Java and would tend to miss many a tricks in Python. I would be bold enough to state that initial productivity / accuracy will perhaps be quite poor, that certainly can be overcome with dedicated training.


Documentation / Help: Since Python is a very popular language in the open source community, documentation / online help is widely available. In fact the Python website (http://docs.python.org/) offers tutorials, online help, discussions etc. There are fair amount of online forums that have addressed typical hiccups quite successfully.

Links:
http://www.sthurlow.com/python/
http://www.tutorialspoint.com/python/
http://diveintopython.org/

Verdict:
There is plenty of online stuff if one wants to learn Python (as well as master it). In fact, the support for Python is equally good when compared to Java or C#.


Conclusion:
Overall, Python seems to be a good choice for rapid development. There are few catches though, which could be tackled with some training. My good friend mentioned “Personally I don’t feel very comfortable with a language which is not strongly typed since lot of errors which can be caught at compile time in Java will be caught at run time in Python”, which highlights the key difference between “statically typed” and “dynamically typed” languages. But as they say, “The water always feels cold until you jump into it”.
3
4,051 Views
Raghu MutalikdesaiPassionate for code
CERTIFIED EXPERT

Comments (3)

CERTIFIED EXPERT

Commented:
Hi medhavi,

I personally consider the article helpful. It is difficult to present/replace the personal experience with any programming language to somehone who is a beginner and is just curious if, say Python, is worth to learn and use. Apparently, you have the experience. You could possibly add your own experience, for what you use Python (what kind of programming), your personal comparison, etc.

Not having my personal experience with writing EE articles... If it is possible to develop the article, it would be nice to see you writing a serie of short articles focused on subthemes mentioned here. Then you could replace the external links to the more detailed articles.

Say, debugging -- there is a lot of questions to be asked and answered. Python as the language is excelent to trace the reasons of problems.  Maybe, someone expects better tools for debugging. Anyway, you should mention the Unit testing support here. It is a kind of different approach to get the code with as few bugs as possible. This may also be the reason why debugging tools are probably not intensively used by the core developers.

Python is the language that helps to open eyes -- a lot of things done sligtly differently than in other languages. This way, I vote "Yes for Python".

In the same time, all we should more often ask "Why?"

This article should help you decide whether to adopt Python as a primary programming language in an enterprise setup.

This is one of the targets of "Why?"

Anyway, thanks for the article,
   Petr
pepr,


Thanks for your help.


Articles101
CERTIFIED EXPERT

Commented:
I should clarify my last "Why?".   I mean "Why PRIMARY programming language?".  In my opinion, it leads to false belief that one language could solve all problems.  I believe that no programmer should pray for the God of a single programming language.

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.