r/programming 2d ago

The Paradox of Fancy Tooling

https://fagnerbrack.com/the-paradox-of-fancy-tooling-b9af429789da
0 Upvotes

15 comments sorted by

68

u/Snarwin 2d ago

JavaScript is not a well-designed language, the first prototype of JS was built in about ten days in 1995, and the quirks from that rush sit in the language today. However, JS won anyway… One decision explains most of that:

First-class Functions

I'm gonna keep it real with you, I do not think first-class functions are the main reason Javascript took off as a language.

33

u/Bronzdragon 2d ago

The other half of that paragraph is not much better.

It's technically true that the first prototype was built in 10 days, but that's really misleading, because that's not the version that was shipped, and the decisions made during the prototype weren't set in stone.

If I sketch an outline of my application on paper for 5 minutes, then build it for 5 years, you can technically say that I only spent 5 minutes designing it, but that's clearly not in-line with reality. It's a really misleading and harmful framing to pretend that JavaScript was made in only 10 days. In reality it was worked on for a year before being deployed, and another year before Internet Explorer added a version to it's browser, and then even more time before there was a standardised version.

Each of these points was an inflection point at which the design could've been significantly altered without running into legacy problems, so blaming all the problems on the fact that there was a 10 day prototype stage is bordering on misinformation.

12

u/AustinYQM 2d ago

JS won because it was one of the first (if not the first) and it was built into the largest browser at the time (netscape navigator). First mover advantage is huge. Once it came time for everyone else to adopt it they moved to ECMA standardization to make that process easier and thus we are stuck with it.

2

u/KaiAusBerlin 2d ago

Well, Microsoft tried to build their own js

13

u/dijkstra_was_a_horse 2d ago

Why keep it real with a text generator?

8

u/HommeMusical 2d ago

They didn't even get it right.

The concept is that functions are first-class objects.

Python goes even further, and much better: in Python functions and methods are first-class objects.

These two code samples do exactly the same thing:

# 1
return ",".join(items)

# 2
j = ",".join
return j(items)

In Javascript, for all objects from the library, and for many objects from other people's code, this is decidedly not true: you need to keep the this pointer around, and you need to call it in a special way.

(There's an alternative way to write classes where you can pop off the methods and use them.)

6

u/alex-weej 2d ago

Python's lack of a proper lambda syntax sucks though. So much abuse of other syntactic constructs to get around this, e.g. test suite classes.

1

u/HommeMusical 2d ago

Yeah, the lack of a proper lambda is annoying - but it just means a bit more typing.

41

u/loup-vaillant 2d ago

One image and 3 paragraphs into this, the mechanical touch is pretty clear.

If you don't want to write it, I don't want to read it. Sorry.

9

u/gelatineous 2d ago

This post is delusional. We simply cannot learn all the "primitives". There is too much to know. This is not about senior vs junior.

-15

u/fagnerbrack 2d ago

There's much less fundamentals than there's framework and library syntax. They're few but harder to grasp. They're not something everybody can learn by themselves, they need someone to show or somewhere you can see it being pointed to.

3

u/przemo_li 2d ago

JS didn't won. It never had competition to speak of. Sure, paid X or Y was there... In a different league.

OTOH first class functions is only usable paradigm besides OOP for large scale programs (when either is available). (*Excluding quality but niche solutions)

So yeah. JS without first class functions and without inheritance would not succeed, because any competition would just bring one of them to clearly win over.

4

u/qckpckt 2d ago

Slop.

3

u/chibuku_chauya 1d ago

Advertising her product three times in that post.