Top Banner

of 31

Python Success Stories

Apr 08, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/7/2019 Python Success Stories

    1/31

    8 true tales of flexibility,

    speed, and improved

    productivity

    Industrial Light & Magic

    LivingLogic AGRackspace

    Siena Technology

    United Space Alliance

    Wing IDE

    University of St Andrews

    Journyx

    PythonSuccess Stories

    We achieve immediate functioning code so much faster in Python than in any other language that its staggering.

    Robin Friedrich United Space Alliance

  • 8/7/2019 Python Success Stories

    2/31

    Essential Tools for Success with Python

    python.oreilly.com

    Order NowSee back page for order form. Or call 800-998-9938

  • 8/7/2019 Python Success Stories

    3/31

    Introductionby Alex Martelli & Guido van Rossum

    Python is widely admired for its simplicity

    and elegance. However, these undeniablequalities must not overshadow Pythonsusefulness: with Python, you *can getthe job done*!Python is highly scalablesuitable for largeprojects as well as for small ones, excellentfor beginners yet superb for experts. It isstable and mature, with large and powerfulstandard libraries, and a wealth of third-party packages for such widely varied tasksas numerical computation, Internet and webprogramming, database use, graphical userinterface development, XML handling,image processing, three-dimensionalmodeling, and distributed processing withCORBA or SOAP. Python plays well withothers, easily integrating with either C/C++

    or Java you can extend it, you can embedit in your existing applications, and youcan use it to integrate multiple applications.This booklet illustrates Pythons usefulnessby presenting a small sample of Pythonsuccess stories, real-life examples wherePython played a central role in the devel-opment and delivery of working, usefulsoftware systems of substantial size. Thesystems are in a wide variety of applicationareas, and they go up the scale, all theway to enterprise-wide integrated systems.Thus, youll see that Python is not justa scripting language (not limited to codingsmall and simple scripts, even though itsquite suitable for such frequent, smalltasks), nor is its usefulness conned to anyone application area. In the hands of experi-enced software developers, Python offershigh productivity for projects of all sizes,in all application areas.Pythons usefulness comes exactly from itssimplicity and elegance, harmonized into aseamless whole by its highly pragmatic design.

    Engineers since the Roman Vitruvius have

    recognized that a good design exhibitssolidity (rmitas), delight (venustas), andusefulness (utilitas). Italian architect, LeonBattista Alberti showed during theRenaissance that these characteristics areachieved by harmony (concinnitas) theart of ordering disparate parts into anorganized whole. Pythons design makesthese theories come to life, no less than

    Albertis Tempio Malatestiano.Managers love Python because its simplicityminimizes programmers learning efforts,but the same simplicity underpins Pythonssolidity, avoiding any bugs related toobscure, misunderstood and ad-hoc features,in both the languages implementations andprograms coded in Python. Designers are

    drawn to Pythons elegance, which allowsconcise and readable expression of designideas, but the same elegance and readabilityease maintenance, modication and reusefor programs coded in Python. The ease of interfacing Python to existing C/C++ or Javalibraries and applications, plus Pythonslarge standard library and the wealth of existing third-party Python extensions,

    combine to make Python the ideallanguage for challenging integration tasks,no less than for green-eld developmentprojects. All together, these characteristicsmake Python the language of choice forhigh-productivity software developmentone of the most rapid developmentenvironments on the planet.Once this booklet has whetted yourappetite, you can explore Python further,starting at www.python.org . For manyexcellent books about Python, and foradditional Python success stories,see python.oreilly.com.

    1

  • 8/7/2019 Python Success Stories

    4/31

    2

    Background

    Industrial Light & Magic (ILM) was started in 1975 bylmmaker George Lucas in order to create the specialeffects for the original Star Wars lm. Since then, ILMhas grown into a visual effects powerhouse that hascontributed not just to the entire Star Wars series, butalso to lms as diverse as Forrest Gump, Jurassic Park,

    Who Framed Roger Rabbit, Raiders of the Lost Ark, andTerminator 2. ILM has won numerous Academy

    Awards for Best Visual Effects, not to mention a stringof Clio awards for its work on television advertisements.

    While much of ILMs early work was done withminiature models and motion controlled cameras,ILM has long been on the bleeding edge of computer-generated visual effects. Its computer graphics division

    dates back to 1979, and its rst CG production wasthe 1982 Genesis sequence from Star Trek II:The Wrath of Khan.

    In the early days, ILM was involved with the creationof custom computer graphics hardware and softwarefor scanning, modeling, rendering, and compositing(the process of joining rendered and scanned imagestogether). Some of these systems made signicantadvances in areas such as morphing and simulatingmuscles and hair.

    Naturally, as time went by many of the early innova-tions at ILM made it into the commercial realm, butthe companys position on the cutting edge of visualeffects technology continues to rely on an ever-changingcombination of custom in-house technologies andcommercial products.

    Today, ILM runs a batch processing environmentcapable of modeling, rendering and compositing tensof thousands of motion picture frames per day.Thousands of machines running Linux, IRIX,Compaq Tru64 , Mac OS X, Solaris, and Windows

    join together to provide a production pipeline with

    Industrial Light & Magic Runs on PythonTim Fortenberry

    About the Author

    Tim Fortenberry joined Industrial

    Light & Magic in 1999 as an intern. Later that same year

    he began to work full time in

    the Resources department.He worked as a scripts/ tools

    programmer. Shortly after,Fortenberry joined the Research and Development department.

    He is one of the founding

    members of the Pipeline and TD Tools groups that helped

    bridge the gap between artists

    and technology.

    As an engineer, Fortenberry is

    responsible for developing and

    maintaining the myriad of appli- cations used for rendering and

    pipeline control ow of images

    at ILM. Prior to joining ILM,Fortenberry worked as a Linux

    systems administrator for VA

    Linux Systems.

    Originally from Southern

    California, Fortenberry received

    his Bachelor of Arts degree from the University of California at

    Berkeley in Anthropology with

    an emphasis in Archaeology.

    www.ilm.com

  • 8/7/2019 Python Success Stories

    5/31

    3

    approximately eight hundred users daily,many of whom write or modify codethat controls every step of the productionprocess. In this context, hundreds of commercial and in-house software compo-nents are combined to create and processeach frame of computer-generated orenhanced lm. Making all this work, andkeeping it working, requires a certain degreeof technical wizardry, as well as a toolset

    that is up to the task of integrating diverseand frequently changing systems.

    Enter Python

    Back in 1996, in the 101 Dalmationdays,ILM was exclusively an SGI IRIX shop, andthe production pipeline was controlled byUnix shell scripting. At that time, ILM wasproducing 15-30 shots per show, typically

    only a small part of each feature length lmto which they were contributing.

    Looking ahead towards more CG-intensivefilms, ILM staff began to search for waysto control an increasingly complex andcompute-intensive production process.

    It was around this time that Python version1.4 came out, and Python was coming into

    its own as a powerful yet simple languagethat could be used to replace Unix shellscripting. Python was evaluated, comparedto other technologies available at the time(such as Tcl and Perl), and chosen as aneasier to learn and use language with whichto incrementally replace older scripts.

    At ILM, speed of development is key, andPython was a faster way to code (and re-code) the programs that controlled theproduction pipeline.

    Python Streamlines Production

    But Python was not designed just as areplacement for shell scripting and, as it

    turns out, Python enabled much morefor ILM than just process control.

    Unlike Unix shell scripting, Python canbe embedded whole as a scripting languagewithin a larger software system. In this case,Python code can invoke specic functionsof that system, even if those functions arewritten in C or C++. And C and C++ codecan easily make calls back into Pythoncode as well.

    Using this capability, ILM integrated Pythoninto custom applications written in C orC++, such as ILMs in-house lighting tool,which is used to place light sources intoa 3D scene and to facilitate the writing,generation, and previewing of shadersand materials used on CG elements. It isthe lighting tool that is ultimately respon-

    sible for writing the 3D scene out to aformat that a renderer can interpretand render.

    At the same time, more and more compo-nents, such as those responsible for ILMsmany custom le formats and data structures,were re-wrapped as Python extension modules.

    As Python was used more widely, extending

    and customizing in-house software becamea lot easier. By writing in Python, userscould recombine wrapped software compo-nents and extend or enhance standard CGapplications needed for each new imageproduction run. This let ILM staff doexactly what production needed at anygiven time, whether that meant allowing fora specic look for an entire show, or just a

    single CG character or element. As it turned out, even some of ILMs non-technical users were able to learn enoughPython to develop simple plug-ins and tocreate and modify production controlscripts alongside the technical users.

  • 8/7/2019 Python Success Stories

    6/31

    Python Unifies the Toolset

    Encouraged by its successes in batchprocess control and in scripting applica-

    tions and software components, ILM startedto use Python in other applications as well.

    Python is now used for tracking andauditing functionality within the productionpipeline, where an Oracle database keepstrack of the hundreds of thousands of images that are created and processed foreach lm. DCOracle2, one of the Oracle

    integration libraries available for Python,has performed well in this task and is nowin use on Linux, IRIX, Tru64, and Solaris.

    Python is also used to develop the CGartists interface to ILMs asset managementsystem. Designed to be modular, this toolhas been enhanced by a large group of developers and non-developers alike toextend well beyond its original mandate.The application is now used not only tomanage CG assets and elements, but also indaily shot review, as a network-based white-board, as an instant messenger, and evenallows an occasional game of chess.

    As Python was applied in more ways, itslowly crowded out a plethora of competingtechnologies for shell scripting and batch

    control, embedded scripting, componentsoftware development, database applicationdevelopment, and so forth. Python s versa-tility ultimately simplied the developerstoolset and reduced the number of tech-nologies that needed to be deployed toILMs thousands of production computers.This new, simpler toolset translated directlyinto an easier to manage and more reliabledevelopment and production process.

    Hardware Costs Reduced

    Although chosen initially for its ease of useand integration capabilities, Python s porta-bility to many other operating systemseventually became one of its key strengths.

    Once Python was in use, it made theproduction control system portable. Thisgave ILM additional freedom in making

    hardware technology choices, including alarge-scale introduction of commodity PChardware and Linux, a move that has savedthe company substantial amounts of moneyin recent years.

    Source Code Access Important

    After having used Python intensively for sixyears, ILM has yet to run into significant

    bugs or portability issues with the language. As a result, since Python 1.5 ILM has beenable to rely on stock distributions inunmodied form.

    However, availability of source code for thelanguage acts as an important insurancepolicy should problems arise in the future,or should custom extensions or improve-ments become necessary. Without this,ILM could never have bought intoPython so heavily for its mission-criticalproduction process.

    One case where access to source has alreadybeen benecial was in ILMs continued useof Python 1.4, which is generally consideredobsolete. Because the production facility isunder continuous use, upgrading systems to

    new Python versions would result in signif-icant disruption of the production process.

    Instead, ILM installs new systems withnewer versions of Python but maintainsolder systems only so they can run the samescripts as the newer systems. Supportingthis mix has required access to the Pythonsources in order to back-port some changes

    found in newer Python versions, and toreimplement portions of newer supportlibraries under older versions of Python.ILM is currently running a mix of Python1.4, 1.5, and 2.1.

    Industrial Light & Magic Runs on Python, continued

    4

  • 8/7/2019 Python Success Stories

    7/31

    Python Tested by Time

    The visual effects industry is intenselycompetitive. To stay on top of the heap,

    ILM continuously reviews its productionmethods and evaluates new technologiesas they become available.

    Since its adoption in 1996, the use of Python has also been reviewed numeroustimes. Each time, ILM failed tond a morecompelling solution. Python s unique mixof simplicity and power continues to be the

    best available choice for controlling ILMscomplex and changing computing environment.

    5

  • 8/7/2019 Python Success Stories

    8/31

    6

    About the Authors

    Before receiving his Ph.D. in

    2000, Dr. Walter D rwald researched forest growth

    simulations and arti cial life

    at BIT K (the Bayreuth Institute of Forest Ecosystem Research),

    and developed a large C++

    framework for simulation and visualization. In 2000, he co-

    founded LivingLogic AG, and

    has been responsible for the company's fundamental tools

    and technologies ever since.

    After getting his Ph.D. in Mathematics in 1990, Dr. Alois

    Kastner-Maresch lead the

    Forest Ecosystem Simulation research team at BIT K.

    In 2000, he co-founded

    LivingLogic AG, where he is CEO.

    www.livinglogic.de/ Python/ xist/

    Summary

    XIST is a XML transformation engine writtencompletely in Python at LivingLogic AG, a softwaredevelopment company specializing in web technology.XIST was designed to facilitate the task of creating andmaintaining large web sites.

    Background

    Soon after we began creating web pages in 1994, itbecame clear that typing HTML les by hand is tediousand cumbersome, and we began to search for tools tosimplify the repetitive task of HTML generation.

    Early on, we discovered and started to use an HTMLpreprocessor named hsc. This tool supported gener-ation of pages from templates by dening new markuptags and controlling how these tags would be trans-formed into HTML, somewhat like XML/XSL does now.

    Unfortunately hsc had certain limitations: It didn'tsupport local variables, and there were no controlstructures except conditionals. Even arithmetic wasnot possible. Our rst web sites developed with this

    system consisted of a mix of hsc macros and Perlscripts that generated hsc source les.

    In 1998, hsc's author halted further development,and we became quite motivated to nd an alternative.

    At rst we decided to continue development of hscourselves, and planned to make it compatible withXML, which was beginning to become popular at thetime. But extending hsc, which is written in C, provedquite dif cult. For example, adding Unicode supportrequired rewriting the entire I/O system. It becameclear that we needed to nd another toolset for our

    web development.XIST is Born

    Around this time we discovered Python and decidedthat it might be a good way to completely rewrite hscfrom scratch. Python includes XML parsing capabilitiesthat we felt could be used as the basis for our work:

    XIST: An XML TransformationEngine Written in Python

    Dr. Walter Drwald and Dr. Alois Kastner-Maresch

  • 8/7/2019 Python Success Stories

    9/31

    Instead of writing macros in hsc, we couldwrite XML that could be processed througha simple mapping from XML element typesto Python classes.

    In this approach, XIST generates anextended Document Object Model (DOM)on parsing each XML le. Classes denedfor each element in the le are instantiatedas the DOM is generated, and methods onthe classes are used to perform the necessary

    XML transformations during page gener-ation. This allows us to realize our webtemplates with the full power of anobject-oriented scripting language.

    During implementation, we found that allof the key features of hsc could be supportedquite easily in Python:

    Automatically calculate image sizes?

    The Python Imaging Library does thiswith ease.

    Parse XMLles? There are several XMLparsers available in Python.

    Load and store XML to and fromdatabases? The Python DB-API isstandardized and modules exist forMySQL, Postgres, Interbase, Oracle,

    ODBC, Sybase, and others. Fetch XML from the web? Pythons

    urlparse and urllib standard libraries weremade for that. Handle Unicode? Python2.0 fully supports Unicode out of the box.

    Implementing the rst prototype versiontook a few weeks of spare time pro-gramming and turned out to be very

    successful. Python provided a much shorterpath from concept to implementation thanany of the other programming languageswe have used. And so XIST was born.

    XISTs development continued in Pythonand today XIST is the basis of a successfulcompany which employs 15 people. XIST

    is now used in all of our web projects atLivingLogic AG.

    Content Management with Python and JSP

    On top of XIST, LivingLogic has developeda content management system calledXIST4C (4C means Content, Community,Collaboration and Commerce). This systemcombines the advantages of XIST'sabstracted page layouts with pre-compi-lation of page templates to Java ServerPages that are ultimately used to deliverthe content to the web.

    By using XIST tag libraries instead of JSPtag libraries we are able to build optimized

    Java Server Pages that run considerablyfaster than their JSP tag library counter-parts, without any changes to the JSP les.This performance gain is a result of the fact

    that the XIST preprocessor takes care of many compute-intensive operations, thatmight require dynamic type introspection,string processing etc. and would beexecuted by the Java tag library codeduring page load.

    Fast development combined with lowhardware requirements make XIST4C

    especially suitable for small and medium-sized enterprises. This has allowed us toachieve a unique competitive advantage,and to realize projects at a much lower cost.

    Prototyping Java Systems with Python

    In 2000, LivingLogic was engaged todevelop a product for modeling businessprocess work ow and to automate business

    processes. Inspired by our earlier successeswith XIST, we decided to develop a Pythonprototype. This decision was made eventhough our contract required us to producea Java-based prototype for delivery to a largegroup of developers that would turnit into a marketable product.

    7

  • 8/7/2019 Python Success Stories

    10/31

    The approach of using Python early inprototyping made it possible for us to studyconcepts using working code almost fromthe start of this project. Although we hadto rewrite our Python prototype in Java, theoverall time spent on prototyping was lowerthan we have seen in other projects thatused only Java.

    Conclusion

    Python is easy to learn and use, producesmaintainable code, and packs enough

    power to make it a suitable choice for manyapplication domains and project sizes.

    Some of the features that we like bestabout Python include:

    Pythons extensive standard library and aconsiderable range of available third partypackages support development in manyapplication domains.

    An unsurprising syntax and thewidespread and consistent use of afew basic concepts, like namespaces,help to make Python code readableand maintainable.

    Extensive and easy to use introspectionfacilities make Python easy to learn inter-actively by discovering its capabilities,including documentation, from thecommand prompt.

    Python is readily extensible in C or C++,so it is easy to incorporate non-Pythonmodules into an application.

    Python has played an important role inthe success of LivingLogic AG, and willcontinue to be the basis for most of oursoftware development efforts.

    8

    XIST: An XML Transformation Engine Written in Python , continued

  • 8/7/2019 Python Success Stories

    11/31

    9

    IntroductionTo be the industry leader in managed hosting, youhave to be fast and flexible. By using Python toimplement our enterprise data systems, Rackspacecan quickly and effectively change its internal systemsto keep up with shifts in the industry and in our ownbusiness processes. We do this through a centralcustomer information system called CORE, whichis used both for Customer Relationship Management(CRM) and Enterprise Resource Planning (ERP).Python and CORE are key factors that enableRackspace to provide our Fanatical Support(tm)and faster customer service.

    Background

    Rackspaces central customer database started as asimple ERP system to provision and track managedservers. It began humbly, as a small collection of PHPpages that did the job nicely for the few hundredservers that was the beginning of Rackspacescustomer base.

    As Rackspace grew, that small PHP system becamethe center of business at Rackspace. Every time anopportunity to automate a process presented itself,it was rolled into that system.

    After a couple of years, the result was a big, un-maintainable mess of thousands of PHP pages andmodules that had been written and maintainedprimarily by one person. The limits of PHP (thenversion 3) had been stretched thin, the system wastoo much for one person to maintain, and it wasdif cult to bring in new people to help with it.

    Our rst attempt to update the system came when PHPversion 4 was released. This release promised betterobject-oriented capabilities, and the time was right forRackspace to dedicate more people to the project.

    The system was totally redesigned from the groundup, including new database schemas and applicationdesign strategies. At this time we re-dubbed theproject CORE, an acronym for Core Objects Reused

    Python is Rackspaces CORE TechnologyNick Borko

    About the AuthorNick Borko is the Director of Internal Application

    Development and the project

    manager for Rackspace s enterprise database application,

    CORE. Rackspace Managed

    Hosting is the leader in deliv-

    ering managed hosting services to small and medium enter-

    prises. All customer platforms include state-of-the-art data

    centers, customized servers,

    burstable connectivity, 99.999% uptime SLA, a dedicated

    account manager, instant

    emergency response and access to live expert

    technicians 24x7 for support

    of all hardware and core software. Founded in 1998

    and headquartered in San

    Antonio, TX, Rackspace manages servers for

    customers in more than

    eighty countries.

    www.rackspace.com

  • 8/7/2019 Python Success Stories

    12/31

    Everywhere, in order to re ect the overalldesign goal for CORE: modularity andreusability across all systems in the company.

    With that goal in mind, our team went towork using the object-oriented features of PHP.

    While we were able to re-t the applicationand add increased functionality, the projectultimately failed due in large part to theproblems encountered while using theobject framework provided by PHP.

    Memory leaks, inconsistent interfaces, incon-

    sistent internal data models, randomly freedobjects, multiple object copies despiteexplicit use of references, internal PHP errors,and untraceable code failures made thetask all but impossible to accomplish in PHP.

    Even after we achieved a relatively stablecode base, we were nowhere near ourgoal of Core Objects Reused Everywherebecause we had to depart from pure object-oriented methods just to work around theproblems inherent in PHP. It became clearthat PHP was unsuitable for our large scale,mission critical projects. A new solutionhad to be found.

    Python in CORE

    We had always considered Python to be anexcellent candidate for implementing ourenterprise system, but it was initially passedover in favor of building upon the existing(vast) code base we already had in PHP. Atthat time, we felt that PHP could be usedsuccessfully in CORE by introducing abetter structured system design.

    Unfortunately, that wasn t enough toovercome our other problems with PHP,so we re-evaluated our situation. The rstalpha version of Python 2.2 had recentlybeen released, and we decided to beginwork on a new CORE framework usingthe new features that were available inthat version.

    The Power of Introspection

    One of the rst tasks in writing the newframework was to build its database interface.

    Pythons introspection model had beensignicantly enhanced with the release of Python 2.2. We decided to use it to build ageneric database interface class, based on aDBI 2.0 compliant database connector. Inthis approach, rather than writing queriesor table-specic wrappers by hand, a meta-class abstracts all database queries into a

    single clean API. We create descendents of this meta-classto make an API for each table. Each tablesclass contains a few class constants thatdescribe the columns in the database. Thisway we can add new tables to the overall

    API quickly and simply without having toworry about implementation details forany specic table.

    The API also uses meta-data to automati-cally validate and convert values passed tothe database. This is done by a normalizerfunction that converts the Python data typesbeing passed through the API into validSQL values. The function also veries typesand formats that are not necessarily checkedby the database or by Python, such asphone numbers and ZIP codes.Reusing Objects Everywhere

    Once the database API was complete, wecreated a second layer of classes on top of it. This higher level API implements thebusiness logic for specic applications, suchas contact management or trouble tickethandling. It also prevents users fromperforming operations that are inconsistentwith Rackspaces business practices, orassigning data that would result in othertypes of high-level corruption of the datain the database.

    With the creation of this second layer, we

    10

    Python is Rackspaces CORE Technology, continued

  • 8/7/2019 Python Success Stories

    13/31

    11

    achieved our original goal of Core ObjectsReused Everywhere. Programmersthroughout the company began to use this

    API to implement interfaces to applicationfunctionality. This required little interactionwith our API development team, and it couldbe done without fear of misusing the API.

    While we designed the API primarily forCORE, the central enterprise application, itis reused in a number of other systems atRackspace. For example, one group built aSOAP server on top of the API, in order toaccess it from their PHP applications. Otherapplications use the API directly, and it has beenextremely gratifying to see our work reused andintegrated so easily with other systems.

    Integrating Python with Apache

    With the API in place, our next task indeveloping CORE was to find a usefultemplating module to integrate our Pythoncode with HTML pages running on the

    Apache web server.

    After looking at a number of availablePython-based templating modules, we optedto create a simple parser of our own. Ourapproach was to convert server-side templatepages into Python servlets whose output issent by the HTTP server to the user s browser.

    Although this was a fairly simple exercise,we did run into some problems stemmingfrom our design of the CORE databasemeta-class. We found that altering classesand modules at runtime, as is done by themeta-class, violates guidelines imposed byPythons optional restricted executionenvironment. Since we felt that restricted

    execution was a necessary component insupporting a persistent web module, we optedto deploy CORE using CGIs rather thanmod_python or similar persistent solutions.

    Since fast hardware and multiple servers arereadily available, and since our template

    parser pre-compiles and caches the Pythonservlet code that it produces, the CGIsolution is suf cient for our needs. It also

    allows us to resolve issues such as databaseconnection pooling and restricting theexecution environment outside of Python.

    Unit Testing

    Thanks to the unit testing module thatcomes with Python, our projects arereaching production with far fewer bugsthan we had ever thought possible when

    we were using PHP. During maintenancewith PHP, there was always a question of whether a change in one place would breaksomething else in another part of the application.

    We now write unit tests for each andevery API as the API is being designed.This means that we can verify the changesin one module as well as its effects on allthe others simply by running the unit testsfor the entire API.

    Since introducing Python and unit testing,the nature of the bugs that we see indeployed applications has shifted to includeprimarily those in the user interface, such aslayout problems or faulty event handling.

    These days, very few bugs come from the API itself, and even those are generally theresult of poor revision management or DBAcoordination during applicationdeployment. Python can t solve _all_problems during development, but itcertainly has reduced the number of criticalsystem defects for us.

    Documentation

    Lack of documentation has been a majorproblem with our previous developmentefforts. We tried several tools and policiesto document our PHP efforts, but in the endthese failed. Code changed too quickly, andthe code-level documentation tools available

  • 8/7/2019 Python Success Stories

    14/31

    for PHP at the time were too finicky to justify the amount of effort required to getthe documentation to parse correctly.

    Additionally, despite careful planning andcoding strategies, the mixture of PHP andHTML made deciphering and under-standing the code more dif cult.

    Fortunately, Python was designed withdocumentation in mind, with the use of doc strings for modules, classes andmethods. Since documentation is actuallya part of the language itself, and pydoc is astandard module in the Python distribution,it was easy to extract API documentation toHTML and other formats.

    Over time, we have found that the syntacticstructure of Python makes for extremelyreadable code, and that in itself helps inthe overall task of documenting andmaintaining code.

    Conclusion

    Python has dramatically improved devel-opment processes for the CORE project,

    and it has led to the faster developmenttimes and more rapid releases that allowus to keep up with Rackspace s ever-changing business processes.

    Python enabled us to create a sophisticateddynamic data model that is exible and easyto use for abstracting database operations.

    With it, we realized our goal of CoreObjects Reused Everywhere.

    Pythons integrated unit testing and documen-tation tools greatly enhance our ability todeploy and maintain a more stable, error-free product.

    The result is a successful enterprise appli-cation that is instrumental in the deliveryof Rackspace Managed Hostings promiseof Fanatical Support, Unmatched Speed,and Unlimited Flexibility in the managedhosting industry.

    12

    Python is Rackspace s CORE Technology, continued

  • 8/7/2019 Python Success Stories

    15/31

    13

    Introduction

    Consultants naturally try to provide their customerswith the best solutions for a problem. Sometimes thismeans exploring new areas together with the customeror directing the project into a solution space that betterfits the problem than the usual buzzword-compliantapproaches. We ve seen these fail too often, misleading

    the project into solving problems relating to theselected technology, rather than meeting the originalproject plan.

    Python Goes Fortune 500

    In a recent project for one of our customers, we faceda problem that is quite common in Fortune 500companies: Multiple clients running on unmanageableclient machines are tied closely to complicated

    database relationships, making management andfurther development very dif cult.

    Thanks to the marketing efforts of several large servervendors, our solution space was quickly identified.

    What the company needed was Web Services, or putsimply, a way for a client application to talk to theserver side in a reasonably standardized manner. Ourcustomer was already using two of the dominant

    technologies in this area: Microsoft .NET and BEAs WebLogic J2EE server.

    When we came into the project, a team was alreadytrying to solve some of the company s problems usingthe J2EE platform. However, we found that they werespending more time trying to work around designproblems in the technology than actually writing codefor the services. Since the company had already beenintroduced to Python in a smaller XML project, wewere able to convince the project lead to try a newtechnique based on Python.

    The idea was to leverage the efficiency of Pythonprogramming together with its good database connec-tivity to compete against the J2EE team. What we

    Putting Web Services to Work with PythonDr. Tim Couper, Marc-Andre Lemburg,

    and Siena Technology Ltd.

    About the Authors

    Dr. Tim Couper (tim@siena-

    tech.com) is the chairman of Siena Technology. He holds a

    mathematics D.Phil. and has

    twenty years experience running software companies.

    He now spends most of his

    time consulting as architect and technical lead for large

    development projects, and has

    been extensively involved in planning and coordinating the

    2002 and 2003 Python UK

    conferences.

    Marc-Andre Lemburg

    ([email protected]) is the

    Chief Technical Of cer (CTO)of Siena Technology. He holds

    a degree in mathematics from

    the University of Duesseldorf.Marc-Andre has been working

    with Python since 1993, is a

    Python Core Developer, board member of the Python

    Software Foundation (PSF),

    author of the well-known eGenix.com mx extensions

    (mxODBC and mxDateTime),

    and was one of the executive organizers of EuroPython 2002.

    www.siena-tech.com

  • 8/7/2019 Python Success Stories

    16/31

    14

    needed was a stable and robust serverimplementation and a exible way to writeand publish Web Services. Fortunately, the

    server had already been written in the formof the easily extensible eGenix.com Application Server, so our task was simplyone of adapting this server to make writingservices as easy as possible.

    Keep IT Simple, But No Simpler

    Following the Python paradigm of obviousis better than obscure, explicit is better than

    implicit, we chose the most straight-forward possible way of dealing with WebServices: Each service was mapped to aPython class, which provided the publicmethods to call from the client application.There were two reasons that we felt thatservice implementations should look nodifferent than any standard class implemen-tation in Python: (1) a programmer shouldnot need to learn a new way of coding justto be able to write services, and (2) existingintegrated development environments(IDEs) should be used to make codingservices even easier.

    Since Python is an object-orientedprogramming (OOP) language in allrespects, the implementation we chose

    placed basic shared functionality into aService base class that hides networkedserver interaction from the programmer.

    As a result, the service developer onlyneeds to think about the business logicin the service methods and can rely on theserver to automatically provide databaseconnection pooling, protocol handling,transaction control, and all the complicatedinteractions that are needed to make aserver side implementation robust.

    Client-side Bliss

    Another design goal for the system was tosimplify client-side programming as muchas possible, in order to make it easy to adopt

    the new technique. Just as service writersshouldnt need to think about low-leveldatabase connectivity, we felt that client

    application programmers shouldn t bebothered with the details of setting upconnections and talking to the server side.

    We wanted to design a very simple appli-cation programmer s interface (API) whichwould hide all the complications inherentto networked client/server interaction.

    Client side agents for Java and Windows COM interface made this possible by enablingaccess to the Web Services from all majorclient application environments such as

    Visual Basic (VB), Visual Basic for Applications (VBA as used in Word, Excel,and Access), Delphi, C++, Java, C# andothers. These not only hide the protocollevel from the application programmer,but also provide the key to enabling

    security and fail-over solutions. Web Services standards are still in theplanning stage, and it is not at all clearwhich of the proposals will be acceptedby standards organizations. By creating atrue middle tier, we were able to hide theparticular methods and protocols we choseinside of the Siena client and server, andwere free to use existing security standardsand authentication modes to build a securecommunication channel.

    Above and Beyond Web Services

    With these basic building blocks, we weremoving towards realizing the Siena WebServices Architecture, which included aPython-based server side, a COM clientside agent (also written in Python), anda Java client side agent.

    One distinct advantage of writing both theserver side and COM client side of our WebServices architecture in Python was that wecould automatically replicate services fromthe server to the client side. This was

    Putting Web Services to Work with Python, continued

  • 8/7/2019 Python Success Stories

    17/31

    possible whenever a service did notdepend on database connectivity or otherelements specific to the server-side

    environment. Python s data packagingfacilities and portable byte code formatmade this operation quite easy toimplement. The result was a signicantboost in application performance, reducednetwork bandwidth requirements, reducednetwork latency, and increased serverperformance, all without sacri cing theefficiency of centralized server-side

    management that makes Web Servicesso attractive to IT management.

    The Python Mantra

    Still missing in our plan were the skillsneeded to code Python servers and clients.Most of the programmers in our team knewonly a mix of Java, Visual Basic, and C++.

    While the J2EE group was working on

    solving J2EE problems, we invested a dayin teaching Python to the rest of the team.Python wasted no time making its way intothe hearts and minds of these programmers.It was a thrill to hear fellow programmerschiming in with our own Python mantra:This is what Ive always been looking for.

    Results

    Happy programmers are good programmers,and good programmers work ef ciently.Thats what project management learnedat this point in our effort. The group s WebServices programmers quickly caught on tothe new Python-based system and devel-opment progressed at amazing speed.Services could now be implemented in afew minutes rather than the days neededusing the typical J2EE approach. Now mostservices were completed and deployed inless than a day, and the ease and speed withwhich they can be modi ed and tested hasmade an incremental approach to service

    development possible. And IT managementwas excited to see the overall highperformance of our solution.

    The Siena Web Services Architecture hasbecome a crucial mission-critical componentfor this customer, as it moves from a two-tier to three-tier architecture and addsfail-over and security to their Web Services.

    The Siena Web Services Architecture willsoon become part of our product line. If you are interested in the solution, please

    visit our website at www.siena-tech.com/ or contact us directly.

    PS: After several months of effort, the J2EE team never did get their WebServices working.

    15

  • 8/7/2019 Python Success Stories

    18/31

    Introduction

    Software engineers have long told their bosses andclients that they can have software fast, cheap, orright, as long as they pick any two of those factors.Getting all three? Forget about it!

    But United Space Alliance (USA), NASAs main shuttlesupport contractor, had a mandate to provide softwarethat meets all three criteria. Their experience withPython told them NASAs demands were within reach.Less than a year later, USA is nearing deployment of a Work ow Automation System (WAS) that meets orexceeds all of NASAs specications.

    Python allows us to tackle the complexity of programslike the WAS without getting bogged down in thelanguage, says Robin Friedrich, USAs Senior Project

    Engineer. Friedrich conceived of the WAS project inresponse to a significant gap in the way shuttlemission planning was handling data management.Historically, Friedrich says, this data has beencommunicated using paper and, more recently, datafile exchange. But both of these approaches areerror-prone. Catching and fixing errors as well asresponding to frequent change requests can bogsuch a system down. Complicating the issue wasthe challenge of nding money to improve the ightdesign process in an era of declining budgets forspace activities.

    Just in time Provides a Solution and More Problems

    USA decided they needed a way to minimize datachanges and the resulting rework. The shortest routeto that goal would be to shift the design work to theend of the process so that ight characteristics wouldhave a good chance of already being nalized. In otherwords, as Friedrich says, We decided we needed todo this data management work just in time.

    A just-in-time solution, however, generally puts morestress on both people and systems to get things right

    About the Author

    Dan Shafer is a freelance author and sometime Python

    coder who hangs out on

    California's central coast. He is a member of the PythonCard

    Open Source development

    team creating a GUI-building framework for Python applica-

    tions. He makes his living as

    a writer and a product devel- opment consultant. A founder

    and former editorial director

    of Builder.com, Shafer has been part of the web devel-

    opment community almost from its inception.

    This article was previously publised on Builder.com

    Python StreamlinesSpace Shuttle Mission Design

    Daniel G. Shafer

    16

  • 8/7/2019 Python Success Stories

    19/31

    17

    the rst time because postponing theseactivities to the end of the process meansa loss of scheduling elasticity.The obvious answer, according to Friedrich,was to create a central database repositoryto help guarantee consistency and to providehistorical tracking of data changes. AnOracle database was designed to store theinformation, but a graphical front end tomanage the process of workow automation

    was clearly an essential component of aneffective solution. We knew from experience we do a good bit of Java coding in ourgroup that using C++ or Java would haveadded to the problem, not the solution, Friedrich maintains.

    Python a Mainstay Since 1994

    Enter Python. I literally stumbled across

    Python as I was searching the pre-WebGopher FTP space for some help with aC++ project we were doing, says Friedrich.Being an inveterate systems engineer,Friedrich just had to investigate it. Hewas stunned by what he discovered.

    Twenty minutes after my rst encounterwith Python, I had downloaded it, compiled

    it, and installed it on my SPARCstation. Itactually worked out of the box!

    As if that werent enough, further investi-gation revealed that Python has a numberof strengths, not the least of which is thefact that things just work the rst time.No other language exhibits that trait likePython, says Friedrich.

    He attributes this characteristic to threeprimary language features:

    Dynamic typing Pseudocode-like syntax The Python interpreter

    The result? We achieve immediatefunctioning code so much faster inPython than in any other language thatits staggering, says Friedrich. Java andC++, for example, have much more baggageyou have to understand just to get afunctioning piece of software.

    Python also shines when it comes to codemaintenance, according to Friedrich. Without a lot of documentation, it is hard

    to grasp what is going on in Java and C++programs, and even with a lot of documen-tation, Perl is just hard to read and maintain. Before adopting Python, Friedrichs teamwas doing a good bit of Perl scripting andC++ coding. Pythons ease of maintenanceis a huge deal for any company that has anysignicant amount of staff turnover at all, says Friedrich.

    The team had already developed a moder-ately large number of C++ libraries. Becauseof Pythons easy interface to the outsideworld, USA was able to retain theselibraries. We wrote a grammar-based toolthat automatically interfaced all of our C++libraries, says Friedrich.

    Another aspect of Python that Friedrichfound eminently signicant is its shallowlearning curve. We are always under thegun on software projects, like everyoneelse, he says. But for any programmer,picking up Python is a one-week dealbecause things just behave as you expectthem to, so there s less chasing your tail andfar more productivity. He contrasts that

    with C++ and Java, which he says takes agood programmer weeks to grasp andmonths to become pro cient.

    Friedrich says that even the non-programming engineers at USA learned todo Python coding quickly. We wanted to

  • 8/7/2019 Python Success Stories

    20/31

    draft the coding energy of the engineeringstaff, but we didnt want them to have tolearn C++. Python made the perfect 4GL

    programming layer for the existing C++classes.

    One Coder and 17,000 Lines of Code Later

    The WAS project, which has required some-what less than a man-year of effort, has beencoded by a single senior software engineer,Charlie Fly, who has cranked out some 17,000source lines of code (SLOC). Python plays

    the central role, managing data interactionsand the task network.

    In the system, user tasks communicate witha Python data server, which in turn connectsto an Oracle server via DCOracle. UsingOracles built-in trigger mechanism to senda message to WAS as data records areupdated, the WAS calculates which tasksare now data-ready and noti es theappropriate user.

    At the core of the design is the Task object,which stores all information relevant to asingle task in the workow network. The

    end user can view the network in a PERT-style chart layout, where color codingreveals at a glance which tasks are nished,which are in process, and which have notyet been started.

    Two other graphical interface windowsallow the user to manage the dependenciesamong data items in the network and toview and edit individual task details.

    All of the code for the UIs was also donein Python, using the popular Tkinter libraryalong with an open source package of supporting modules. Tkinter is includedin all standard Python installations.

    USA is pleasantly surprised by how muchquality software we can deliver, Friedrichsays. And each time we demonstratesuccess with Python, we add a few morebelievers to my growing list!

    Python Streamlines Space Shuttle Mission Design, continued

    18

  • 8/7/2019 Python Success Stories

    21/31

    19

    Introduction

    Wing IDE is a commercial integrated developmentenvironment for the Python programming language.

    Wing provides developers with a full-featured sourceeditor, debugger, code browser, and many other toolsspecically designed for use with Python. Wing workswith all forms of Python, whether running as a stand-

    alone app, under a web server, or in a customembedded scripting environment. Several GUI layers(wxPython, PyQt, PyGTK, and Tkinter) are supported,as are Zope and mod_python for web development,and pygame for game development.

    Wing was inspired in 1999 by several experienceswe, its developers, had using Python alongside othertechnologies. At that time, we were working as

    consultants charged with evaluating a number of alternatives for tiered web development. Some of these were based on Java and some on Visual Basic,MTS, and ASP. Concurrently, we happened to be usingPython to prototype some of the functional require-ments for the web-deployed business applicationswe were developing.

    It wasnt long before we found ourselves comparingour Python prototypes favorably to the actual systemswe were developing. Python was a much moreproductive way to work, and it seemed to resultin at least as good an end product.

    Unfortunately, our clients never seriously consideredPython simply because it wasnt a mainstream (namely

    Java or Microsoft) technology. But it was clear to usthat Python could have been a signi cant cost saverand competitive advantage for them, and we saw abusiness opportunity in helping other organizationsbenet by using Python.

    Development Approach

    Work on Wing IDE started almost right away, in mid-1999, initially on a part-time basis. We realized that

    Wing IDE Takes Flight with PythonStephan R.A. Deibel and John P. Ehresman

    About the Authors

    Stephan R.A. Deibel has been

    designing and developing software for almost twenty

    years. He has worked exten-

    sively in medical informatics and as a software consultant.

    Before nding Python, his

    projects included one of the rst Macintosh-based multi-

    media authoring systems and

    an early CORBA implemen- tation. Stephan is now CEO

    and co-founder of Archaeopteryx

    Software, Inc., makers of

    Wing IDE.

    John P. Ehresman has been

    programming for more than ten years in medical informatics

    and as a software consultant.

    He has been using Python since version 1.2 and is now

    co-founder of Archaeopteryx

    Software, Inc.

    www.wingide.com

  • 8/7/2019 Python Success Stories

    22/31

    20

    writing an entire IDE wasnt going to beeasy and wanted to be sure that Pythonwas really as good as it appeared to us at

    the time. The logical way to approach thiswas to develop the IDE itself in Python.This would give us proof of concept andlet us become early users as we started todevelop and debug Wing IDE with itself.

    To speed development and keep costsdown, we chose to base Wing on as manyopen source modules as we could nd.The GUI was written with GTK, whichis accessed from Python via PyGTK. Thesource editor is based on Scintilla, anopen source code editor component.

    And printing is implemented viapy2pdf from ReportLab.

    Initial development was on Linux butwe planned to support at least Windowsand eventually other Unix-like operating

    systems. For this reason, we avoidedplatform-specic implementations andchose cross-platform technologies.

    Additional development tools used inthe project included gcc, Gnu make,latex, pdatex, latex2html, emacs/xemacs(before Wing was functional), VisualC++ 6, and cygwin.

    Results

    Our work on Wing IDE has been quite asuccess. We were able to develop fasterthan we originally expected, and to deliver

    Wing IDE on Linux, Windows 98 throughXP, Mac OS X with XDarwin, Solaris, andFreeBSD without major platform-specicdevelopment work. Today, our product is

    receiving good reviews and is selling well. All of this has been possible without anyoutside funding and with a developmentteam of just two people.

    The biggest benets of using Python havebeen in overall productivity, cross-platformdeployment, speed of the resulting appli-

    cation, scalability, rock-solid stability, andits strong support for mixed-languagedevelopment.

    ProductivityOver the course of this project, we havebeen able to write on average over 175lines of debugged, documented, testedcode per developer per day. Over a periodof 660 FTE days, we produced a total of approximately 121K lines, of which 77Kwere written in Python. Even without

    considering that a line of Python is typicallyequivalent to ten or more lines of C, wewere extremely pleased with this result.

    The entire product, including third-partyopen source modules, actually containson the order of 1.2 million lines of code,of which 274K lines are Python.

    So why was using Python so productive,

    even when only 63% of the code we wrotewas in Python? There are several answersto this question:

    1) Simple syntax Although use of indentation to indicate program structuresometimes turns off rst-time Python users,the reduced typing burden that comes withavoiding {}s and similar syntactic sugardoes matter over the course of writingand rewriting hundreds of thousandsof lines of code.

    2) Dynamic high-level data typingLackof strong data typing, another commonlycited weakness in Python, is in practicea signicant advantage for most kinds of software development. The bottom line isthat you don t need strong data typing inthe context of a language like Python.Common coding errors are caught anywayby the type system: You still cant add anumber to a string, reference past the endof an array, or call a non-existent classmethod. Dynamic high-level data typingcuts out great volumes of support code

    Wing IDE Takes Flight with Python, continued

  • 8/7/2019 Python Success Stories

    23/31

    21

    and makes it possible to write exible andintrospective code (more on this below).

    3) Powerful, easy-to-use data structures

    Pythons built-in list and dictionary datastructures can be used in combination tobuild just about any fast runtime datastructure in a snap. This further reduces theamount of support code you need to write.

    4) Extensive standard libraryPython comeswith a vast standard library supportingeverything from string and regular expression

    processing to XML parsing and generation, Web Services tools, and internet protocolsupport. Many common programmingtasks have already been built into thestandard library, making it possible to domore with less code. Third-party modulesare also available for database access, CORBA,COM, statistics, math, image processing,and much more.

    5) Introspection Pythons exible datatyping system extends also to code docu-mentation, classes, methods, and even theway in which methods are called. Pythonmakes introspection extremely accessibleto the programmer and, remarkably,introspective code remains readable andmaintainable. This can be very useful in

    redirecting I/O to classes of your owndesign, writing a tracer that determinescode coverage, packing up data to storeon disk or send over the network, devel-oping glue code, writing table-drivenalgorithms, extracting documentationfrom code at runtime, applying design-by-contract development methods, andin building various types of meta-classes.For almost every programming task,Python makes it not only possible butquite easy to build meta-code where onemight otherwise end up building gobsof manually crafted code.

    6) Faster development and deeperprototyping Python increases speed of development to the point where proto-

    typing can be integrated into andinterleaved with the primary developmentprocess. When it takes only half a dayto try out a new approach to a problem,rather than the week it might take in Cor C++, programmers are more oftenempowered to rework existing imperfectcode, and to try out new ideas. This resultsin the more rapid incorporation of experience

    into an application s design, and leads tohigher code quality.

    Cross-platform Deployment

    Wing IDE runs on a variety of Posix

    operating systems and Windows. Through-out our development process, we ve beenvery happy with the way that Pythonperformed across platforms. The same

    Python source or compiled Python bytecode files can be shipped to clientsregardless of target platform, makingsupport quite easy.

    Speed, Scalability, and Stability

    When we started to write in Python, ourprevious experience in compiled languagesled us to believe that we would be spendinga fair amount of time either optimizingcode or converting it into C or C++ oncewe had prototyped it. As it turned out,most of the time Python produced asnappy end product that didn t requireany extra work.

    This happened partially because mostPython code is really just a thin interpreted

    layer over functionality that is written in Cor C++. In our case, this included not justPythons fast built-in data structures andstandard libraries, but also the bulk of theGTK GUI development layer and theScintilla source editor.

  • 8/7/2019 Python Success Stories

    24/31

    22

    In the course of development and inresponding to thousands of support ticketsover a three year period, we have never run

    into any signicant problems with Pythonitself, either in scalability or stability. WingIDE can handle software projects withthousands of Python files, and in manycases can run for weeks without problems.To our knowledge, we have yet to see WingIDE crash because of a aw in the Pythoninterpreter or its standard libraries.

    Mixed-language Development

    Python is almost always fast enough butwe did run into a few cases where theinterpreter introduced too much over-head. The Wing IDE debugger andthe source code analysis engine bothcontain modules that engage in extremelyCPU-intensive processing. These modulesneeded to be written in C in order to

    squeeze out as much speed as possible.Fortunately, Python is designed to make itquite easy to call back and forth betweenPython and C or C++.

    In most cases, we wrote and debuggedcode rst in Python, and then convertedby hand into C. This approach workedwell for us. Working initially in Python

    was much more efficient and theconversion process relatively painless.

    Analysis of our records shows that 360days were spent on 77K lines of Pythoncode and 300 days (almost as much) on44K of C, C++, or other code. From ourexperience with code conversions, webelieve it is roughly correct for most typesof performance-critical code to equate oneline of Python with ten lines of C or C++code. This means that about 5-10% of ourapplication functionality is in C or C++and the rest is in Python. Even consideringthat the C/C++ code is somewhat morecomplex than most of the Python code,

    these results confirm without any doubtthat working in Python is far moreproductive than working in C or C++.

    In hindsight, we believe that we couldhave converted smaller units of code intoC, by writing more general data-drivenprocessing engines and by more carefullyselecting code to convert instead of converting whole modules at a time. Ourprimary goal for Python in the future is tobe able to use it more often, even inperformance-critical sections of code.This effort should benet from projectslike pyrex, which allows the use of Python-like code in the development of compiledextension modules, and psyco, which is a

    just-in-time compiler for Python.

    Quirks

    There are just two quirks that affected ourdevelopment with Python. The relativeimpact they had on our project was tinycompared to Python s benefits, but forbalance we feel they are worth mentioning:1) Like Java and other languages, Pythonoccasionally deprecates old features, orxes minor bugs in a way that can poten-tially break existing code. This is done overthe course of a number of releases, so that

    programmers will first see deprecationwarnings, and only later be impacted bythe change. We ran into this only oncewhen Python 2.0 began to disallowmultiple arguments to the sequence appendmethod. This problem required changingexactly three easily found calls in our codebase of over 77K lines of Python.

    2) Different versions of Python can produceincompatible compiled byte code andrequires that C/C++ extension modulesare compiled against a specic version of Python. For example, while Python 2.2.2

    Wing IDE Takes Flight with Python, continued

  • 8/7/2019 Python Success Stories

    25/31

  • 8/7/2019 Python Success Stories

    26/31

  • 8/7/2019 Python Success Stories

    27/31

    25

    about code during development and morecriticallyduring later maintenance. The fact

    that Python is so easy to learn has been quiteuseful as well.

    Job Vacancies Facility

    One of our earliest Python projects was afacility for university job vacancies. Thiswas implemented using Zope, an innovativePython-based web application server thatprovides a range of web components plus

    powerful facilities for templating andintegration. I started the project with acolleague who had more experience in webdesign than programming. After some time,we found that Python s powerful simplicityenabled my colleague to improve hisprogramming skills rapidly, to the pointwhere he was able to continue developmentof the system by himself. Zope itself alsohelped in this regard, by reducing theamount of programming that needed tobe done in the rst place.

    Student Record System

    One of our larger projects was a systemfor managing student records. It employs amodel-view-controller architecture in orderto promote reuse. Presentation is handledby Cheetah, an open-source templatingtechnology for Python. The interfacebetween Python and the underlying Oracle

    database is handled by the high-qualityDCOracle2 driver made freely availableby Zope Corporation.

    Matching Students with Classes

    Python was also used for a web-basedsystem that managed the process of matching students with the classes theywished to take in the coming year. Thesystem was used by most of our studentsand a number of our staff for various stagesof the process from selecting preferences

    in the spring and summer, through tonal validation during matriculation at

    the start of the new academic year. Thesystem implemented work- ow andnotication mechanisms.

    Because of the number of concurrent usersthat the system was expected to support,particularly during matriculation, we feltthat a traditional CGI approach could leadto performance problems. Instead, we

    employed mod_scgi, an Apache modulethat implements the client end of the SCGIprotocol for long-running web processes(similar to FastCGI). The server end of the SCGI protocol was implemented byQuixote, a Python-based web framework.Quixote also provided a URL mappingmechanism that simpli ed the job of publishing objects on the web. Cheetah

    was again used for handling presentation,and Oracle was used for storage.

    We were assigned this project somewhat latein the process, and it was clear that it wouldcome into active use while parts of it werestill being developed. To support this, weplanned to deliver the system in stages, butwe were aware from the outset that many of

    the system requirements still had to bediscovered and understood. We knew thiswould lead us to rewrite parts of the systemas we went along and worked to obviatethis with design decisions aimed at decou-pling the systems components. Python sdynamic nature and supreme flexibilitymade it easier to write generic interfaces,which later facilitated the rewriting andrefactoring tasks we had to undertake.Conclusion

    Since switching to Python, we are writingbetter structured and more readable codein less time ... and it s fun! I cant think of a better testament to a programming tool.

  • 8/7/2019 Python Success Stories

    28/31

    26

    Python Powers Journyx TimesheetCurt Finch and John Maddalozzo

    About the Authors

    Curt Finch, Journyx founder and

    CEO, started the company in 1996 after a successful career

    in the consulting industry

    participating in and managing engagements with Fortune 100

    companies such as Tivoli , IBM ,

    and Prudential Securities.

    John Maddalozzo, Journyx V.P.

    of Engineering, joined Journyx

    in 1999 after a twelve year career in Unix kernel devel-

    opment at IBM s AIX

    Engineering group.

    www.journyx.com/

    Introduction

    Journyx Timesheet (tm) is a commercial applicationthat provides time, expense, and project tracking. In1996, Curt Finch, Journyx CEO and founder, wasworking in the staf ng industry when he saw anopportunity to use the Web to accurately collect andstore employee timesheet information.

    The rst version of Timesheet focused on collectingaccurate cost information, with an eye towardsapplying that data in the formulation of new projectcost projections. Since then, Timesheet has expandedconsiderably to facilitate tracking of time, mileage, andexpenses, not just for project management but also forbilling and payroll purposes. Optional modules areavailable for paper-less expense reporting, advanceduser role management, automated billing and payroll,

    and to facilitate system access for disconnectedtraveling users.

    Today, Timesheet is platform-independent, exibleenough to be recon gured by customers to t uniqueorganizational needs, and scales to tens of thousandsof users for the large enterprise.

    Python from the Start

    Curt Finch chose Python initially on the recommen-dation of a friend, Steve Madere, who had foundedDejanews.com (now a part of Google). Describingthe rationale for his choice, Curt said I looked at Javaand C and came to the conclusion that one line of Python is ten lines of Java or one hundred lines of C.Developers write code at basically a constant rate soI chose Python which was (and is) the highest levellanguage Ive ever seen that is also exible enough to

    be generally useful.Architecture

    From the beginning, Timesheet was designed andimplemented as a web application. It uses a three-tiered web application architecture with separate layersfor web presentation, business logic, and data storage.

    As time has progressed, the application s functionalityhas advanced considerably, and Curt s decision to use

  • 8/7/2019 Python Success Stories

    29/31

    Python for an implementation language hasproven to be a good choice.

    Python is currently used for all applicationlogic in the Timesheet application. Thisincludes all code between the initial Apachedispatch, where mod_python is employed toexpedite interpreter instantiation, through theapplication logic, and down to the point of call out to the database transport layer.Timesheet uses not only the Python standard

    library but also several independentlydeveloped open source Python subsystems,such as PyXML and ActZeros SOAP support.PyXML is used to implement certain businessrules and to develop jxAPI, which is a SOAP-based API, into the application logic. Work isin progress to extend this API to de ne WebServices Description Language templates forthe jxAPI functions. The application currently

    builds and ships with Python 2.1.1.Timesheet also incorporates several non-Python technologies. The Unix and Linux

    distributions are packaged with the ApacheHTTP server and PostgreSQL database. TheTimesheet distribution for Windows shipswith an optional Microsoft Desktop Engine(MSDE) database and integrates with

    Microsoft IIS. Timesheet can be conguredto use a variety of third-party databases.

    Results

    The Timesheet project has succeeded spec-tacularly, generating millions in revenue andallowing Journyx to grow every year, evenunder the current economic conditions.

    Journyx, like many of our customers, uses

    Timesheet internally as a mission criticalpart of the company infrastructure. It isused extensively for project tracking,billing, and payroll. To date, approximately11 person-years have gone into the JournyxTimesheet product, resulting in over150,000 lines of Python code.

    In developing Journyx, the two greatestbenets of Python were the speed with which

    features could be written and deployed, andits true write-once-run-anywhere cross-platform capabilities. Journyx developershave found that the simplicity and clarity of Python combine with its object-orientedproperties to make it a very powerful andproductive language. Python s rich standardlibrary, which includes modules for things likestring manipulation and HTML generation,further supports programmers in meetingaggressive development schedules.

    Because of these properties of the language,Python has enabled Journyx to add featuresmore quickly than our competitors. We vebeen able to implement SOAP/XML and

    WSDL support and extended other aspectsof the applications functionality well ahead

    of competitive products. Some of the keyenablers of this ef ciency in maintenanceand improvement is the inherent clarity andreadability of the Python language, a vibrantand responsive Python development community,and the high degree of backwards compati-bility and stability we have seen as thelanguage design evolves over time.

    Pythons cross-platform standard library andplatform-independent byte code le formatallow the deployment of Python modules toany platform, regardless of which platformthe module was prepared on. This helpednot only in avoiding per-platform devel-opment overhead but also facilitates customersupport for the Timesheet software product.

    Conclusion

    Python has been an important competitiveadvantage for us, and even as our Pythoncode base grows in complexity and maturity,the natural advantages of Python enable us toprovide a high quality mission-critical appli-cation at a competitively low cost.

    27

  • 8/7/2019 Python Success Stories

    30/31

    Python Software Foundation

    http:/ / www.python.org/ psf

    Pythonologyhttp:/ / pythonology.org

    O'Reilly & Associates, Inc.http:/ / python.oreilly.com

    OReilly Network Python Dev Center

    http:/ / www.onlamp.com/ python

    Python Advocacy HOWTOhttp:/ / www.amk.ca/ python/ howto/ advocacy/ advocacy.html

    Python Starshiphttp:/ / starship.python.net

    Vaults of Parnassus: Python Resources

    http:/ / py.vaults.ca/ parnassus

    Daily Python-URLhttp:/ / www.pythonware.com/ daily/ index.htm

    Pyzinehttp:/ / www.pyzine.com

    Python Journal

    http:/ / pythonjournal.cognizor.com

    Upcoming Python Conferences and Events

    PyCon DC 2003 - March 26-28, Washington D.C.http:/ / www.python.org/ pycon

    Python UK Conference 2003 - April 2-3, Oxford, UK

    http:/ / www.python-uk.org

    EuroPython 2003 - June 25-27, Charleroi, Belgiumhttp:/ / europython.org

    Python11 at OSCON 2003 - July 7-11, Portland, Oregonhttp:/ / conferences.oreillynet.com/ os2003

    Python Resources

    http://www.python.org/psfhttp://pythonology.org/http://python.oreilly.com/http://www.onlamp.com/pythonhttp://www.amk.ca/python/howto/advocacy/advocacy.htmlhttp://starship.python.net/http://py.vaults.ca/parnassushttp://www.pythonware.com/daily/index.htmhttp://www.pyzine.com/http://pythonjournal.cognizor.com/http://www.python.org/pyconhttp://www.python-uk.org/http://europython.org/http://conferences.oreillynet.com/os2003http://conferences.oreillynet.com/os2003http://europython.org/http://www.python-uk.org/http://www.python.org/pyconhttp://pythonjournal.cognizor.com/http://www.pyzine.com/http://www.pythonware.com/daily/index.htmhttp://py.vaults.ca/parnassushttp://starship.python.net/http://www.amk.ca/python/howto/advocacy/advocacy.htmlhttp://www.onlamp.com/pythonhttp://python.oreilly.com/http://pythonology.org/http://www.python.org/psf
  • 8/7/2019 Python Success Stories

    31/31

    Embracing and Extending Proprietary Software

    Dont miss the Python 11 Conference at the O Reilly Open SourceConvention. Learn the latest on Python and Zope with comprehensivecase studies, tutorials, and sessions covering the latest modules.

    http:/ / conferences.oreilly.com/oscon

    S a v e u p t o $ 4 0 0

    w h e n y o u R e g i s t e r

    b y M a y 1 9

    Wrap yourself aroundour new nutshell.In classic O Reilly In a Nutshell style, Python in a Nutshelloffers Python programmers one place to look when theyneed help remembering or deciphering the syntax of thisopen source language andits many modules. Thiscomprehensive referenceguide makes it easy tolook up all the mostfrequently needed infor-mation not just about thePython language itself, but alsothe most frequently used parts of

    the standard library and the mostimportant third-party extensions.

    http:/ / www.oreilly.com

    Python in a Nutshell

    By Alex MartelliISBN 0-596-00188-6March 2003

    $34.95

    http://conferences.oreilly.com/osconhttp://www.oreilly.com/http://www.oreilly.com/http://conferences.oreilly.com/oscon