Are you trying to become a web developer? If so, there are some tools that you can use to make your life a lot easier. One of the most import tools that you’ll need to learn is a web framework. And you’ll need to figure out how to choose the right one for you. This post will give you a sky-high view of the competing modern web frameworks and help you figure out the right option for you.
This post will give you a sky-high view of the competing modern web frameworks and help you figure out the right option for you. Let’s start by zooming out really quickly.
What is a web framework?
Web browsers reach out to servers (computers) that run elsewhere on the Internet using this something called HTTP. When this happens, these servers get notified of a couple of things:
- The URL that was selected
- How the URL was entered (through a form submission or just typing the URL in into the browser bar)
The server’s job is to do a lot of things, such as:
- Talk to databases (read data and add data)
- Figure out the correct result (should a user get sent to a different URL? Are they allowed to view the page they’re trying to access? Etc…)
- Build up the web page that the user will see
If you want to support advanced functionality, there are a lot of steps that need to be taken. So as a programmer, you need to make a lot of decisions about what you want to do.
Web frameworks can make your life easier and can make some of the decisions for you.
Some web frameworks come prepackaged with files, folders, ways for you to easily get started right away. Other web frameworks do not. This post will help you identify the pros and cons of the different web frameworks.
Before we dive into the specific frameworks, it’s important to point out that there are a ton of web frameworks out there. In this post, we’ll only focus on the frameworks that are widely used at companies where developers work.
Keep in mind- once you learn one framework, it’s usually fairly easy to learn a new framework.
Let’s get into the key modern web frameworks.
Ruby on Rails
Programming Language: Ruby
Quick Summary:
Ruby on Rails is a web framework that has been adopted by many companies. It is the leading web framework in the Ruby programming language. Ruby on Rails gained massive adoption from programmers after DHH (Rails’ creator) used it to create a blog in about 15 minutes.
Rails’ guiding principle is convention over configuration. What this means is, as a rails developers the are patterns, standards and “conventions” where all rails programmers generally will do things the same way. There’s a so-called “right way” or more aptly “rails way” to do things when programming in rails.
Rails also uses an MVC (Model-View-Controller), architecture. MVC is a pattern of building out applications and can lead to an organized, well-thought-out architecture. This architecture is used throughout most different web frameworks that exist.
Pros:
- Rails comes with a robust command-line interface (or basically just a program you can run in your terminal), and you can get up and running on a new Rails application by running a few easy commands.
- Rails has been around for a long time and has seen a lot of usage, so there is a lot of content on the web about how to use it to program.
- There’s a reason why Ruby on Rails is so popular. It gives you everything you need right out of the box. It scales well as problems become increasingly complex, and it makes it relatively easy to craft Information Systems and Web Applications.
Cons:
- Rails automatically hooks up a lot of things for you. The starter project contains many files and there is quite a bit of configuration code that is written automatically that can be a bit intimidating.
We think Rails is an ideal web framework to learn first.
Given its flexibility, use in the real world, and ease of developer use, we think that Ruby on Rails is the best web framework for beginners to learn first. That doesn’t mean that other web frameworks don’t exist – and it doesn’t mean other frameworks are not good.
Here’s a rundown of some alternative web frameworks to Ruby on Rails.
Sinatra
Programming Language: Ruby
Quick Summary:
The above five lines of code are all you need to make a bare minimum web application. If you compare this to the Ruby on Rails approach, you’ll notice that this is much less code (and only a single file instead of dozens).
However, it’s important to note that Sinatra’s simplicity is a double-edged sword. It takes the opposite approach to Ruby on Rails, meaning it’s your job as a programmer to configure all the things.
Sinatra doesn’t use the same conventions that Rails does. Instead, it lets you program things in the way you want.
Pros:
- Added simplicity web building web applications.
- If a big framework like Rails is overkill (you won’t be connecting to a database or using most features of rails), simplification can be nice.
Cons:
- Since conventions aren’t as important, it can be difficult to understand an existing Sinatra application. For example, Rails web applications always have the same folder structure, but this isn’t the case with Sinatra applications.
- It’s not frequently used on real production projects.
- Projects evolve. Sometimes, you start a project with Sinatra and realize that it would have made more sense to use Rails.
- The added work of manually configuring a lot of things can take a lot of time.
ExpressJS
Programming Language: JavaScript
Quick Summary:
ExpressJS is a JavaScript Web Framework that looks surprisingly familiar. Its code looks fairly similar to Sinatra code, and it mirrors Sinatra’s simplicity. There are only two files of code in a barebones Express app:
- package.json, which is an auto-generated file from a tool called NPM, which most JavaScript developers use.
- app.js, which contains the full code of the app.
ExpressJS leverages NodeJS, which gives you the ability to run JavaScript programs from outside a web browser.
Pros:
- Flexibility. There are many different choices you can make about which tools you want to use, even more so in JavaScript than Ruby.
- You can get by only using a single programming language.
- It’s so light and can scale really well without much effort.
Cons:
- More options = more choices. Making the choices can take time because you need to research the different options and figure out how to hook them up in your app.
SailsJS
Programming Language: Javascript
Quick Summary:
SailsJS is a web framework that mimics Rails in the JavaScript language It makes many decisions, has a command line tool that generates a full default app, with reasonable defaults. It bakes in a variety of tools to help developers get things done.
Ruby on Rails, Sails includes an MVC architecture and starts you out with a fully fledged app with dozens of files with reasonable defaults.
Pros:
- There are default ways to do many of the tasks involved in building out web applications. By default, Sails comes integrated with packages like waterline, which allow you to connect to database easily.
- The command-line program (the command they add to the terminal window) makes it easy to build new applications and build out features.
Cons:
- Despite being a seemingly robust framework, there hasn’t been a ton of adoption from real companies.
The MEAN Stack
Programming Language: JavaScript
Quick Summary:
The MEAN framework is an extension of ExpressJS, which we talked about earlier. The Mean Stack tacks on a few additional technologies, such as MongoDB, AngularJS, and WebPack.
MongoDB is a database that is conceptually very different from most other databases. MongoDB scales really well, but has certain limitations:
- MongoDB allows freeform JSON data in it, which means database entries are flexible, but having records that are invalid is an easy problem to run into.
- Rather than interacting with the database through SQL, an industry standard, it uses proprietary JavaScript.
On the one hand, the MEAN stack pushes JavaScript into all aspects of the web application. In a lot of scenarios, this can be too much.
Pros:
- Like SailsJS, the MEAN stack includes all components you’ll need to build complex web applications.
Cons:
- The page loads in two phases and the first phase can look a little bit funny. This happens because the view isn’t rendered on the server side, only inside the browser. This means that users initially see an incomplete page, which eventually loads the full content of the pages.
- The MEAN stack incorporates a lot of technologies, like MongoDB, that aren’t commonly used when building web apps in other frameworks.
My opinion:
The inclusion of MongoDB makes this framework a non-starter for me. Nearly all other web frameworks work with SQL database, which is the standard database implementation. The MEAN stack, in my opinion, might make sense in scenarios where MongoDB really shines. But Mongo really shines only under an insanely high load volume, which is required for things like ad networks and APIs that are under high load.
There are scenarios where it makes sense, but for typical web application, I’d probably suggest using a different framework more similar to other ones.
Because it only uses the JavaScript programming language at every single part of the app, it can sound easier to master the MEAN stack. But things like MongoDB and WebPack actually make the MEAN stack more difficult than technologies that use the “standard” way of solving problems. If you use the right tool for the job, your life as a developer will be much easier.
Django
Programming Language: Python
Quick Summary:
Django is an MVC web framework that runs on Python. It has some configurations generated out of the box – but noticeably less than Rails – and has many similarities and differences to the Ruby on Rails framework. This web framework changes the responsibilities of controllers and views, but all things being equal it’s a solid web framework.
Pros:
- Lightweight, minimal configuration.
- Provides a full development stack while still adhering to the Python principal of explicit design, which allows for a balance between swift development and long-term maintenance.
Considerations:
- The Python programming language is a language similar to the Ruby language, but different types of developers tend to use it. Developers who generally use Python typically work in data science, statistics or analytics.
Tornado
Programming Language: Python
Quick Summary:
Tornado is an unopinionated Python web framework. It’s fast, efficient, and gives the programmer access to python’s extensive data libraries.
Looking at other open source projects that use Tornado is one of the best ways to get a feel for how to structure the applications.
Pros:
- It excels in scenarios where there are many requests that need to happen over a really small timeframe.
Cons:
- Like other unopinionated frameworks, the lack of structure can lead apps to be quite diverse from one another.
- For someone starting out, having too much freedom can lead to messy code. More experienced developers who have written other apps in other frameworks are more likely to architect an app in a thoughtful way.
Java/Scala Play Framework!
Programming Language: Java or Scala
Quick Summary:
The Play! web framework is one that was heavily influenced by the Rails web framework and brought into the Java (and Scala) programming languages. It’s worth noting that Java is an entirely different programming language from JavaScript.
Pros:
- Play! runs on the Java Virtual Machine, which is one of the most efficient programming environments.
Cons:
- Most web applications are built in what are known as “scripting languages,” which allow for quick changes to the visuals of a page. Java adds a step, known as “compiling,” which needs to happen between changes in the app.
Laravel
Programming Language: PHP
Quick Summary:
The Laravel framework is a modern programming framework that is written in PHP. 10 years ago, PHP was the standard programming language that almost all web applications were built on. Fast forward to today and PHP has lost a lot of its market share to Ruby, JavaScript, and Python.
Despite that fact, Laravel is a well thought-out framework that allows you to build beautiful code with PHP.
Pros:
- Laravel is a wonderful MVC framework that mirrors many architectural decisions that are used in the Ruby on Rails framework.
Cons:
- Products are moving away from PHP. As a result, there are becoming fewer and fewer PHP developers.
Here’s what matters when it comes to choosing a framework.
Different frameworks, like the ones listed here (there are many other frameworks, these are simply the most popular) often look to each other for inspiration. The programming community is collaborative. The big picture concepts often transcend the implementation.
So, understanding that, it’s important to look at the two main types of categories the frameworks listed above fall into, and use that to figure out what would work best for you.
There are generally two types of web frameworks.
Minimalistic frameworks
This framework makes programmers manually add each individual component. These frameworks generally give developers free reign to set up projects however they like.
ExpressJS, Tornado, and Sinatra are all minimalistic frameworks. They give you the bare minimum that you need to get started.
Also, by forcing you to configure each aspect of the application yourself, you’re able to make more decisions and can use the ideal tool in each situation.
Obviously, there are some drawbacks. You’ll often find yourself in situations where you need to analyze the different options and make a lot of choices.
Omakase Frameworks
These frameworks give you everything you need out of the box to program. They also allow you to opt out if you want to use something else. The developers who built these frameworks have made some of the key decisions for you, so you can just follow the patterns that they push you towards.
Examples of Omakase frameworks that we mentioned in this post include Rails, SailsJS, MEAN.io, Laravel, and Play!. They suggest that programmers write code in a certain “right” way, and there are community standards. This is a big advantage. Since there is a widely accepted community standard, learning a web framework like Rails can set you up to:
- Learn how the community has agreed on the right way to do something.
- Spend your time thinking about other programming concepts.
Once you learn the suggestions of one framework community (like Rails), you’ll have the background and experience to evaluate other frameworks a whole lot better.
Different frameworks within programming languages have different adoption rates in the community.
There are a ton of competing JavaScript frameworks, which means that different companies and projects will use different frameworks. Some only use ExpressJS, others will use a more omakase framework.
The Ruby community is a little different. A large portion of the community has strongly supported Ruby on Rails. A very high percentage of Ruby developers are employed to work on projects that use the Rails framework. This is an important part of why we think Rails is an ideal framework to learn first.
But, the most important thing is to make sure that analysis paralysis doesn’t stop you from picking a framework. Don’t wait. Just pick a framework.
Learning the first web framework will take you time. Keep in mind, in addition to learning the framework, you’ll be exposed to a number of other aspects that drive web applications. You’ll need to learn these in parallel to learning the framework. That includes things like:
- Databases
- HTTP Requests
- Setting Applications Live on the Internet
The techniques that are used in one web framework are usually fairly similar to the techniques of other frameworks.
So remember that you’re not “going all in” when you pick your first framework. In fact, the work that you put in to learn your first framework will help you pick up additional ones at a faster pace later on.
If you found this post insightful, share it using the Facebook and Twitter Buttons.