Why does Blueshoe trust in Django and Python even though PHP is much more widespread? We’ve certainly got our reasons and don’t want to keep them from you.
In this article, we’ll compare Python and Django with PHP.
We use Django for many of our projects. During the first introduction with a potential new client, we’re often asked: ‘Why does Blueshoe use Django? Most of your competitors primarily trust in PHP systems like Wordpress, Drupal/Magento, Shopware or WooCommerce.’
This is the moment where we usually have to explain that a comparison between PHP systems like those above and Django isn’t really fair.
PHP is a programming language, Django is a web framework, Wordpress and Drupal are content management systems, and Magento and WooCommerce are e-commerce systems.
PHP is a popular programming language used by many sources and many projects. Having said that, the modern world of web applications is slowly but steadily moving away from PHP:
Search queries for PHP:
Search queries for Zend, the widespread framework (PHP-based):
In his article ‘The PHP Singularity’, Jeff Atwood describes PHP as follows: ‘PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory.’
Reading Jeff Atwood’s article, you’ll quickly realise that PHP is a badly designed programming language. But then, why are there so many projects based on PHP? There could be a number of reasons:
Systems built on this basis appear cheap and easy to use at first glance. Things can get out of hand just as easily, however, with security gaps, poor maintainability and bad code quality. Poor maintainability is notoriously expensive as it usually takes more time for developers to familiarise themselves with the code or they require such specific knowledge of the system that they request more and more money as time goes by. The result is often a dependency on the client, a vendor lock-in.
Clean structures, a solid code quality and easy maintainability are second nature to Python. Unlike other programming languages, Python bases its structure on indentations. This not only forces the developer to use a consistent structure when indenting and structuring their code but it also makes it much easier for other developers to familiarise themselves with a new project.
A quick example:
Obviously, this example isn’t a comprehensive comparison of both languages. It’s simply meant to give you a rough idea of both languages’ readability.
Furthermore, PEP8 provides clear guidelines on how to format Python code. At Blueshoe, our development environments are configured in such a way that they check for conformity with PEP8.
Alright, so we’ve shown that Python ‘trains’ its developers to use a fair bit of structuring. But aren’t professional PHP developers able to do the same?
Of course, there are PHP developers who manage to structure their code in a clear and readable manner. In reality, though, we still see the so-called spaghetti code used too often in PHP projects. Therefore, in the long term, Python shouldn’t be much more expensive than PHP as the maintenance costs can generally be minimised.
So why does Blueshoe trust in Django and what exactly is Django, anyway?
Django is a framework for the development of web applications. This means Django specifies a certain workflow – a structure in the development of web applications. If you comply with this structure, it’s subsequently easier for new developers to familiarise themselves with the code of a new project. This results not only in the project being structured better, but also in time saved, which in turn is reflected in the costs.
Django automatically comes with a number of different security mechanisms, which are obligatory by default during implementation. For example, cross-site request forgery (CSRF) is prevented by the use of CSRF tokens. Cross-site scripting is also automatically prevented by the Django template Engine. A developer will have to make the active choice to do without this protection and deactivate it manually. Other attack vectors, which Django limits as much as possible, include SQL Injection. In 2013, the Open Web Application Security Project (OWASP) categorised SLQ Injection as the number one weak point and also as potentially the biggest attack vector.
Django describes itself as ‘the web framework for perfectionists with deadlines’. Django’s development team decided on fundamental philosophies for the development of the framework. Naturally, these aren’t total reinventions in the world of tech – they also apply to other projects and software systems. It’s worth noting, however, these are being adhered to much more strictly in Django projects. This is generally perceived very positively and at Blueshoe, too, we feel very passionately about this. The results are the dream of every (software) client:
Okay, so Django is secure, it’s well-structured, has very good maintainability and allows for many functionalities to be implemented within a short timeframe. But who uses Django? Are there examples of other well-known websites that count on Python/Django?
Many instances of the Dropbox infrastructure run Python code. Dropbox’s main goal was the fast development of their features – Python made this possible.
In 2009, YouTube smashed the limit of one billion views per day. YouTube uses an application server which was written in Python. In order to allow for different levels of usage, YouTube can simply add or turn off machines. During intense usage of the YT infrastructure, Python usually isn’t the bottleneck. What’s more, YouTube also primarily uses Python because it enables you to develop in a fast and flexible manner.
During its peak times, Pinterest pays $52 per hour for their servers. Most of the traffic occurs in the afternoon and evening. At night, the overall number of instances can be reduced to 40% which results in a cost reduction of up to $15 per hour. For the delivery of content, Pinterest mostly uses Django and Tornado (a Python framework and Asynchronous Network Library).
Spotify’s back end consists of many different services. 80% of these services are written in Python. One of the main reasons is the fast development Python offers. They also use Python to work through asynchronous tasks as well as (about 90% of) the MapReduce tasks in Spotify’s Hadoop cluster.
With several million requests per second, Instagram successfully shows how perfect Django is for the building of web applications. The entire architecture is, of course, complex but the core of the Instagram server is Django as the application server.
Disqus is used as a comment plug-in on numerous different websites. With 45,000 connections per second (in 2013), Disqus is a web application that does an extreme amount of scaling. Django is almost exclusively used to work on all these connections on Disqus. There are obviously other technologies which are used to ‘make life easier’ for Django (caches, f. ex.). But here, too, a solid foundation like Django is needed to develop stable, secure and scalable web applications.
Python and Django have active communities, they are constantly being developed further and enable us to write high-quality software in no time. That’s why we love Python and Django. Shorter implementation periods following change requests, higher security standards and lower costs when it comes to maintenance – that’s what our clients love too. At Blueshoe, it’s important to us that our clients and partners understand why we have chosen to use this technology as the foundation for many of our projects.
To cut a long story short: Python/Django are a terrific basis for various different projects. We trust in them and our experience speaks for itself. We encounter new challenges on a daily basis and have never been let down by Django. It simply matches the core of our mentality – after all, we are perfectionists with deadlines.