Is Python Ready for Enterprise Application Development?
Thomas Lee
PhD and MBA. Platform engineering manager at Google, specialising in CI/CD, AI/ML R&D, and software architecting. Views are my own.
By Thomas Lee, CEO, Throput
This is a re-posting of a Throput blog article.
In the past few weeks, some news (like this one and that one) reported Python was becoming the most popular language. Some friends working in enterprises asked me whether Python would be ready for adoption in enterprises. Many large enterprises which I know are still using Java and C# as the default application development languages. In fact, not all of them are conservative and some have been testing new frameworks like JavaScript for Node.js / React in web development. (Python isn't as shiny as these frameworks.) Yet most of them still have different reservations to adopt Python for enterprise application development. Using Python to do more critical work than application support tasks (e.g., system administration and web crawling) is just outside their comfort zone.
At Throput, we have switched from Java to Python for more than two years. Now we are using Python as our go-to language, meaning that we’ll use Python unless some applications and tasks have very special requirements. (We have used Go to program a lightweight and scalable backend server.) Python isn’t a perfect language (while no language is). But it’s more general-purpose and portable than many languages (e.g., Go, C#). It would take years of investment for an organisation, not mentioning a startup like us, to master a programme language and its frameworks to gain the necessary productivity and creativity in return.
In short, Python is productive, rich in language constructs, modular, and has wide tool support. I don't intend to compare Python with other languages here as a lot of useful resources about this are already available online. In the following, I attempt to answer some questions that my friends have asked about enterprise adoption of Python.
Is Python mature?
Many polls report Python is one of the most popular programming languages. The following lists the popular languages and their ranks in 2018 by different polls.
In these polls, Python is among the top 5 languages if we only count the general-purpose languages. Besides, most polls have shown its popularity keeps growing. Knowing Python (invented in 1990) is older than Java (invented in 1995), you might not be surprised about its popularity after decades of active improvement, thanks to the 28-year leadership of its inventor Van Rossum who just stepped down. Nowadays many software applications being data-driven, Python is playing a trump as its language design and many tools are data-centric.
I think whether Python is actually ranked no. 1 or no. 4 does not matter at all. The message here is Python is on a par with (if not better than) the languages, like Java and C#, you’re using to develop enterprise applications.
Is Python as easy as people say?
It might not be as easy as you would expect. (I'm trying to manage your expectation here.) Many people might tell you Python is super easy by showing a short program can make magic. Yet, when building a serious enterprise application with Python in a structured way, you need to make a lot of design decisions, which has quite a learning curve. Yes, Python is relatively easy to get started in a few hours to do something useful. You may be able to spend a day or half to learn how to use Python crawl some web pages and extract the information you need with Scrapy or Beautiful Soup. However, when you want to use Python build a robust web app, you need to choose your own stack from tons of frameworks and libraries, e.g., Django (which is more all-in-one), Flask, and Pyramid, with very different coding philosophies meeting very different requirements. For me, building a small PoC with some shortlisted frameworks is the only way to select a suitable one. Also, you also need to mix and match a variety of tools, e.g., requirements.txt vs setup.py and virtualenv vs pyvenv vs pipenv.
While these difficulties of selecting frameworks and tools are quite common among many open-source technologies (e.g., React vs Angular vs Vue.js), some difficulties are more fundamental. Python is arguably more flexible and embraces more coding styles. A Python script for system administration is likely procedural. A Django web application is highly object-oriented (OO). A Python program for data analytics may look more functional. The deep learning code in Python (e.g., TensorFlow eager execution) can be imperative. Compared to Java as an OO language and Go as a procedural language, Python’s multifaceted coding paradigm can be brain-twisting. When less experienced programmers just copy and paste the code from different sources without thorough thinking, the applications could become hard to comprehend and maintain. Therefore, good system architecting becomes very important when Python is used to develop enterprise applications.
Is Python slow?
Is Python an interpreted language? In general, most Python implementations are interpreted yet the Python code is commonly compiled to .pyc byte code before execution. Is Python slow? Not necessary because many computationally-intensive libraries are written in C. For example, computing libraries like NumPy and SciPy are partly implemented in C. Also, TensorFlow just uses Python as the client language; its core is written in C++. Therefore, Python is quite fast for scientific computing. Some people ask if Python is slower than Java and C# running typical applications like web applications. Generally speaking, Python is indeed slower. However, there are different performance requirements, e.g., latency, throughput, scalability. And the database and network I/Os might be on the hot path instead of the compute cycles. Therefore,whether a typical application can meet specific performance requirements often depends on the architecture design rather than the programming language. Remember many hyperscale websites, such as YouTube, Dropbox, and Instagram, have used Python to build their core systems. If you’re building a typical web application, using Python should not be a concern. Most often, performance isn’t the most important factor to consider among others like maintainability, agility, and productivity.
Should my organisation switch to use Python?
Well, Python is an influential language which should be at least on your radar. Python has a wide application especially for its data-friendliness; hence, the return on investment can be easily justified. As a technologist, no one but yourself can answer this question. You should start learning it by writing some code. Some uncommon concepts might bother you (e.g., the __init__.py file) in the beginning. Don’t give up because this is a good sign, meaning that you’re crossing the chasm rather than just scratching the surface. After all, Python is deep. Once you have got sufficient understanding, you will be able to judge in what areas your organisation can apply it. In many cases, your team can start with using it for system administration and data analytics tasks. After your team becomes more familiar with the language and libraries, you can build some simple enterprise applications. Then, you’ll see by yourself whether, where, and when your organisation should adopt Python as one of your main programming languages.
Process and Standards Manager
6 年Great article ! Thanks for sharing you insights about this wonderful language.?
CTO, Crane Softwrights Ltd.: worldwide experience in UBL/code lists/XML/XSLT/ XQuery/XSL-FO/&c.
6 年Well written, Thomas!