News for hackers. Stuff that matters.
Re:Why is OOP still so widely spread? by esperent on Wednesday September 02, 2020 @08:50PM (#24359825)
Can anyone explain to me what the difference between a framework and a library is? I've looked it up several times but it always seems cloudy at best, and it seems like some things that are referred to as frameworks are pretty similar to some other things referred to as libraries.
Re:Why is OOP still so widely spread? by phyrex on Wednesday September 02, 2020 @09:05PM (#24359916)
My favourite explanation is that a framework calls your code, whereas for a library, your code calls the library functions. Does that make sense?
Re:Why is OOP still so widely spread? by snidane on Thursday September 03, 2020 @01:32AM (#24361030)
1. Framework owns your main() function. Using libraries you don't lose control of your main().

2. Hollywood principle. Library: you call us. Framework: we call you.

3. Frameworks are good for novices in certain paradigm because they guide along a standardised way to build apps. If you however find the framework's way not precise enough or its abstraction leaky then you will have a hard time escaping from the straightjacket.

Lot of frameworks actually are a combination of two things:

1. the actual "way of building apps"

2. useful library of functions

Lot of people would like to start with 1 and use 2 to guide them in the beginning, but drop 1 later on. Unfortunately frameworks couple 1 and 2 together very tightly making many people not even consider such frameworks.

Re:Why is OOP still so widely spread? by esperent on Thursday September 03, 2020 @05:21AM (#24362239)
1. None of the programming languages I use regularly have the concept of a main() function (not dismissing the point, just saying it's language specific). 2. Yeah, heard this one many times. It seems very hand wavy to me. 3. That's more a cost/benefit analysis than an explanation of the difference.

> Lot of frameworks actually are a combination of two things:

> 1. the actual "way of building apps" > 2. useful library of functions

This describes React pretty much spot on. And yet, React people are very determined to point out that it's React is a library, not a framework.

Re:Why is OOP still so widely spread? by didibus on Friday September 04, 2020 @03:28AM (#24372603)
The hollywood principle is actually to me the definitive criteria. You plug your code into React and React ends up orchestrating and coordinating between your code, thus it is in charge of calling it and in what order etc.

That's normally what I would call a framework.

Now I don't know, maybe there's ways to use React only as a library, not sure if it would provide any benefit in that way.

Re:Why is OOP still so widely spread? by leafboi on Wednesday September 02, 2020 @09:55PM (#24360149)
Basically like when you call something like:

   Math.abs(-5)
That's a library call.

A framework is like django or rails. You have to structure your code to fit within django's paradigm, while a library is just utilities you can use in your own code...

Re:Why is OOP still so widely spread? by esperent on Thursday September 03, 2020 @05:22AM (#24362256)
And what about React? If you search for "is React a framework" you'll come up with many, many people saying that it's a library. And yet, when writing a React app you absolutely have to structure your code a certain way.
Re:Why is OOP still so widely spread? by leafboi on Friday September 04, 2020 @12:24AM (#24371694)
Things can be both a library and a framework. You can use react like a utility and react itself can take have code injected in it.