What MVC framework for web development?

Answered in Quora:

Q: Why should I learn the combination of Python/Django rather than PHP, JS/Node? I am a web designer moving to web development. What is the scope of Python/Django?

Python/Django is like learning Ruby/Ruby on Rails. The equivalent in the PHP world would be PHP/Drupal or PHP/Laravel. Equivalents in NodeJS is not Node/JS but NodeJS/Meteor or NodeJS/Sails. In all those examples above the first part would be the underlying web language, and the second would be a MVC framework on top of the language.

(There exist web frameworks that do not provide MVC but just the web server and HTTP request-response plumbing. This isn’t common in PHP since it is embedded in a web server such as Apache or nginx, but in Python it would be flask and in NodeJS it would be Express or Koa— these are sometimes referred to as “microframeworks.”)

However, unlike on the front-end with things like Vue.js, React/Redux and AngularJS, full-service MVC web frameworks have increasingly less utility on the back-end. This is because most the the advantage a framework provides is to do heavy-lifting of tedious but repeatable tasks that require a lot of code (very common when building a user interface) the bulk of which has been moved onto the client in web development. What value is a MVC’s templating system and router when both have moved into javascript on the client-side and all interactions are through an API? This becomes more extreme with standardization of the data interface (a la GraphQL) and the prevalence of more service-oriented architecture popularized by microservices or serverless FaaS architectures.

MVC web-frameworks still provide things such as a configuration management, a data object model and abstraction, but even those can get in the way as a website becomes more mature and this pre-fab approach becomes a hinderance to future scalability and optimization.

Also, when not building to scale or building proof-of-concept, a full MVC architecture will help you starting out on server-side web development because it does all the heavy lifting for you. So it might be good to start out with one, though YMMV (your mileage my vary).

Why Django?

As for why you should learn Python/Django over other language/framework combinations, assuming you want to pick your poison by adopting a back-end MVC framework to do back-end development…

Vs. NodeJS/insert mvc framework. NodeJS, in general, is a little difficult to pick up on the server-side because it has a peculiar architecture even though it is written in JavaScript. If you haven’t already bitten the NodeJS bullet in order to get a React or Angular2+ application running, then avoiding that may be a plus for your first introduction to server-side web development. I think the most popular MVC framework in NodeJS is Meteor and it has low adoption. (It is also a bit of overkill unless you plan on deploying a mobile app at the same time.) Remember, while you will need to use JavaScript on the front-end, MVC frameworks provide so much abstraction there is little advantage in being proficient in the underlying language.

Vs. PHP/insert mvc framework. Python as a base language has more overall utility than PHP. DevOps (the third missing coding component in your arsenal) uses either Python or Ruby as the base language so it is useful to have one or the other under your belt. Also Drupal and Laravel adoption is unusually low footprint in the PHP web development space because PHP is a web-development-only language and because applications such as WordPress, MediaWiki, and the like, written in PHP, are their own frameworks for the app markets they serve. Also, PHP’s development philosophy of being “shared-none” and “web glue” is antithetical to a MVC framework—which is kind of like a pre-fabricated house.

Vs. any others? If I’m being 100% honest, if you were to learn a web language/MVC framework combination as your introduction to server-side web development, I recommend Ruby on Rails over all of combinations you mention. It’s very mature, it has a massive saturation in its community (Ruby), and there are far more sites/job opportunities using this platform than any other web framework. Finally you can learn Ruby on Rails first and then Ruby “as you go” whereas other frameworks are heavily weighted to learning the language before the framework.

Having said that, I think Python/Django is a close-second and has the advantages of being in Python, a better learning/teaching language and being more powerful if you are doing data work down the road.

Response to the Django dickhead who called my answer “startlingly ignorant.”

Yes, I’m so “startlingly ignorant” that I’ve been a professional web engineer/architect/manager for almost 20 years on some of the largest projects on the internet, including two of the top 10 largest web properties.

I’ve also coded commercially in Ruby on Rails, Python/Django, as well as in NodeJS and GoLang. However, unlike you, I didn’t recommend against Python/Django, nor did I promote my preferred (web) language. I don’t proselytize a particular language or framework religion, but consider them architectural design choices and work within them.

MVC is an architectural design pattern. When coupled with front-end development some of that architecture is going to be in JavaScript on the front end—maybe they want to put the “V” there as much as possible, so even if they are using MVC, they might not want to quickly adopt something that things the “V” is a HTML template in Jinja2 and a “M” is a built-in ORM which is what you laughably suggest. A framework like MeteorJS spans both the front-end and back-end and throws in mobile app development for good measure. Others move toward micro-frameworks like Flask or Express to defer that decision until the architecture is more fleshed out.

I obviously wasn’t advocating against using MVC as a pattern, I was against blindly advocating using an MVC embedded in a framework at scale or with a site built with an API-first approach, which is increasingly more common. Even those two top 10 websites I worked at, old as they are, don’t use any of the frameworks mentioned, but they do use MVC in their own framework (WordPress for WordPress.com and MediaWiki for Wikipedia).

In fact, at scale, for every example of a successful use of a MVC monolithic framework (like Instagram using Django), I can come up with a similarly-sized one not doing so (Instagram’s owner, Facebook itself) AND one using a non-MVC micro-framework (like Pinterest which uses Python/flask).

BTW, even today, PHP outnumbers Python and Ruby combined in usage on the web at both scale (top 100 or top 10 sites by traffic) and overall (27% of all domains on the internet are powered by a single PHP application, WordPress), so it is hardly “dead.”

As for Python, I code in it, I think it’s a great language. I’ve actually been advocating it as the best teaching language for over a decade. If someone is coming from an ops background or a data science background I’d recommend they continue to use it when migrating to the web. In many cases, I’d even point them to Django over Flask. Yes, Python’s star is rising, but that has been because of data science and cloud computing and not because of Django.

Fuck you and your Python-uber-Alles religion. (And yes, when someone is PHP-uber-Alles, I shit on them too. I’m not going to hold take a bullet to my head to build a similarity score model in a language that doesn’t have anything like NumPy just because I happen to prefer PHP to connect a database to the web.)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.