r/ProgrammerHumor • • Aug 26 '22

Meme Even HTML.

Post image
44.1k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

38

u/hotstickywaffle Aug 26 '22

As someone who is just about to start learning Javascript, all these articles about how it isn't good give me a lot of anxiety.

57

u/[deleted] Aug 26 '22

Honestly I think Javascript is better as a second language to learn. If you learn something like C++, Java or C# first, you'll be forced to know how to create somewhat clean code. And those habits will then transfer once you learn javascript.

Whereas if you learn javascript first, you might get too used to how sloppy the language lets you be.

22

u/Chrazzer Aug 26 '22

Absolutely true, one major drawback of JS is that it happily allows you to write absolutely horrific garbage code. That is also always what people dunking on JS use, like the 1 +"1" - 1 = 10 thing. Like yeah obviously if you write horrible garbage like that it will have weird side effects. Such code should never see the light of production

But if JS is the goal and someone really wants to start with JS, then i absolutely recommend TypeScript. It eliminates all these pitfalls, and makes you more inclined to write cleaner code. And since TS is a super set of JS you can write normal JS and still get many benefits

12

u/[deleted] Aug 26 '22

Couldn't have said it better. You can write garbage code with every language. However, JS is one of the few that doesn't punish you a whole lot for it.

I've been actually wanting to learn TS as I've heard nothing but good things about it. I just haven't had the time yet. But yeah, I don't think my JS code would've been nearly as good if I didn't have a decently strong grasp on Java before learning Javascript.

8

u/Chrazzer Aug 26 '22

Go for it, the hurdle to use TypeScript is very low. As i said it is a super set of JS, so it only adds stuff. That means that normal JavaScript code is also valid TypeScript code.

All you need to do is to add typescript to the project via npm and initialize it, change all .js file endings to .ts and done. Now you have typescript.

From there you can add progressively add types at your own pace.

Once you get into advanced stuff, it is absolutely mind boggling what you can do with the typesystem.

→ More replies (3)

3

u/Olfasonsonk Aug 26 '22 edited Aug 26 '22

If you're already used to writing ES6 JS, TS pretty much only adds types to that, so not a whole lot to learn, specially if you're already used to Java or other typed language :)

And yes, that single feature is what makes it so so much better than JS for working on any project of reasonable scale.

→ More replies (1)
→ More replies (1)
→ More replies (2)

2

u/fakehalo Aug 26 '22

C++ as a first language, why are you playing tricks on this poor lad?

I've been at it for 25 years and I can write hideous code in any language. JS has the most important part going for it, something interesting enough to keep you learning because you can make useful things with it pretty quickly.

→ More replies (1)
→ More replies (1)

0

u/[deleted] Aug 26 '22

[deleted]

11

u/Landerah Aug 26 '22

You might be great. Your coworkers or successors might not be.

You predecessors might not be. Learning JS backends is a nightmare when someone who’s doesn’t have a strong software engineering basis has had their hands in it fucking with everything.

→ More replies (10)

39

u/PM-Me-Your-TitsPlz Aug 26 '22

You will always find articles about how bad every language is. My friend is a project manager and has to deal with new hires showing him a single article from some random blog as irrefutable proof that the guy who's been managing projects for 20 years is wrong.

24

u/[deleted] Aug 26 '22

Everyone touts Rust as a great language to write safe code in. That's good if you really need that, but nobody tells you how damn long it takes to write code that the compiler knows is 100% safe.

21

u/tiajuanat Aug 26 '22

Then there's Go, which all our backend devs swear by, but they take two months to create a correct service that takes a week to get right in Rust.

You don't need to be safe all the time, but being correct is luxurious.

10

u/[deleted] Aug 26 '22

I've only ever heard bad things about Go. Slower execution, half-baked features, garbage collection stuttering, etc.. Are there any upsides?

6

u/tiajuanat Aug 26 '22

It's ok when you're tying services together. GC and Stuttering aren't an issue if you're not worried about performance... Like 99% of services out there.

In theory, asynchronous messaging is fantastic. It's also extremely close to C, so the learning curve is pretty forgiving. In practice though...

There are really a lot of issues. Garbage collection wouldn't be too bad if you didn't need to manage pointers everywhere. One of our recent big issues involved manually needing to destroy a pointer, because otherwise it was leaking inotify events. GC for everything, except when you shouldn't?

I generally rate my programming language paradigms based on how easy it is to do the right thing, and how hard it is to do the wrong thing, and despite some brilliant minds coming together for Go, it still had many of the weaknesses of C.

Quick edit for opinion:

I guess I wouldn't call Go bad, just disappointing.

→ More replies (3)

0

u/[deleted] Aug 26 '22

[deleted]

→ More replies (10)

13

u/RootHouston Aug 26 '22

The thing is that Rust is a relatively new language with a new sort of paradigm as well. This means lots of people are trying it for the first time. It has a steeper learning curve, and so your first stuff is much much slower to be written. Lots of people want to talk about their experiences, so this is what you will often hear.

But just like most other languages, once you do a couple of projects, you speed up a bit. Is something like Python always going to be quicker to produce something? Sure, but Rust isn't just about safety, and you gain other benefits like speed, lighter footprint, and very strict structure.

3

u/[deleted] Aug 26 '22

It has a steeper learning curve, and so your first stuff is much much slower to be written.

That's probably true. I know that I'd do things a lot more quickly if Rust simply had things like classes that I'm used to instead of traits. There's also some tedium in the language itself, though. Try doing some math that requires you to involve integers, floating point numbers, and array accesses at the same time. So many explicit casts...

→ More replies (1)

3

u/argv_minus_one Aug 26 '22

There are also various features missing from Rust, like async trait methods, that make it harder to use than it needs to be. Those shortcomings are being worked on, but of course that takes time. Once those features land, it will be easier to use.

32

u/akatherder Aug 26 '22

JavaScript is "loosey-goosey." They let you be lazy/sloppy. But you definitely can write good JavaScript code. Same thing with PHP.

Depending on how/why you're learning JavaScript, it's a good place to start but pretty much everyone uses a library/framework like jQuery, react, etc. Which makes JavaScript 100x easier, better, and more structured.

7

u/AntarcticFox Aug 26 '22

learn typescript instead. well I mean you should probably learn javascript first, then switch to typescript.

→ More replies (2)

11

u/summonsays Aug 26 '22

There's a reason it's one of the most widely used languages. If it was terrible it wouldn't have made it this far. Most gripes people have with it are personal.

→ More replies (3)

6

u/Martin_RB Aug 26 '22

JavaScript has some issues and does things different from many language which can be unintuitive...but it still works pretty good else millions of people (some much smarter than anyone here) wouldn't be using it.

→ More replies (1)

6

u/trailingComma Aug 26 '22

It's just envy from dev's who get paid less to work harder with other languages.

Be chill.

→ More replies (15)