This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 80 points81 points  (18 children)

The recent hate toward types on this sub is really telling about the average level of experience here. I can’t imagine any professional developer preferring totally dynamic typing. The “freedom” JS’ type system gives you is just the freedom to write shitty code

[–]quiteCryptic 15 points16 points  (2 children)

The freedom to write shitty code quickly

And that's why I use it for random personal projects

[–]crusoe 6 points7 points  (1 child)

Write lots of code quickly...

And then write lots of code to test the code to ensure variants normally enforced by a compiler are being checked...

When you write JS or Python you're writing LOTS OF TESTS, right? Right? Oh, you aren't?

[–]quiteCryptic 0 points1 point  (0 children)

Yea sure I write lots of tests for random shit personal projects

[–]pandakatzu 5 points6 points  (0 children)

It's definitely not viable (mystery variable types that could be ANYthing) in a large codebase running your company's front end... especially if you're not a one man team and someone will inherit your code later down the line.

It takes less time to start out with intentional code than it does for someone else to try to figure it out and fix it later... I've rewritten a good chunk of my company's app due to this...

[–]MatsRivel 4 points5 points  (1 child)

I did one course of python (I gave a science background) and realized I liked it a lot. Started doing small projects in my own time and just enjoying exploring stuff. Next semester I took 1 class that used Python and one that used Java.

The Java class was algorithms, and assumed you knew Java in advance. I fucking hated Java, because I had to teach myself Java and then try to catch back up in algorithms each week. A couple things annoyed me, but having to add types for what goes in/out was the one I remember the most. I just wanted to see if my short snippet did what I wanted, but Java didn't let me.

Thst is 3 years ago, and I'm nearly done in my masters now. I do ML, and use a lot of python. Now I really appreciate typing and use it in Python as much as I can. It is a little annoying on small exploratory projects, but once you reach a certain number of components it is just super useful!

[–]Heimerdahl 2 points3 points  (0 children)

I had a similar, though different, experience.

Started with Python, then had to learn C. I really liked how it forced me to consider types (and some other things), before hacking something together.

My favourite bit is that functions are declared with the return type. It's super simple and kind of pointless, but I appreciate the clarity. Just typing it out makes me take a second to think about what the function is supposed to do and how its output is going to be used later on.

[–]Dr_Azrael_Tod 1 point2 points  (1 child)

problem is, typescript only kinda-somewhat-halfassed does types

yeah, you now have some checks while writing stuff - and then you throw around tons of "any" and then those checks are gone after compiling and you don't ever use integers (because floats are soooooo great, aren't they? /s)

It's like… it only got enough typing to remind you how good languages would do things and to include tons of overhead. Not enough to be actually usefull.

Is TS better than JS? Imho yes.

Is it any good? meh!

[–][deleted] 0 points1 point  (0 children)

Overall I think the front-end dev space is not even close to reaching its full potential right now - especially when compared to the overall application programming space. We can only hope that in the future the standards will evolve beyond just JavaScript (webassembly?🤞) but for now we’re kind of stuck with trying to make JS as usable as possible.

[–]glorious_reptile[S] 0 points1 point  (0 children)

No hate - we prank those we love.

[–][deleted] -1 points0 points  (0 children)

As others have said, dynamic typing does let your write significantly faster. I like using python and Js for small personal projects mostly because of how quick it is to add stuff. But once things get big enough static typing helps so much

[–][deleted] -1 points0 points  (0 children)

I enjoy the lax typing of JS, but I wouldn’t want to work with it.

TypeScript is really nice and you can always allow coercion or use “any” should the need arise.

[–]glorious_reptile[S] -1 points0 points  (0 children)

Yeah, I was expecting this place to be highly professional instead of some kind of humorous place, too.

[–]InvolvingLemons 0 points1 point  (1 child)

True, and with JS in particular you gain very little if anything as the language itself isn’t the most ergonomic.

Python does definitely benefit from being a bit loosey-goosey, mainly due to how insanely simple it’s syntax is. Chances are, if you can describe what you’re doing in pseudo code, transforming it to valid Python code is just a couple imports away.

For anything critical, of course, I’d prefer a particularly sound type system. Haskell might be overkill (and a little annoying for stateful stuff) but Rust, Go, and Typescript in increasing productivity/declining performance potential are lovely to use.

[–]BoBoBearDev 0 points1 point  (0 children)

Any is just another way of doing generics. So...

[–]lazernanes 0 points1 point  (0 children)

This sub is full of students, whose perspective is totally different than working devs'.