Python is one of those intriguing anomalies of software development: a language that’s often viewed as strictly a “glue” scripting language despite the fact that it’s clearly powerful enough for industrial-strength software development. Python, which is older than Java, has developed quite a following among a small-but-growing cadre of self-described Pythonistas.
While Python is often evaluated against Perl as a scripting language particularly suited to Internet applications, it’s building a buzz in the large-scale software development space. It can be characterized as:
- Object-oriented
- Interpreted
- Interactive
- Modular
- Dynamic
- High-level
- Portable
- Extensible in C and C++
Python incorporates modules, exceptions, dynamic typing, very high-level dynamic data types, and classes. It has interfaces to many system calls and libraries, as well as to various Windows-based systems.
If Python has failed to penetrate any specific arena of computing, it’s in enterprise development shops, where Python is still viewed as just an alternative scripting language to Perl. This article provides a brief assessment of why Python may or may not work in the construction of enterprise-scale applications.
The pros
Some of Python’s features that make it a reasonable candidate for use in enterprise applications are:
- Free availability (like Perl, Python is open source).
- Stability (Python is in release 2.2 at this point and, as I noted earlier, is older than Java).
- Good support for objects, modules, and other reusability mechanisms.
- Easy integration with and extensibility using C and Java.
While these capabilities represent common arguments for using Python in the enterprise, there are some other sound reasons that receive less attention.
Cost savings in development and maintenance
It’s no secret that IT shops have more work to be done and fewer resources with which to do it. Any IT solution that promises to increase coder productivity and reduce the ongoing total cost of ownership of software merits careful consideration. Python makes a strong argument that it can save the enterprise money both in the software creation and the maintenance stage, where software spends 50 percent to 95 percent of its life cycle.
Python’s clean, readable syntax makes code eminently readable, even by programmers other than those who worked on the original project. While some programmers object to the significant use of white space in Python code, almost everyone who sees Python code agrees that it’s far more readable than C or Java, which use special characters to mark the beginning and end of block structures, loops, functions, and other programming constructs. Python advocates say that the use of such characters can lead to noticeable style differences that make code less readable by those who must maintain it.
Its clarity of syntax makes Python an approachable language with a relatively shallow learning curve. An experienced programmer can probably pick up the basics of Python in a day, be productive in a week or less, and be relatively expert in the language many times faster than she could achieve equivalent fluency in C, C++, Java, or even Perl.
Perhaps the most dramatic gains Python derives from its clean syntax come in greatly reduced development times. One developer of enterprise-class applications told me that the development time his shop saves with Python far offsets any software performance downside. “For our business, it’s still more important to develop new products quickly than it is to develop products with screaming performance,” the developer said, “and developer time is by far more expensive (in value per hour) than putting hardware into the cage.”
While it’s always difficult to pin down specifics benchmarks on developer speed, there seems to be widespread agreement that developing Python applications is about five to 10 times faster than developing the same application in Java. Time savings are even greater when compared to C/C++.
Content management framework
Python has spawned Zope, one of the most widely used and well understood content management frameworks in the Open Source universe. This tool enables Python-savvy programmers to create and deploy highly interactive Web sites in a fraction of the time required by their JSP/ASP counterparts, and to do so in a way that permits the easy modification of the site’s contents by its owners and editors without programmer intervention.
Zope has been available for several years and is extensively used, particularly in Europe. It’s gaining wider acceptance in the United States, and current development efforts to simplify development and further separating functionality and presentation promise to increase Zope’s rate of acceptance. Like Python, Zope is Open Source.
Zope does suffer from some significant overhead that slows its performance during development, but a number of techniques can minimize this issue as sites are deployed.
Jython
An often overlooked point in favor of adopting Python in the enterprises, particularly those with significant commitments to Java, is a Python variant called Jython. Written completely in Java, Jython allows rapid development and testing of applications leveraging the Java class library in a fraction of the time of the edit-compile-test cycle of Java. Jython also enables tight integration of Python and Java code, allowing each to take advantage of the other language’s capabilities. This is the kind of power is the ultimate vision of the Microsoft .NET initiative’s Common Language Runtime (CLR) technology, but it’s accessible today in a mature product for Python.
The cons
Obviously, some sound arguments must be considered on the other side of the Python-in-the-enterprise question. Primary objections to Python as a viable enterprise-level programming language focus on these issues:
- Smaller pool of Python developers compared to other languages, such as Java
- Lack of true multiprocessor support
- Absence of a commercial support point, even for an Open Source project (though this situation is changing)
- Software performance (though benchmarks repeatedly demonstrate Python is comparable to Java in most applications)
The absence of commercial backing could be a complaint with most Open Source technology, of course. With Python, there’s really no answer at the moment. However, the recent formation of a business-focused group of European companies who have made heavy commitments to Python may signal the beginning of the end for this era in Python’s evolution. (Check out the Python Business Forum Web site.)
Lack of prepackaged solutions
PHP has gained a strong foothold in enterprise software, primarily because of a wide range of usable off-the-shelf products, such as discussion boards, chat servers, individual and group calendars, and instant messaging. By comparison, Python offers relatively few packaged solutions. It does include an extensive class library with the language’s distribution, and there are more and more programmers working on developing a PHP-equivalent tool. But if time to market is crucial and there’s a PHP solution to the problem you are facing, PHP is probably a better first place to look.
Python’s obscurity in development shops
Most development managers know very little, if anything, about Python. In high-pressure environments like modern IT shops, a manager’s lack of familiarity with a proposed language or tool and its implications for other aspects of software development can be the death knell for adopting that language. After all, the CIO or director of development is under the gun to produce finished applications. Absent concrete and compelling proof of a significant gain, most development managers stay with what they know. And very few of them know Python.
Database access layer limitations
Compared to established technologies such as ODBC and JDBC, Python’s database access layer seems a bit primitive and underdeveloped. Although this is changing, development shops with immediate needs for programs that interact smoothly with complex legacy data or powerful and rapid SQL database access are probably not good candidates for Python in the near term.
Again, much work is going on in this area and in six months, Python may well hold its own in this arena.
Documentation gaps
More than its rival languages Perl, Java, and to some extent PHP, Python suffers from a lack of extensive, accessible documentation and published books. There are nearly twice as many PHP titles on the market as Python books; both are dwarfed in this respect by the more than 400 Perl titles available.
Online, Python documentation is solid and largely well organized, but it tends to be sparse reference material. The relatively easy learning curve for Python mitigates against the need for tons of books on the subject.
Absence of GUI and teamwork tools
Creating graphical user interfaces on Python applications is unnecessarily complex. Tk ships with the Python distribution and is the tool most often used by Python developers. But there is no accessible, easy-to-use GUI tool for Tkinter (Tk as deployed with Python). The embryonic PythonCard project, which is in prototype at the moment (and in which I play a developmental role), intends to fill that gap. One product, boa-constructor, has caught on with some Python programmers, but it’s a complex effort to create a full-flown Integrated Development Environment (IDE).
More crucial than the absence of usable GUI tools is the total lack of tools that support team development in Python. Java is replete with such tools, as is C++. In enterprise software development, this shortcoming can be viewed as a near-fatal flaw; working with multiple programmer projects without such support tools is probably just too risky. Python mitigates this somewhat with its use of modules and namespace resolution, which facilitates multiprogrammer projects where stomping on code is an unlikely occurrence. Still, this must be seen as a major drawback.
Conclusions
When all is said and done, of course, the decision of whether to try or adopt Python in an enterprise is a complex one that has far too many site-specific variables to lend itself to generic advice. That caveat aside, we can probably safely say:
- If you have an extensive amount of PHP code or a significant number of PHP applications in place, moving to Python for those purposes is not viable.
- If you have a solid Java code base but you need lots of small apps, applets, and interfaces with that code, Python/Jython could be a real time-saver.
- If you have one or two coders who can be spared for a week or less, giving them the task of evaluating Python could pay significant dividends in the future.
Python in the enterprise
Have you built enterprise-class applications in Python? Tell us how it went or post a comment below.