Choosing a Platform
You've learned a large variety of platforms in this course. Which one should you use? This page summarizes some of the pros and cons of each platform.
- Largest support community: Easy to find help if you get stuck.
- Distribution: Runs on virtually any web server in existence.
- Easy to Debug: Because there is no framework involved and the PHP interpreter is robust, it is easier to pinpoint bugs and wrap your head around what is going on behind the scenes.
- Language: Few people will say that PHP is the most elegant language known to mankind. The language makes it easy to fall into the trap of bad coding practices.
- Security: PHP does very little for you automatically in terms of web security.
- Less Code: Implementing common web design patterns, like social login or commenting, is usually as easy as a pip install.
- Conventions: Django forces you to write neat and organized code, leading to better software engineering practices and scalability down the road.
- Security: Django automatically implements common security practices, leading to a more robust web application.
- Difficult to Debug: Django's high level of abstraction is a double-edged sword, because bugs and errors are sometimes difficult to find and can take hours to fix.
- Heavyweight: Django is designed for larger web applications, and it is not suitable for smaller projects with just one or two controllers.
Bottle and Flask
Bottle is a web microframework written in the Python scripting language. Flask is similar option. Although you did not explicitly use Bottle or Flask during a module, it's worth listing on this page. In more ways than not, Bottle and Flask are the Python equivalents of the better-known Sinatra, a Ruby microframework.
Bottle and Flask Pros
- Lightweight: There are few enough files that you can find your way around and be in full control of your application logic.
- Access to Python Libraries: A lot of the things you do in Django you can do in Bottle and Flask, except that you have more control over the ways that they are implemented.
Bottle and Flask Cons
- Lack of Conventions: Bottle and Flask give you the tools you need to build maintainable code, but unlike Django, they don't force you to. It's easy to end up with Python scripts containing hundreds of lines of unrelated application logic.
Node.JS and Express
It is also worth bringing your attention to Meteor, a bleeding-edge framework for Node.JS that abstracts away client-server communications. (Watch the promo video; it's pretty awesome.)
- Speed: Node.JS is the fastest of the options on this page. It is easy to scale up your Node.JS applications.
- Modern: Node.JS is also the newest of the options on this page, so most of the plugins you find for it use the best and latest practices.
- Language: With Node.JS, you can use just one language for both your server-side and client-side logic.
- Real-Time Options: Node.JS enables you to write real-time applications with ease, for example, with Socket.IO.
- Lack of Conventions: Like Bottle, Flask, and most other microframeworks, Node.JS and Express don't force you to stick to predefined conventions, giving the potential to build messy code.
- Poor Error Handling: PHP and many other options run under tried-and-true Apache, so if your program throws an exception, other concurrent requests will still be processed. However, a single exception in Node.JS will crash your entire server. You therefore need to be extra careful in error handling, more so than in PHP, Django, and so on.