Learning Flask after Ruby on Rails

Why It’s Important to Learn Another Backend Framework as a Rails Developer

What is a framework and why use one?

Why Ruby on Rails?

One of the early productivity mottos of Rails went: “You’re not a beautiful and unique snowflake”. It postulated that by giving up vain individuality, you can leapfrog the toils of mundane decisions, and make faster progress in areas that really matter.

Rails handles the details of implementing database scaffolding, routing, testing, and so much more. With just a few lines of code, you are 90% of your way to building a website (and you have literally hundreds of files already built for you). Their idea is that by automating the repetitive and time-consuming tasks that all developers would need to spin up an application, they are allowing developers to spend their time on work that is truly innovative. “Optimize for programmer happiness” is the first pillar of the Rails Doctrine, and I can see why.

When you learn Rails it seems like magic. By design, Rails is one of the most comprehensive and rigid frameworks available. But once you learn it, it’s incredibly powerful. Many companies use Rails today, especially to build APIs.

However, the magic of Rails—and the word magic is key here—abstracts away a lot of the logic happening under the hood. As a new developer, you can ramp up to building relatively complex web apps extremely quickly with Rails, but this might be at the expense of learning the beauty of how every part of your program works and fits together.

Why learn something else?

Flask is actually called a “microframework,” meaning the creators of Flask aims to keep the core simple and lightweight but easily extensible. I would consider Flask to be on the other side of the spectrum of Rails in terms of robustness, rigidity, and the amount of code actually built out for you. When you spin up a Rails app, you get files on files generated for you, but with Flask, it’s on you to build out the application structure, and your program can be as simple as one Python file with a few lines of code.

As I built out my first Flask app, I discovered so many parallels to concepts in Rails:

  • “views” to “templates”
  • resource routing to “@app.route”
  • going from generating migrations with a few words in the command line to writing my own schema and init_db.py seed file

There were definitely hurdles in reconciling my understanding of these concepts with a new framework and a new language, but I’m so glad I did. Pushing through those initial blockers and fuzziness to level up… this is what programming is all about.

Software engineer @Artsy. At the intersection of storytelling, art, and technology.