Hacker News new | ask | show | jobs
by ShalokShalom 544 days ago
Another case, where libraries make more sense than frameworks, is on the level of polyglot programming, so compatability with other languages.

Implementing a library for the JVM is exactly that:

Clojure can use it, Scala can use it, and Kotlin can use it. Even if it's written in Java.

If a framework is implemented for a certain language, even though it might run on the same platform, or if you use a transpiler to said language, the port is practically mandatory.

This comes with an astonishing insight: There is always a framework. When you start a piece of code, and you import libraries, from the perspective of the libraries, you are the framework.

It's just that you are under the control of the code, and you pick the libraries that fit into your design.

The whole process of fitting into an existing structure is so fluid, that you don't even notice the concept of a framework being in place.

Even a programming language has an inherent framework in place:

The coding architecture of any language is its framework - and every other concept that some user of said language wants to implement itself has to fit into it.

And now, you see how smart languages give you freedom and simultaneously provide enough guidance to avoid writing yourself into a corner.

It is limiting, and thus that provides freedom. It provides freedom, by constraining itself.

A syntax is a set of constraints. All semantics is.

It is always the same principle, and frameworks/libraries are simply that principle, reflected on the API level.

I also wondered, why bad frameworks are so widespread, so why they are used, when they are not appropriate.

I assume that business application developers prefer the concept of frameworks because this allows you to provide extensibility to the user, without having to open the source code, or leaving yourself open to vulnerabilities.

A typical use case for polymorphism.

They can join in, and you are in control. Sounds like something the average ~~Joe~~ CEO would want?

The average ~~Joe~~ programmer would then go on and create their open source web framework - with the very same principles in mind.

Simply because they are used to it..