What is a Software Framework?
A Software Framework is a model with predefined structures and actions that you can follow to create programs, by using those elements as a foundation for your program.
Let’s say a restaurant Chef is creating a new desert cake using a kitchen robot. The kitchen robot has different operations to “weight”, “slice”, “mix” and “cook”, as well as actions for “starting” & “pausing” operations, “opening” and “closing” the main container and more. Each operation has a set of parameters: when “slicing” you may specify the speed and type of cut, while in “cooking” you may specify the speed and temperature. The Chef can combine, step-by-step, each operation and several ingredients to achieve a meal. The kitchen robot restricts the operations, parameters and actions to the ones it offers, and even forces a certain sequence of steps — you can only cook after the lid is closed. However, those guardrails help recipe creation and avoid prevent ruined meals. You can say that this kitchen robot offers a framework with which any Chef can configure cake recipes.
What makes a Framework
- A software framework facilitates creating other software by providing a predefined structure and actions that program creators can configure to achieve their goals.
- More than just example code, a software framework dicatates the program flow, that is, the framework forces some actions to be executed automatically after the program executes some other actions. While it limits what can be done, it also gives the user a proven method to fulfill structural needs, which frees the creator to customize other parts of the program.
- A software framework includes several of the following:
- Structures and conventions that you’ll use on your program.
- Libraries
- APIs
- Pre-written code and programs
- Auxiliary tools (like compilers, that turn higher-level code into lower-level code)
- Documentation and examples
Common Types of Frameworks
- Front-end frameworks. These are frameworks used to build “the visible” part of your application or website. They provide conventions for how you should load screens, design elements on those screens, handle events (like button presses) etc.
- Back-end frameworks. These are frameworks used to build “the central” part of your application or website. They provide conventions for how you should receive requests (API requests!), route them, handle them etc.
- Full-stack framworks. These are framworks used to build the whole application or website, end-to-end. That is, they are a front-end and back-end framework in one!
Examples of Frameworks
- When you use a modern website, the part of the website that is loaded on your browser (the Front-end) is built using a framework. React and Angular are 2 very common front-end frameworks.
- Many web services use the Spring framework to build their back-end systems.
- Ruby on Rails (for Ruby) and Django (for Python) are full-stack frameworks.