DEV Community


Posted on


Explain what is a framework like I'm five

I have never really understood what is a Framework even though I have asked many times to my friends. What are they useful to?

Top comments (1)

kr428 profile image
Kristian R.

Very simple explanation: It's a pile of technology that helps you build applications to solve actual business cases faster by reducing the amount of "boilerplate" code and decisions which you would have to deal with if starting from scratch.

Ruby On Rails is a good example, aimed at building database backed web applications. You could to the same, too, using plain Ruby (or some other programming language of your choice), but then you would have a load of work to be done: You need to define your data model, you need to write code to store to and read from a database, you need some web layer to build a web user interface, you need to add styling to this and so forth. RoR can make this drastically easier for you, as it takes care of a lot of those basic and generic tasks (such as database handling, in example).

There are different frameworks for different purposes on different levels, but at the end I'd say it generally boils down to three things:

  • "Shared code": The framework itself provides a code library (prebuilt components, ...) you can use in your own applications that solve given generic issues and keep you from re-inventing the wheel and re-solving problems solved before.

  • "Application template": The framework suggests certain approaches how you should structure your application in order to be most "efficient" (whatever that means in your environment). Ruby-On-Rails, in example, will end up with sort of a three-tier architecture (database, business logic, web ui) in any case. If you build your application adhering to this template / structure / pattern, you will be able to get going easily in there.

  • "Runtime infrastructure": At least a certain set of frameworks, too, provide support for not just building an application but also for actually running it on a production environment. electron.js in example is a framework for building and deploying desktop applications using JavaScript (and node and chromium). Dropwizard is a Java framework for building (RESTful) web services and comes with an HTTP server runtime embedded so the result is a runnable Java service module that can be shipped to and launched on your server.

I think so far there's no real formal definition of what a framework does. From a 10,000 feet view you possibly should see it as a collection of tools that sit on top of (one or more) programming language(s) and are tailored towards building certain types of applications fast.