Today we are going to talk about libraries vs frameworks in software development.
A software library is something you use that enhances your application. It's a bundle of code that you can plug into an existing project. A software library normally solves a specific task such as connecting to a database, making forms or providing routines that manipulate images. A library can co-exist amongst other libraries and this is also true for libraries that do the same task. For example you might have a software library that crops an image to a certain size. You may want to try another library that does the same thing.
A software framework provides a set of APIs such as user authentication, session management, templating, request and response handling and so on. A framework is a single package that could contain smaller packages that do different things. A framework is very opinionated. It provides specific places for you to add your and it controls almost everything about how your code interacts with it.
Generally you cannot add a framework to an existing project because it must be the top layer of abstraction.
Both libraries and frameworks are code that is written by someone else that you use to enhance your project.
When you use a library you are in charge of the application flow. You choose how and when the library is called in your application. On the other hand, a framework is a set of API’s that can be called at certain points in its defined flow. Usually a framework tells you what to do, when to do it and where to do it. Frameworks are normally developed by large teams or the open source community. Due to this, a framework normally adheres to best practices, a strict set of coding standards and the framework is regularly maintained.
There is a big learning curve with frameworks but popular frameworks are well known and sort after in the software industry.
In summary a framework tells you what to do whereas you tell a library what to do. You have full control over a library but you have to define the rules of your application. You have limited control over the framework and you need to adhere to rules set out by the framework.
Kick start your tech career with Amarachi Amaechi's new book Getting Started in Tech: A guide to building a tech career
My web development courses
➡️ Learn PHP arrays
➡️ Learn Python
✉️ Get my weekly newsletter
⏰ My current live coding schedule (Times are BST)
Thursdays 20:00 = Live Podcast YouTube
Sundays 14:30 - Live coding on Twitch