What’s the difference between a programming language and a framework?

By now you’ve learned WTF a tech stack is and, after consulting with your engineer, you’ve discovered that they’re building the app in Ruby on Rails. Or Python/Django. Or Python/Flask. Why do they always come in pairs?

A programming language is what we use to tell a computer what to do. I can write a simple program in Javascript like this:

if (new Date().getMonth() === 0)
  console.log("Happy New Year!");

This tells the computer to display “Happy New Year!” if it happens to be January whenever it is run. Programming languages may be designed to work in specific environments (websites, iOS, your fitness tracker, your TV) or they may be general purpose and work across many environments. Examples of programming languages include Python, Java, Javascript (not really related to Java), Ruby, C, C++, and Scala.

A framework is built on top of a programming language to aid in a certain type of computer program, such as a web server or a mobile application. Rails is a web framework built on top of the Ruby programming language. Django and Flask are two different web frameworks built on top of the Python programming language, each with different pros and cons. React and Angular are front-end web frameworks built on top of the Javascript programming language.

A framework isn’t required to build applications. One could write a web server from scratch in Python without relying on Flask or Django. However, for traditional applications, this would be reinventing the wheel. Frameworks can save engineers a lot of time, and many frameworks have become quite mature, meaning that developers are assured that it is generally safe to use and won’t contain very many bugs – probably a lot fewer than if the developer rewrote the same functionality from scratch. This frees engineers to focus on the code that makes your particular use case unique.

You might also hear the terms library, package, and module. These all refer to pieces of code that perform a specific function, typically for a more targeted use case than a framework. Like a framework, a library (and the similar terms) is written in a specific programming language and is usually only used by applications that are written in that language (there are exceptions to this). Your engineers might use a library that is written to interact with Google Maps, a library that facilitates image resizing, or a library that helps them query the database they have chosen. Unlike a framework, in which engineers typically choose at most one per application, a single application may use lots of libraries.

Choosing a programming language and a framework are both big decisions. Both are hard to change later. Changing programming languages requires a complete rewrite of the codebase, plus a big learning curve for engineers who are more experienced in the old one. Changing frameworks isn’t quite as bad; some of the code may be salvageable when swapping frameworks that use the same programming language.

Your engineer can tell you which programming language and framework they are using and why it was chosen. Each has pros and cons and is better suited for certain environments. Unfortunately, at many startups, the language and framework are chosen by the contractor who builds the MVP, and the future staff engineers run with it because switching is so much work. If you’re just starting out and are planning to build your MVP with contractors, keep in mind that even though it’s just an MVP, you’re making a huge technical decision that your future engineers are stuck with unless they rebuild the app from scratch.

Thanks to Kavita for the topic suggestion! Please e-mail me if there are any topics you would like me to write about.

Hope you found this post useful! Don’t forget to follow this blog using the link on the left, Facebook, Twitter, or LinkedIn. And please send feedback and topic suggestions via e-mail.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s