There is no denying that programming is easier today than it was a dozen or so years ago. In that time many programming and architectural solutions have been invented, and a variety of patterns and tools have appeared to help with building applications. That doesn't mean coding is a piece of cake. Tools can only help with building specific parts of software, they still require expert knowledge, and we should remember that the complexity of applications and users' expectations have grown considerably. Still, if any help is available, it would be a sin not to use it. One such "lifebuoy" is undoubtedly the framework.

Frameworks are, in a way, engines for writing applications. They impose a certain structure, provide useful libraries and let you focus on implementing the actual code, without building the foundations yourself, such as a login system or redirects. I don't think it's an exaggeration to say that well over 90% of today's applications (including top-tier ones) were built with one of the many frameworks. Thanks to that, their development didn't drag on forever, and developers could concentrate on the quality delivered to users. And the users themselves could simply enjoy the software.

There is, however, a group of people who claim that using a framework is a dishonorable shortcut and that, where possible, applications should be built from scratch, "from A to Z" (what that means, we'll discuss in a moment). As a professional programmer I have come across (and even worked on, as legacy code) large systems built without any engine, and I have seen how differently people approach them depending on their experience.

So let's take a look at frameworks: is it worth using them, and when, and when not?

What is a library, a framework, a generator, a CMS?

Before we get to the main topic, it's worth explaining the differences between these terms, because they don't mean the same thing at all.

A library is a separate set of code that makes a specific task or group of tasks easier. An example is a library for handling JSON data (reading, parsing, writing, converting and so on), for authentication with JWT tokens, or a set of functions for working with strings. Such a module (not a precise term, but let's accept it for now) is usually created separately or as a by-product of building some software, and shared inside a company or even publicly. A website plugin (such as Feedybacky) can be a form of library. So it is something that makes building applications easier (especially since we usually use many libraries at once), but it cannot serve as a template for the whole application.

Such a template, skeleton or engine for a given programming language is exactly what a framework is, and it is described quite well on the Polish Wikipedia:

A framework, or software platform, is a skeleton for building applications. It defines the structure of the application and the general mechanism of its operation, and provides a set of general-purpose components and libraries for performing specific tasks. The programmer builds the application by extending and adapting the individual components to the requirements of the project, creating a finished application in this way.

While a single application can use many libraries, a program usually has one framework. Here, too, the terminology is not strict. Bootstrap, for example, is sometimes called a library and sometimes a page styling framework, and there is a reason for the latter (it forces you to build views in a certain way), so in that case a developer uses two or more frameworks. Nothing prevents using different frameworks for individual microservices or for parts of one system that integrate with each other, although you shouldn't overdo it (more on that later today).

Such a skeleton still requires programming, though, and a non-specialist will have trouble using it correctly. Is there a solution that lets less technical people build a website on their own, or even makes life easier for developers working on mechanically very simple web applications? Yes: a CMS, or Content Management System, which lets you click together and fill in everything using an administration panel. In this class of solutions the clear leader is WordPress, known to everyone, but we shouldn't forget Drupal or CMSs dedicated to specific areas, such as e-commerce. There is also the concept of a headless CMS (Strapi is an example), which lets you click together an API and is a kind of mix of generating and programming, because here the end product is not a website with content but a ready-made application skeleton that has to be filled in.

What does "from scratch" mean?

That's a good question, and depending on the context the answer may differ. For me, "from scratch" in the framework-or-not discussion means that we start with the programming language itself and its standard library, and perhaps add external libraries later as needed (after all, frameworks often ship with recommended libraries too). So we have no ready-made mechanisms for, say, routing HTTP requests, generating HTML views, or authentication and permission control. We write and design everything ourselves, at most taking inspiration from established solutions. This requires not only deep knowledge of the details of the language we write in, but also a great deal of patience, because even designing only the mechanisms we need takes more time than using a ready-made framework.

Someone else might say that for them, writing from scratch means... using a framework. It sounds odd, but if someone is used to building sites with WordPress, say, where they mostly work with configurable modules or widgets, then building a website by programming around an engine may well feel like "going back to the fundamentals". In the rest of this text, however, we'll use the definition from the previous paragraph.

Why frameworks can be good

In game development, amateurs who consider writing their own engine often run into a similar problem. They get a clear answer: "If you want to make a game, you pick a ready-made engine. If you want to make an engine, you spend years making an engine." This translates quite simply to web applications: if you don't have a lot of experience and a large team, and you need to build an application that performs specific tasks (not to mention the time and budget for it), then you should almost always choose a ready-made solution to build the actual software on.

It is also a chance to get to know a really solid piece of code and software architecture. Note that frameworks are built and developed over years, often with many people who support each other, cultivate good practices and review each other's ideas. So you can expect that at least most of the mechanisms available in such engines are really well thought out, and it's worth looking at them and understanding them. In addition, the more popular a framework is, the more versatile it usually is, and the more of the things needed for building applications it provides. The cherry on top with actively developed engines is the community, a large knowledge base (for example in the form of Stack Overflow questions) and the knowledge that there are people looking after the development of the tool we use.

Using a ready-made framework also means, of course, saving time that we would normally spend writing many standard functions. So this "shortcut" translates into greater business benefit. And it is nothing to be ashamed of. On the contrary, as I said, you can learn a lot from such code, including things that will help if we ever want to write our own tool. In addition, some clients may ask what we use for programming, and naming a well-known framework can give us an extra point in negotiations.

Why custom systems can be good

Sometimes a software house works on fairly small projects, built for specialized tasks, and using the framework we usually reach for can be excessive (we sometimes call it "overkill", or "using a sledgehammer to crack a nut"). In such cases we either switch to a smaller framework or... write the code from scratch.

When we have really specific requirements, care a lot about performance, or simply want to be sure what is in the code, we may be tempted to write our own engine, or at least part of one. It's a great way to learn (even for programmers experienced in the language) and a lot of fun. Such a project can also be treated as an introduction to developing a proprietary tool that we can later commercialize and show off. That is more or less how React from Facebook came into the world.

The difference between amateurs and professionals

Contrary to appearances, this is quite an important point, because the approach to frameworks differs a lot between amateurs and professionals. Amateurs sometimes show a greater urge to write their own tools. This can be explained by youthful imagination and plenty of free time, as well as by distrust of ready-made tools. While it's hard to argue with the first two reasons, the last one is wrong: beginners are exactly the people who should learn to program in ready-made templates as soon as possible, because that is how they learn and reinforce good practices. This is how professionals are "born", people who look at the choice of technology strictly from a business point of view. If you have to deliver a solution to a client on time while competing with other contractors, frameworks will naturally be preferred, because they are often an essential base for staying within budget and focusing on the requirements themselves.

It's also worth mentioning that we shouldn't close ourselves off to particular languages or frameworks, which sometimes also sets amateurs apart from professionals. It is true that the more experience a programmer has, the less weight they give to their own technology preferences, and the more to whether the tool is the best one for the task. For that reason it's worth knowing (or at least recognizing) many frameworks and trying to choose them appropriately. Smaller and less profitable projects help here, since they let you experiment a little and discover something new. This is often visible in a microservice architecture, where we naturally build separate applications for different tasks and there is no obligation to use one tool everywhere. On the other hand, a professional also knows that mixing engines excessively and using different frameworks "for art's sake" can cost us time and quality, and later cause problems with developing the application, because, for example, not every programmer on the team will be equally competent in every part of the system.

The verdict

So is it worth using ready-made frameworks? I'll put it this way: it is worth it, and often even necessary. I recommend this approach to the less experienced, who are only taking their first steps in designing proper software architecture and need good patterns. But I also recommend it to the more experienced, who often face deadlines and need a tool that provides a solid foundation. Then the right framework is a godsend. Still, there are situations where a custom engine may be a good idea, although you should keep in mind that in the professional world there aren't many such opportunities. That's why many ready-made solutions were born from programmers' after-hours work on their own projects, done for pleasure.

Best regards and thank you, Jakub Rojek.