this post was submitted on 16 Jul 2023
693 points (92.2% liked)

Programmer Humor

32572 readers
225 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

No offence

you are viewing a single comment's thread
view the rest of the comments
[–] Iteria 21 points 1 year ago (2 children)

Because it's inescapable. Web development is by far the most common type of programming work and even if you're a backend developer you tend to have to touch javascript at some point, so everyone knows the pain of javascript's foot guns and javascript has a lot.

The fact that it's mandatory to do your work invokes bitterness in people. For backend, you can kind of switch around until you find a language you like. For frontend, it's javascript or nothing at all.

Javascript as a language is very out of sync with other commonly used languages. Its footguns are very easy to run into. As a result you have a lot of rituals around just not shooting yourself in the foot. The rituals, libraries, and frameworks around avoiding Javascript's foot guns have been very shifting and changing. Of course, because the javascript ecosystem changes far faster than other languages, there are a lot of rakes for developers to step on to add to the naturally existing foot guns.

Javascript as a language probably shouldn't be the sole language of the internet for a variety of reasons. It's a very hateable language because of how easy it is for newbies to make new terrible code and how common it is. Until something like WASM takes off, the downpour of hate for javascript will continue.

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

Javascript as a language is very out of sync with other commonly used languages.

How so? Moving back and forth between Typescript and C# / Java is pretty natural imho, as long as you understand the compiled vs interpreted differences.

[–] Iteria 1 points 1 year ago* (last edited 1 year ago)

The vary concept of truthy and falsy makes it very out of step. The triple equals only partly negates that foot gun. Const and let also only partly negate the footgun of hoisting, lexical scope, and the non-obvious impacts of currying. Prototype inheritance would be truly bizarre to people used to more standard inheritance style and many people don't know that javascript's classes are syntax sugar over that system and it leads to foot guns. Many people don't understand destructuring, because they don't understand that javascript objects are all dictionaries in a trenchcoat. Honestly there's a lot of cargo cult behavior in javascript that comes because the language is bizarre given what most people would have experienced.

[–] [email protected] 2 points 1 year ago

In my experience (Javascript and PHP, which both have plenty of footguns), these pitfalls can be avoided by using good practices.

Just because they are dynamically typed doesn't mean you have to use dynamic typing. Don't type switch your variables.

Just because you don't have to use brackets in a certain scenario doesn't mean you can't. Use them as needed for clarity.

That kind of thing.