Playing the Snakes Advocate: Making a case for Python


 

S Ramdas plays the snake’s advocate, and tells you why you should look at Python as a programming language. He recommends that all developers must attempt to learn Python

 

 

[This article was originally published in Developer IQ January 2006 edition. Subsequently the author returned as the editor of the magazine]

 

An editor of a magazine that thrives on sensitivities of the software developer who reads the magazine often requires a lot of diplomacy. You need to be ‘politically correct’ as far as technology is concerned. It also means that you stay neutral and agnostic without ruffling too many feathers!

 

Since I am through with most of the balancing act, it is time to discuss some of the passionate projects close to my heart with the thousands of readers. In the past several years you may have read articles authored by yours truly on several technologies and programming languages from Java to C#.

 

However, if there is a language that I am truly passionate about it is Python. During my five year old stint as the head of editorial affairs of the magazine, I have tried my best in promoting the language to a wide cross section of readers. Some of the Python fans had appealed to me and asked me to come up with a Python programming special in Developer IQ. This would have appalled the language aficionados, and would have also seen a demand from even nifitier language fans to cover their favorite language in-depth in the magazine. This would have again been a ‘turn off’ to the large numbers of readers who come from the familiar territories of Java and Dot Net camps.

 

At BangPypers which is incidentally a motley crowd of Python lovers in Bangalore we often discuss strategies to promote Python usage in the country and especially in Bangalore. However despite the enthusiasm of many of the developers, we have rarely managed to arouse the same kind of interest in another developer coming from a different pedigree, philosophy or language.

 

This has prompted me to think and hence ask others why they do not want to look at Python as a language for fun and profit. I personally think and always have recommended much to the dismay of some of my more learned friends (mostly from the Java league) Python as a language for everyone to learn and experience the joys of programming.

 

In this article I explore the reasons why other do not feel Python is an attractive option. I play the role of a not-at-all reluctant sales man in selling Python. However I am not discussing some of the pros and cons of Python as a language. There has been endless debate on and off line on this, and there is enough literature which your friendly Google search can provide you.

 

There are also several articles on Python official web site www.python.org

 

A programming language does not really matter to any body. For example my wife who is working for an MNC bank would have never ever worried about the language used by her organization to developer applications she uses. Hence a programming language makes sense to just a few per cent of people who uses computers. This is not the case of an application or an operating system.

 

Further analyzing the smaller chunk of people who are bothered about a programming language you can see that these sections can further be broken up into individuals or a group of individuals.

 

Let us see who they are….

 

IS heads and managers— Most user companies have Information System teams which has a head or heads who take decisions and  managers/workers who help take decisions. This is often a community that also checks out in what platform, language, technology an application to be used by users of the company.

 

If you are shipping an application that is already written and is demonstrable then usually the language of the application really does not matter. What really matters is the application itself and its features. Hence a Python based solution can easily be sold provided the solution itself is good.

 

However in case the IS department is actually asking a developer company to develop a product or execute a project that needs to be utilized by users in the company, then they may raise a few eyebrows on choice of language.

 

One of the reasons why you see a lot of Java and Dot Net projects around is because these technologies are promoted by companies that have stood the test of time. These are championed by millions of developers, and there is a choice of partners to choose from. Unfortunately companies working on Python related technologies are comparatively lesser.

 

Most importantly no one has ever been fired for suggesting Java or Dot Net!

 

Though I am yet to meet or hear about someone being fired for suggesting Python, Zope or Plone, no one wants to be the first!

 

How do I sell Python to the IS team?

 

It is tough! Let us be honest about that. If you are a Microsoft only place, then it is likely that you will prefer a C#/VB.net as a language of choice. Though Python works well on Windows platform and you can do just about anything with Python on Windows, there is definitely a lack of powerful tools plumb Python.

 

However you can still use Python to do the quick prototype job. You can still use Python for doing those fast scripting work like automating tasks. You can do both Dot Net programming as well as Win32 programming on Python.

 

How do you start? Get a few Python distros installed on PCs. It requires very little disk space, and is free and free of licensing issues. Get a member interested in Python, and see how things go from there.

 

I guess if you have a lot of Linux or Unix boxes in your organization, using Python comes naturally. Python does not quite face the problem of having feature rich IDEs to compete on Linux compared to Windows.

 

The project leader/manager

 

The man (or woman) calling shots on a project have some priorities in mind. The biggest worry is deliverables and how fast one can deliver them. Then the worry is whether throughout the project, the team members will be around. Attrition is sometimes the biggest worry and this can cause many project leaders to think safe. To them Python is a risk, since it is difficult to find Python developers and good Python developers.

 

How do I sell to the project head?

 

I agree Python developers are hard to find. I agree that Java programmers are not at all hard to find! But good Java programmers are hard to find!

 

Now here is something which Paul Graham, the renowned developer calls as Python Paradox, which very few find it easy to digest. He feels (and obviously I agree) that average Python developers are better developers than the average Java programmers. He cites a few reasons that I can summarize.

 

If you are a Python developer, you would have learned the language on your own, which implies in most cases that you are a go-getter willing to learn. This is some quality average programmers lose on the way to professional heights.

 

A distinct advantage of Python is it almost always makes you write good code. This is one of the beauties of the language, rarely found in C++ or  Java.

 

I also feel that it is easy for a Java or C++ programmer to get into terms with Python very fast, as long as they can be in terms with Python.

 

 

The programmer professional

 

 Down the ladder you have plenty of developers who are getting into terms with professional life of a software engineer. It sucks for some, and it is a high for many! What are their priorities? 90% of young professionals are interested in career growth, going to US and getting a better pay packet. How is Python going to help them? Why should they look at Python?

 

Let us see…

The Python Way

By Tim Peters

  • Beautiful is better than ugly.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Flat is better than nested.
  • Sparse is better than dense.
  • Readability counts.
  • Special cases aren't special enough to break the rules.
  • Although practicality beats purity.
  • Errors should never pass silently.
  • Unless explicitly silenced.
  • In the face of ambiguity, refuse the temptation to guess.
  • There should be one-- and preferably only one --obvious way to do it.
  • Although that way may not be obvious at first unless you're Dutch.
  • Now is better than never.
  • Although never is often better than *right* now.
  • If the implementation is hard to explain, it's a bad idea.
  • If the implementation is easy to explain, it may be a good idea.
  • Namespaces are one honking great idea -- let's do more of those!

 

 

The Student developer

 

 

I am talking of the number of developers who are doing a professional course, where it be engineering, MCA, BSc/MSc or BCA. We have quite a few of them reading our magazine. Their biggest goal in life is to get a good job and start off a meaningful career! They scan through the news papers, magazines and the web, to figure out what they should specialize in. I am sure they are likely not to find much Python jobs there. Thanks to marketing muscles of Microsoft and Sun, they would bet on one of these technologies, which is the right thing to do.

 

If I need to sell to both these communities, I will have to sell Python’s virtues as a programming language.

 

Python makes you a better programmer for following reasons.

 

1)      You do not worry about types as you code, since these are automatically taken care by this dynamically typed language.

2)      You automatically make your code readable with Python and easily maintainable, because Python uses white spaces to branch code blocks and logic. Many programmers do not like this feature, but it is in fact one of the biggest strengths of Python.

3)      Object oriented programming concepts are easy with Python. I had conducted a survey among about 150 C++ programmers who had experience between one to three years for a Bangalore based company. Only 42 of them understood why they were writing object oriented code and what exactly they were doing. I guess if the question was posed to 150 Python programmers, 140 of them will get things right!

4)      Python is incredibly productive! This makes Python projects more manageable, and allows for more experimentation, redesign, and whole-system engineering.

5)      Finally you write less code to achieve the same, making you focus more on the problem at hand, than on the linguistic issues associated with programming.

 

For an entry level developer who is writing Java or .Net code, you can achieve things faster using Python. For example Jython helps you to write Java apps in less than one-third the time. Iron Python is an exciting tool that is is still a lot unstable, but can help you prototype .Net code fast.

 

Above all Python requires less than a few hours to get started and less than a few days to be competent and less than a month to be a master.

 

I guess some or most these facts appeal to Ruby too, but I am not a Rubyst and is a Pythonista, and that is why I recommend Python.

 

Finally I have not mentioned the usual blah blah! But here are few more tips. It’s free, open source, agile and is stable.

 

( S Ramdas is the former editor of Developer IQ and continues to play a role in the Developer IQ think tank! You can continue reaching him on ramdas@developeriq.com)




Added on July 19, 2007 Comment

Comments

Post a comment