|
This article appeared in the January, 2003 issue of the EAI Journal.
A PDF version is available here
Python- Language of Choice for EAI
Most of the hype regarding programming
languages for web services is around the competition between
C# and Java. But there is one language that both Microsoft
and its competitors have all agreed to support in their various
platforms: Python. Python has a reputation of being a scripting
language like Perl. But in fact, it is a full-featured, highly
advanced programming platform, with roots in LISP and Smalltalk.
More and more organizations are beginning to adopt Python
as the platform of choice for distributed application development.
Python is an object-oriented, high-level
interpreted language. Python was originally developed in the
early '90s by Guido van Rossum. His original goal was to develop
a language that could be used to teach the most advanced concepts
of programming to non-programmers. As such, the language stresses
readability, simplicity and elegance. To quote van Rossum: "As
an object-oriented language, Python aims to encourage the creation
of reusable code. Even if we all wrote perfect documentation
all of the time, code can hardly be considered reusable if it's
not readable." Python is also extremely portable. There are
currently identical versions available for nearly every computing
platform, major and obscure, from PDAs to mainframes. Python
is also an open-source platform, which encourages sharing of
ideas and code.
The combination of simplicity, power and portability, along
with its open-source nature, has made Python extremely popular.
Over the last decade, still under the guidance of van Rossum,
Python has grown from a small teaching project, into a programming
language that is used by major enterprises around the world,
in mission-critical applications.
We group Python advantages by the key features
listed above. Please note, that whatever is said below about
Java, applies equally to C#.
A. Powerful Simplicity
- Python programs are far quicker to develop
than other high-level languages. Because of the elegance
and simplicity of the language, Python programs tend to
be 3-5 times shorter than their equivalent in Java, and
5-10 times shorter than C++ equivalents. In addition, being
an interpreted language eliminates the lengthy edit-compile-debug
cycle of other high-level languages. Since programmer costs
are the most significant part of any programming project,
this advantage alone provides a good reason to consider
using Python.
- Python programs are easier to maintain.
The simple, clean syntax not only allows the original developers
to remember what they did, it also allows other developers
to understand and change programs. This allows for much
lower maintenance costs for Python programs.
- Python is an extremely versatile language.
It can be used for the simplest scripting applications,
as well as for the development of complex websites, and
all the way up to the construction of complex distributed
applications. This versatility allows organizations to reduce
training and software tool costs.
- Python's object-oriented paradigm is the
most powerful and easy to use of any commercial programming
language. Like Smalltalk, Python has dynamic typing and
binding, and everything in Python is an object. Object behavior
can be adapted at run-time. This allows Python programmers
to easily use the full, flexible power of object-orientation,
as opposed to Java or C++. However, Python's syntax is more
like other standard programming languages, so it is much
easier for programmers to learn than Smalltalk. Again powerful
simplicity allows for rapid development of more complex
applications.
B. Portability
- Python is available on an incredibly wide
range of hardware and software platforms. This includes
the usual suspects: Sun, Intel, IBM, Microsoft Windows variants,
Macintosh OS variants and all Unices. However, Python has
also found its way into a wide range of less well-known
platforms, including PDAs and set-top boxes. Python is probably
the only language where one can truly say, write once and
deploy everywhere.
- Python plays well with other languages.
Python programs can be extended using C, C++, or Java, or
can be embedded in programs written in these languages.
Jython is an implementation of Python written in 100% Pure
Java, that allows you to run Python on any Java platform.
There is also a Python extension that supports Microsoft's
.NET Framework’s Common Language Runtime (CLR). Hence
Python code can be used with any web services variant offered
by competing vendors. Moreover, in those parts of applications
where speed is of the essence, code can be written in the
most efficient programming language available, while still
retaining the rapid application development advantages of
Python. Finally, Python can be used as a wrapper for legacy
applications written in other languages.
- Python plays well with programming standards.
Many high-quality Python extensions are available which
support almost all Internet standards, CORBA, COM, SOAP,
XML, XML-RPC and so on.
- Python provides the option for integration
with low-level APIs for both the Windows and Unix platforms,
allowing applications to be highly platform compatible.
Java, by contrast, only gives the option for developing
to the lowest common denominator across platforms. C# only
gives the option to be Microsoft compatible.
C. Free/Open Source Software (FOSS)
- Thousands of programmers around the world
contribute to the development of Python. These programmers
are not being paid to develop Python, but are being paid
to develop applications. They use Python in real world settings.
This ensures that Python is robust, secure, relatively efficient,
portable, scalable and has a feature set which meets real
world needs, not what vendors think customers should have.
- Python like all FOSS
software has three freedoms: It can be used freely, without
paying exorbitant licensing fees. It ensures free development
of software applications without any artificially imposed
vendor restrictions. It ensures a free software market,
eliminating enterprise dependence on any software vendor
large or small.
D. Other Considerations
Several objections are often raised against
using Python. We address them here.
- "There are very few Python programmers."
While it is true that there are far more Java programmers
currently available, there is also a very large community
of programmers who know Python. Since Python is FOSS, enterprises
can learn about many of these programmers skills and abilities
through their involvement in the Python community. There
is often no way to get an idea about a Java programmer's
abilities until after they are hired. Moreover, Jython can
be used to leverage Java programmer skills and help them
migrate to and learn Python. Moreover, Python is easy to
learn, especially for programmers already familiar with
object-oriented concepts.
- "Interpreted languages are inefficient."
As an interpeted language, Python is in many cases slower
than Java, and certainly C++ or C. But as noted earlier,
where efficiency really matters, C code can be embedded.
For the rest, the Python advantages are clear.
- "But it's just a programming language!"
Python has been extended by a huge number of modules that
make it into a system development platform, not just a programming
language. There is an enormously successful web-development/application
server/content management system, based on Python (Zope).
There are also IDEs available, both FOSS and commercial,
and many other support tools.
- "How will I get support for an FOSS system?"
Besides the extensive free support available from the Python
community there are many vendors who provide commercial
support for Python and its extentions.
- "Nobody is using it!" Python does not yet
have the mind share in the enterprise that Java does. So
the next section will be devoted to providing just a few
of the many success stories around Python.
For more extensive information about Python,
you can visit the Python
website.
Here is a list of just some of the enterprises
currently using Python
 |
Industrial Light & Magic, maker of the Star Wars films,
uses Python extensively in the computer graphics production
process |
 |
Google, a leading internet search engine, extensively uses Python.
|
 |
Yahoo uses Python for its groups site. |
 |
IBM has, among other things, used Python in factory tool control
applications. |
 |
Disney uses Python for its animation production applications.
|
 |
BEA uses Python in testing enterprise-class e-commerce software.
|
 |
NASA uses Python in several large projects, including a CAD/CAM
system and a graphical workflow modeler used in planning
space shuttle missions. |
 |
The
National Weather Service (USA) uses Python to prepare
weather forecasts. Python is also used for this purpose
at the Swedish Meteorological and Hydrological Institute
and at TV4 Sweden. |
There are many more such examples.
To learn more about the growing use of Python in business,
as well as to get information about commercial companies
that provide Python consulting, support, training and
tools, visit the website of the Python Business Forum.
IT managers in companies large and small all face the following
problem: On the one hand, applications live forever. Developing
applications that meet organizations' needs is the real challenge
of any IT shop. Once the application development process has
finally worked its way through all the organizational politics,
no CIO in his right mind wants to touch it. On the other hand,
significant cost savings can often be realized by replacing
the IT shop's underlying infrastructure of hardware, OS and
networking software every few years. So "middleware" becomes
increasingly important as the buffer between the long-lived
applications and the underlying infrastructure.
But wait, there is more. Management has always wanted various
IT applications to inter-operate. But the rise of the Internet
just whetted management's appetite for more. Now everything
must integrate and work together, within the organization and
across organizational boundaries. Middleware becomes even more
important as the glue that ties diverse applications together.
But the issues become far more complex as applications are now
networked and distributed.
Web services is touted as the panacea, the ultimate glue that
will solve all IT problems. This is not a paper about the limitations
of web services. But there are two issues that any IT shop must
face:
- What to do with the huge investment the
organization has in legacy applications?
- How to ensure that the enterprise is not
selling its organizational soul to eternal dependence on
one particular vendor?
The long list of advantages of Python,
noted above, directly address these two core issues, and make
Python particularly suited as a basis for EAI. Python's high-level,
powerful simplicity makes it an excellent choice for abstracting
out the complexity of application-infrastructure interaction.
It's vast portability and inter-operability with a wide-range
of hardware and software, make it the system of choice for wrapping
legacy applications. And its FOSS heritage guarantees future
freedom from vendor dependence. CIOs can choose infrastructure
purely based on price-performance considerations, without having
to forever buy into a particular vendor's world.
We noted above that Python the language has been extended by
many powerful system modules. One of these particularly addresses
EAI. More on that in the next section.
Twisted is a sophisticated event-driven network
FOSS Python-based framework, that provides extremely powerful,
scalable and flexible enterprise application integration capabilities.
At the core of Twisted is its network layer which can be used
to rapidly integrate any existing protocol as well as model
new ones. Whenever the need arises to develop a new protocol,
the asynchronous, multiplexed and two-way remote object protocol
(ROP) can be used to quickly implement it. Because the ROP
is used with object-level abstractions, changes can be made
easily, and new features added, without having to deal with
the design restrictions and application development complexities
of a custom protocol.
Out of the box, Twisted supports a large number
of service protocols: HTTP, FTP, SMTP, LDAP, DNS, SOCKSv4,
SSH, IRC, telnet, POP3, AOL's instant messaging and more.
This allows developers to use these protocols immediately,
without having to spend time re-implementing them. In addition,
Twisted can talk to multiple, industry standard DBMS. It also
can be used to communicate with COM servers and to control
and integrate with standard Windows applications (Word, Excel,
etc.).
Unlike other frameworks, that are designed
to address a specific domain -- email, Web sites, Web services
-- Twisted is designed to support both multiple frameworks and
multiple protocols at the same time. Thus, Twisted can be used
to implement web sites, web services, email servers, or instant
messaging servers. Moreover, these services can all run in the
same process.
For more information about Twisted, visit the Twisted Matrix website.
Hopefully, at the end of this very brief
overview of Python, you have understood that it is an excellent
choice for software development in general, and EAI in particular.
One important point to note is that the barrier to entry of
Python is very low. Python software and introductory tutorials
and texts are available for free, as in beer. So is basic Python
support. In the words of that famous commercial: "Try it, you'll
like it."
|