Hacker News new | ask | show | jobs
by nsonha 663 days ago
> using native JavaScript without all the BS that comes with TypeScript

do you think javascript was just too easy and people had to invent some bs to make it more interesting for no reason? You don't even know what you're talking about when you make the connection from ts to oop.

My experience comming into javascript is that it's a garbage language and the web stack was a joke, everything was hard for the wrong reason (css centering things kinda stuff)

All these modern tooling, though complicated, is not new in NORMAL programming and makes sense, so you cow boys learn to deal with it.

2 comments

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

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.

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.
Certainly we had large teams using JS before TS - back in ye olde days before modules, when everyone picked or built a smallish abstraction (e.g. jquery) and built smallish unconnected things on top of it. But now that modules are mature and thousands of files can all reference each other, types are just necessary. They don't have to be declared in TS - you can get by to various extents with JSDocs or inference - but there's no benefit to doing those things, so large teams don't.

What I am saying is, across several comments you seem to be arguing that you think TS's massive popularity is partly due to its proponents liking Java or classical inheritance, or not understanding FP or closures, or something. And that's just wildly not true. And it's also not even true that the TS world particularly favors OO. If you weren't saying those things and I misunderstood, my bad!

It’s fair that there are proponents & value props beyond those early folks that came from the Java type world.

I guess I’m tainted/jaded by the early proponents and initial rationale that was absolutely tied to - “ewwww dynamic types!?! Gross, where are my strong/static types!?”. I’ve just fought that too many times - and that was a very strong argument at the inception of TS. There certainly are value props that go beyond and more to be discovered I’m sure.

I feel like MANY if not most of the devs I work with today simply use TS cause “that’s what you do these days” - but they have no clue what the “why” is and are baffled by native JS typing - and still consider JS “garbage” as a result. Bummer. In the Scala community I hear so much hate for NodeJS because it enables JS for server-side, “where it doesn’t belong” for many of these same old reasonings about typing (even with TS!?).

So yah, there’s value there, but you don’t NEED it to write large, good software. I’m clearly just jaded by the religious debates that have gone on and on - so despite their utility, I can come across very anti to the “solutions” to IMHO shitty arguments.

TS rocks so hard for doing pure functional stuff, and its support for type algebra can be an absolute blast.

I try to avoid OO now days, and TS is my go-to language for modeling problems in the functional domain!

I've worked adjacent to TS since it was a thing and I've never heard of anyone associating it with Java or classic OO or the other stuff you've brought up. Maybe it's seen that way by some other community somewhere, but not by TS users.

I mean - it's literally just JS with types! It still has closures, and still has everything about JS one can call functional. It's not some dramatically different language - it's JS, with a large category of runtime errors changed into linter errors. (And that's why people use it - not because they think "eww gross!" about something, which is a frankly silly thing to claim.)

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

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.
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.

people are stupid only you, some javascript coder of all people, knows the secret of programming, spit it out in clear terms instead of making non-argument.
> 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.

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?
How does the complexity of CSS make JS a "garbage language"?
> the web stack was a joke

it's a comment about the thinking behind the design of the web stack including js