What are programming frameworks?

188 viewsOtherTechnology

I’ve used things like Tailwind CSS and Next.js and I know that Tailwind CSS has predefined CSS classes and Next.js allows you to use HTML while allowing JavaScript integration, but what really is a framework? Is there a definition or something that would be able to classify React as a library but Next.js as a framework?

In: Technology

4 Answers

Anonymous 0 Comments

A collection of pre-written code that you can use to build things.

Frameworks are like going to the hardware store to build lumber, screws, and sheets of drywall that are already the right size, instead of building them from scratch. These go into our environment (the foundation we’re building on) so that we can build our house without having to cut a bunch of parts from scratch.

Anonymous 0 Comments

In general there isn’t really a strict definition of a framework vs a library, as far as I’m aware. The difference in general is that libraries are collections of classes, methods, structs, etc that you can leverage to not write everything from scratch. Frameworks, like React in JS or Leptos in Rust, are themselves collections of libraries and prebuilt data structures to streamline development on specific platforms and for specific purposes—React is a general front end framework, so it comes with a bunch of libraries and components for building out the UI and interactivity/reactivity of your website. Next.js is a framework built specifically for rendering on the server, as opposed to client side rendering. .NET is a framework for building desktop applications. All of these cobble together a ton of different libraries and different prebuilt components to make developing software easier, while a single library is a piece of that.

Anonymous 0 Comments

Imagine if you were creating a building, and you could just instantly pop in a full frame, floors, electrical, piping, etc. That would be a framework, which you can then use to build an office or a hotel or an apartment building. 

Similarly in programming, a framework is a lot of code that does common stuff that nobody wants to rewrite for the millionth time. If you’re making a web application, you want to spend more time working on the actual application logic and not on the web server component. So you use a framework that handles the webserver stuff instead and hook into that, saving time and effort.

Anonymous 0 Comments

Generally speaking, a software library is a collection of functions and objects you can use to build a software application. A framework, on the other hand, is more like an existing program with some bits missing, and your job is to add the missing bits.

This is sometimes called “Inversion of Control”. With a library your code controls the software, but with a framework the software controls your code.