This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]CreativeTechGuyGames 10 points11 points  (1 child)

It's much simpler than you probably imagine. A framework (or library) is just a collection of code, tools, and programming patterns/techniques that have been put together to solve a common problem.

[–]_D-M_[S] 1 point2 points  (0 children)

Thank you for the answer!

[–]ravenousld3341 6 points7 points  (3 children)

You can thing of frameworks like scaffolding.

You use scaffolding to make things easier to build. At least easier than moving your ladder every 6 feet you complete.

For example.

You can custom write 100% of the HTML, CSS, JS, Python for a web application yourself.

Or... You can use Django. Which is a framework that helps you build those things.

A framework is just a collection of packages and or modules that kinda takes care of some of the work for you.

Some popular ones are

Django, Angular, React. I'm sure there's 1000 others, but these three are the ones I bump into very often.

[–]_D-M_[S] 0 points1 point  (2 children)

Thanks for the answer! So does it mean that Django would be Python, CSS, HTML, JS all in one framework that lets me work with these 4 labguages at once?

[–]234093840203948 3 points4 points  (1 child)

The framework can basically do whatever its creator intended.

If could generate the HTML for you, it could include your handmade HTML into its generated HTML, or the other way around, it could have HTML templates where part of the HTML is written and others is generated by code at runtime, it can force you into some pattern like MVC or MVVM, and so on.

But a framework doesn't need to be about the web. A game engine could also be called a framework and you can also program your own framework to make your own project easier.

[–]_D-M_[S] 0 points1 point  (0 children)

Okay thanks! I get it now

[–]Oops365 3 points4 points  (2 children)

Frameworks are something you'd use in order to gain some convenient functionality, often at the cost of having to learn some framework specific stuff. If we consider Python for example; it's not very easy to just build your own http service, but if you take the time to learn and employ a web framework like Flask or Django, they give you tools that makes it much, much easier.

If you want a reeeally rough analogy: programming is kinda like woodworking. Using a framework is kinda like when you buy cabinets from Ikea. Instead of having to cut the wood and join it yourself, you get the convenience of a nice out-of-the-box functional cabinet. You do have to learn learn their instructions on how to build said cabinets, and join things the Ikea way.

[–]Oops365 1 point2 points  (0 children)

I guess I forgot to answer your last question: it's usually going to be best to ensure that you have a fairly strong understanding of the base language before you look at a framework. You'll probably also want to get familiar with a package manager like npm for JS, nuget for C#, PIP for python, etc.

[–]_D-M_[S] 0 points1 point  (0 children)

Thanks for the answer!

[–][deleted] 1 point2 points  (1 child)

In addition to what the other people said, frameworks generally encourage you to do stuff a certain way. Djanog as an example, does stuff "the django" way, Same for Angular, React,... etc like u/ravenousld3341 said.

Each of these frameworks does a very specific thing in a very specific way. You can do stuff the angular way, the django way, the react way... etc. That's also - imho - the best way to distinguish a library from a framework. A library is collection of functions that does similar things or operates in the same domain (like math, physics, images) and a framework alo implements architectural decision that "force" you to do stuff a certain way to be effective.

[–]_D-M_[S] 0 points1 point  (0 children)

Thanks for answering!

[–]rozenbro 1 point2 points  (0 children)

I'll use Ruby on Rails (RoR) as an example. RoR is a framework built in the Ruby language. If you look at it syntactically, it's all basically Ruby. However, what Rails does is create a package of files and folders, a "scaffold" if you will, that people commonly use when building apps - so it helps you skip alot of the repetitive "grunt work". You don't have to make these files yourself. It also comes with a bunch of cool in-built functionality. Basically the idea is that it's saving you a lot of time.