Many a web developer has found themselves asking, “Is using a framework a good idea?” A framework is a pre-produced structure or template that implements common coding features found across most websites or web applications, but is it always a good idea?
Many developers use a framework when building custom sites to avoid reinventing the wheel when it comes to repetitive code, and there have been many Internet debates about whether a framework is a good idea for web development or not. Unhappily for those of us who would like a simple answer, the answer is, it depends. The general consensus is that the use of a framework heavily depends both on how much customization the project requires as well as the skill level of the developers. Typically, beginner developers should shy away from a framework unless they understand the core concepts of the language and are capable of coding what the framework does anyway.
As a quick note, it’s a common misconception to refer to a framework and a CMS (content management system) interchangeably. It’s not always completely clear what the differences are, but they are not the same thing. A framework is a set of pre-written code or tools to help you get started before you take off in any given language. Examples of frameworks are Laravel and CodeIgniter for PHP, Ruby for Rails, Django for Python, etc. A CMS or a web development platform is a broader term referring to an application with “out of the box” features such as a blog, forums, and of course, content management. CMS examples include WordPress, Liferay, or Joomla.
Frameworks can be nice, time-saving tools, but it’s not always bliss. A developer shouldn’t use a framework if they don’t understand how the framework and library really work. This seems obvious, but the more complex the framework, the more difficult it will be to debug or customize. Some frameworks have several million lines of code, so if you need to change something, you’ll have to find it somewhere in there. If you are unfamiliar with the source, you’ll be pretty limited. Performance can also be an issue with frameworks when an entire application is loaded using a framework as the primary tool. Take, for example, a 75kb compressed-framework .js file loading on a PC with high speeds. You probably won’t see the effect of the framework’s performance, but this .js file will definitely impact mobile users with have slower speeds on their smartphones or tablets.
Frameworks can, however, actually be the useful tools they’re meant to be. A big benefit is that a good framework will enforce good coding practices. Choosing a lighter framework can be good if you’re just starting out since it will show you how the code should be written. You can also find lots of documentation and support on an open source framework to assist you in writing code, and you may even pick up some tips and tricks. A framework will also be more efficient to use as long as the developers working on it are familiar with the source code (hence not reinventing the wheel); they are also super useful for integrating with other tools such as a database. It’s a good idea to use a framework when you need security features such as a login, password, session management, etc. Even the most seasoned developers can struggle when writing this kind of code for a live application.
What do you think of the pros and cons of frameworks? Some developers use them all the time, while others like to use frameworks they’ve developed for their own use, while others still don’t use frameworks at all. Tell me your thoughts.