Frameworks vs. libraries, it's a debate which I've seen since I started programming. Some developers are set on frameworks while others swear by using libraries to make custom web apps. But, which group is right? The point of this post is to break down the pros and cons of these two different methodologies, and you can decide which is right for you. Let's start with Frameworks.
Frameworks are often the way developers get into web development. It provides an easy to use interface for programming web apps and usually has clear documentation and tutorials. Using a framework often leads to rapid development because much of the underlying boilerplate code is already taken care of and abstracted away. All of this is community backed and open source so the code is often very secure and well put together.
That being said there are downsides to using a framework. They often have a large number of external dependencies and many abstractions which can lower the overall performance of the application. Frameworks are also very opinionated, you must often use a specific toolset inside the framework, and trying to use different technologies is challenging due to the surrounding ecosystem.
- Fast Development
- Easy to Maintain
- Large Community Backing
- Many External Dependencies
- Hard to Master
Curating a group of libraries and creating a web app is the other popular way to go. This provides lots of flexibility. You can craft your application however you want, using any technologies you want. If you use interfaces and adapters, you can make different libraries plug and play with little effort. Finally, performance is often higher when only using libraries. Frameworks often have lots of bloat and unused features which slow the application down, so using libraries you can take only the pieces you need to increase performance.
There are downsides to using libraries over a framework though. It can be difficult to find all the right libraries, and keeping track of new releases and abandoned projects. Most of the boilerplate which are abstracted away in a framework you are going to have to build yourself. Libraries will help with that, but ultimately you have to tie them together. All of this adds up to the biggest con, time. Using libraries will take more time than using a framework. It has many savings because of that, but regarding hours it takes longer to build an application this way.
- Plug and Play
- Higher Performance
- Time to find right libraries
- Keep libraries up-to-date (Security patches)
- More time consuming
A good takeaway from this post is that frameworks and libraries both have their places. I don't think it should ever be said that you must use one or the other. If you are creating a quick MVP or have the time or budget constraints, a framework is a great idea. If you are building a high-performance system or have time to build it with libraries I believe that is the right choice. Ultimately, either solution can produce great results and either can be poorly implemented.