When working on building new applications, sometimes, work gets complex. Eventually, it gets to the point where just having libraries are not enough. What is needed is structure, and order in the chaos of code. That is where Frameworks come into play. Today I will be covering what a framework is, how they work, and why they are important for you to use for developing applications and programs.
What is a Framework?
A Framework is a platform used as a foundation for developing applications. It provides a structure in which software developers can build programs for a specific platform. For example, a framework may include predefined classes and functions that can be used to process input, manage hardware devices, and interact with system software. This streamlines the development process since programmers don’t need to reinvent the wheel each time they develop a new application.
How does a framework… work?
Frameworks can act in two different ways: opinionated, and unopinionated. Opinionated frameworks are a more enforced approach, where the framework developer gets to choose the application structure, while the user has to abide by the enforced conventions of the framework itself. However, unopinionated frameworks are looser and more flexible for the user to work with. Unopinionated frameworks do not prescribe methods to solve problems, but can provide flexible tools that could be used to solve the problem in a variety of ways.
A framework for the most part follows the MVC pattern, which assists in structuring the code-base and separate the concerns of an application into three parts:
Model — Is the data of the application. This focuses on what the web application is dealing with, such as a user, video, picture or comment. If a change is made to the “model” it will notify any subscribed parties within the application.
View — Is the UI (user interface) of the application. Views, in the eye of frameworks is a small adapter that resides on top of the DOM. The view is like a hawk and observes models for any incoming updates, and if that were the case, the view will act, updating automatically.
Controller — Is the handler of input such as clicks or browser events. The controller’s purpose is to update the model when necessary (i.e. if a user changes their name).
A framework can also contain various programs which are typically used in software development, such as libraries, and compilers.
Why are frameworks important?
Frameworks act as a foundation to build your code up on, and can establish a sense of order when code in an application seems to not have any order at all. Frameworks can be highly customizable to the framework developer’s preference, and for the user of the framework being able to add the useful methodology of libraries integrated into the framework’s structure, or automatically executing code blocks when needed by calling MVC data. To cut things short, frameworks are needed when code for an application or program seems to have zero structure and rough functionality, because as frameworks, they mandate how your code is structured and how it will run.
Conclusion
When it comes down to controlling your code, frameworks are there for you. They can mandate how users organize their code, and are best when working on new projects instead of incorporating in existing code-bases.
To give a synopsis, frameworks are platforms that are foundations for new projects. They are controlling if opinionated, and if unopinionated are impotent. Frameworks can contain programs such as libraries inside of them, and use MVC patterns to separate the concerns. Remember that frameworks are the frames that keep your code blocks working, and ensure that the application is sturdy and standing.