In any device, plugins are an indispensable tool for customization. For e.g in a television, we can add a home theater, to enhance our experience. In any book that we read, we can add a bookmark to help us remember the last page, but it isn’t necessary. Similarly in programming a real world problem, we have several small tasks. Some of these tasks are routine one’s and have an already written piece of code, that we can reuse in our work. This is called a Library.
Now when we write a program to solve a problem, we most often not only write things to perform a particular task, but we also write some interface essential for running our application. For e.g if we set up a photocopier machine, it is not that we will refuse from providing electricity to operate it. We will have to provide electricity and paper for the customers who come to use it. In this case a single code library isn’t sufficient. We can’t just say that my code will play an audio, but I wont provide any mechanism by which you can tell it which files to play. Here comes the role of a framework. It is a vast collection of libraries, that set up an environment for our task, so that we can focus on the task that our application needs to do.
For e.g I came across one such framework, called flask (officially called a python-micro-framework) . It uses python programming language and sets up a server for a website. We can write code for our website, without having to worry about having to set it up on a server. Coming back to our plug – in analogy, this framework isn’t really a necessity for setting up our website, but it greatly speeds up the process. So what happens here is, we write our website as a plug-in for the framework, and the framework takes care of the rest. Here our code is the plugin, and it is the framework which is being customized to suite our needs.
Some more famous examples of frameworks are Rails (uses Ruby as the language), Qt (uses c++, but available for other languages too), Django (again for Python) and the list is countless.
What is common about all these frameworks is that they make the work of a programmer a lot more easier, by storing the work of a previous programmer. They store the “history” in some sense. This reminds me of a quote :
Those who don’t know history are destined to repeat it.