top | item 41321016

(no title)

h335ian | 1 year ago

I think, based on many battles, a lot of folks in the early days that came from Java/C++ absolutely struggled with the key concepts of JavaScript, couldn’t find “features” (like strong typing) they claimed were critical for writing good software and invented ways to make the language fit their paradigm, rather than really deep dive into the language and embrace it. There were constant battles back then - and I’m sure the battles continue.

JS was certainly never a “garbage” language but the elegance is unappealing/unappreciated by entire classes of developers. I totally get the perspective, but it’s all based on a worldview that just doesn’t get functional programming

discuss

order

fenomas|1 year ago

I've enjoyed vanilla JS since forever, and currently work in a TS shop, and FWIW I think you're waaaay off base. There may have been times and places where TS was heavily OO, but all the TS I come into contact with is heavily functional, class-averse, immutable by default, etc.

(In face, the Java/C++/OO-types I know strongly dislike TS because it's structurally typed. TS doesn't care a jot who extends what - as long as they have the same properties it's happy. Hard to get more un-java than that.)

The real reason that TS won is simply that large teams (e.g. hundreds) cannot effectively work together on untyped JS. If you're doing a solo project, fill your boots - use JSDoc comments, sprinkle asserts around, whatever. But the webdev world at large doesn't care about Java or OO concepts, it settled on TS because huge teams can work effectively with it.

h335ian|1 year ago

There it is… that’s the classic argument. Large teams/codebase. I totally get the appeal, but the idea this can’t be done effectively without it is nonsense. Long before TS, we had JS apps with teams of 50-100+ working across hundreds of not up to a couple thousand files - in CVS/SVN repos (ugh). I will concede that TS does help in the larger teams/codebases but - I will contend it is not necessary if your team is composed of folks that have depth of experience working without.

dleeftink|1 year ago

I hear you, but am also interested in some JS libraries or techniques that fall in the elegant category.

An elegant typed one would be Structurae [0].

I imagine/would love to see a bunch of elegant non-typed ones as well.

[0]: https://github.com/zandaqo/structurae

danmur|1 year ago

I love functional languages but I'm not sure how JavaScript could be considered as a functional language (at least if functional means something like haskell, or elm). Functions-as-values isn't enough, otherwise Python could be called a functional language.

h335ian|1 year ago

Classic example of comments I've heard since the 90s.

I’d strongly encourage doing a deeper dive here. Functions in JS are objects and can have their own methods/props + scope. They’re a first class citizen.

devbent|1 year ago

> couldn’t find “features” (like strong typing) they claimed were critical for writing good software

How about reasonable scoping rules?

Pre-es6 JavaScript was a nightmare of ugly hacks needed to make the language usable. that = this and {...}() All over the place.

nsonha|1 year ago

no one said any thing about functional vs oop. Why does every vanilla js "veteran" think types === OOP and the reason we do typescript is for OOP? How about basic things like not even have a module system (before nodejs) for Christ's sake? How about doing functional programing properly, with types?