
Library patterns: Why frameworks are evil - 5960312
http://tomasp.net/blog/2015/library-frameworks/
======
chuck32

      This follows from my experience with building F# libraries, but the ideas are quite general and can be useful in any programming language.
    

This is just not true. The whole article really doesn't apply to any
mainstream programming languages like ruby, python, java, javascript etc. The
author seems to be coming from an academic view point and the points he makes
really don't translate to the software engineering world.

His analogy about frameworks being package holidays while composing libraries
is like independent travel only tells half the story. How do you organise the
interaction of libraries? You can do it yourself but you will have to follow
some sort of pattern to organise the code in order to make it easy to work
with. What happens when another coder joins your project? Are you going to
tell them the pattern you have already been using? What if they dont follow it
as expected or disagree with it? Frameworks standardise this. Yes you might
not always like certain aspects of the framework you're using but its the
price you pay for not having a project full of developers who each have their
own way of doing things and are constantly argueing over how to organise the
codebase.

Also this hyperbolic use of the word "evil" is immature and dorky. Sorry.

~~~
willtim
> _points he makes really don 't translate to the software engineering world_

His advice is in the context of functional programming languages. F#, Scala
and even Haskell and OCaml are now very much part of the software engineering
world (albeit a small part).

> _How do you organise the interaction of libraries? You can do it yourself
> but you will have to follow some sort of pattern to organise the code_

Because libraries compose, there's nothing to prevent a library on top of all
these others libraries to accomplish this. If you have to repeat yourself with
"patterns", your language of choice is failing you.

~~~
chuck32
> His advice is in the context of functional programming languages.

Thats not what he says. He says that these ideas "can be useful in any
programming language". Which is the point that I disagree with.

> there's nothing to prevent a library on top of all these others libraries to
> accomplish this

So a library to organise the code which interacts with other libraries? Sounds
an awful lot like a framework to me?

~~~
willtim
I agree that his advice will be difficult to follow in less expressive
languages.

> _So a library to organise the code which interacts with other libraries?
> Sounds an awful lot like a framework to me?_

The domain/purpose does not alter the framework/library distinction according
to his definition.

------
mvindahl
Having worked with plenty of frameworks and libraries over the years, I also
find myself solidly in favor of libraries. In a sense, IMHO, you are a slave
to the framework but a master of the library. (On a side note, pretty much the
same dichotomy applies to cats vs. dogs).

That being said, I have several friends with the same level of programming
experience who stringly disagree. So voicing my opinion on frameworks is
always excellent fuel for discussion.

------
forkLding
I unfortunately depend more on frameworks than libraries for coding apps,
mainly because I think frameworks are easier for me to use to manage software
architecture and patterns, its harder for me to manage a software project with
just libraries because I often spend hours just trying to figure out how
certain components should interact. I understand the concern but I think for
starting a project, relying upon a framework is much easier as it abstracts
away a lot of the thinking in the beginning for managing the architecture.

Probably libraries play in more with a more mature app because its much easier
to optimize and maintain once you have a set pattern to rely on.

~~~
chrisco255
I think frameworks are great for quick proofs of concept. There is less
thinking up front I suppose. But given a long enough timeline on a complex
enough project and a framework begins to show its limitations. And then you
end up fighting the framework. You're also at the mercy of the framework's
maintainers to adapt and evolve your app's architecture.

We are still learning and experimenting with the best ways to build apps.
Libraries allow you to adapt as new patterns and paradigms emerge, much easier
than frameworks.

------
al2o3cr

        Use events & async functions instead of frameworks
    

Funny, the runtime required to support that async abstraction sure sounds like
a thing that's responsible for running the system while you plug pieces of
code into it at defined extension points. But that's unpossible, since we just
learned that doing that is EVIL.

Snark aside, we've seen (more than once) in the Javascript space that
"libraries not frameworks" can breed something even worse; ad-hoc copy-pasted
cargo-cult setup files, pseudo-frameworks that use StackOverflow as source
control.

~~~
chrisco255
I see no proof that JS frameworks lend themselves to less StackOverflow
questions.

Let's take React vs. Angular 2+ for example. Despite React.js having three
times the popularity and being 4 years old at this point, it has 50,762
questions on SO [1] vs Angular 2+, which despite being less than one year
old...has 63,932 questions on SO.

[1]
[https://stackoverflow.com/questions/tagged/reactjs](https://stackoverflow.com/questions/tagged/reactjs)
[2]
[https://stackoverflow.com/questions/tagged/angular](https://stackoverflow.com/questions/tagged/angular)

------
bullen
I tried to build my app server as a library and a framework, but to hot-deploy
code you need a framework.

Also if you want to offer leverage in distribution and scalability you need a
framework.

[https://github.com/tinspin/rupy](https://github.com/tinspin/rupy)

------
dev360
On an unrelated note - does anybody know the name of the color scheme for the
snippets? I'd like to try it in vim.

~~~
cestith
I didn't find a Vim scheme for you for certain, but take a look at
[http://tomasp.net/custom/tooltips.css](http://tomasp.net/custom/tooltips.css)
to grab the color values.

It does sort of resemble 'koehler' from the color schemes that shipped with my
copy of Vim. Certain details are different, but it may be a good one from
which to start.

------
mcappleton
Probably depends on the language. Frameworks are great on the front end
though, because Angular/Vue are basically just easy ways to interact with the
GUI. It's much less convenient without a framework.

