4 ms·
I don't know if I'm just a bad programmer and everyone knows something I don't, but it seems to be the benefits of a strongly typed language are wildly overblow
by mostlysimilar 4y ago
I don't know if I'm just a bad programmer and everyone knows something I don't, but it seems to be the benefits of a strongly typed language are wildly overblown. It's a different way of thinking about building software and it saves you from a few mistakes you could otherwise make, but you'd think I was writing code with a hammer and chisel the way people on HN talk about languages like Ruby. It feels a lot like the people who used to try to convince everyone functional programming was the only way to go and object-oriented programming was for dinosaurs.
- bcrosby95 4y agoIts all guts, feels, and "everybody knows" - but afaik there's been no hard proof about statically typed languages being superior to dynamically typed ones, or vice versa.
- hbrn 4y agoThe big difference between the two that I noticed is that dynamic camp doesn't aggressively proselytize. And it doesn't shame infidels (it pities them, if anything).
- int_19h 4y agoOh, it does. It just happened back when Python and Ruby were new and hot. These days, Rust is new and hot, and so ...
- hbrn 4y agoI do remember dumping on Java back in those days, not so much on static typing itself. Seems like those were mostly language wars: Python vs PHP, Python vs Java, Ruby vs PHP, etc. It might be just anecdotal, but I noticed people often say that writing in Ruby makes them feel happy. Static typing (or functional programming, or TDD) doesn't seem to make people happy. It makes them feel superior. Whether it truly makes them superior, or just taps into their insecurities is an open question.
- int_19h 4y agoYMMV. I used to be very gung-ho about dynamic typing 10 years ago. Since then, my experience using it in a fairly large Python code base is that it doesn't make me happy, and the code patterns that make it workable tend to be very similar to how statically typed code would look anyway. Ruby specifically is a separate question IMO because it has a lot of convenience features that are kinda orthogonal to the whole typing debate. Crystal is a good example of how you can retain those in a statically typed language.
- vidarh 4y agoAs someone who was gung ho about static typing, what made me happy about Ruby was losing the aggressive type annotations, and the pain of having to change it all around, and C++ and Java were among the worst offenders. I spent a lot of time looking for statically typed alternatives that'd make me happy back then before I finally was convinced to try Ruby. These days more inferred typing in many of the static languages has lessened the gap, so the reason to hate on them has been reduced. I still would love better static analysis tools, including for Ruby, but at the same time the way I write code has changed drastically in ways that makes that harder (e.g. leveraging the dynamic features of Ruby more)
- TheRealDunkirk 4y agoTo me, it’s as much of a preference as text editor or spaces vs. tabs.
- Gene_Parmesan 4y agoFor me, it comes down to the fact that static typing completely eliminates large classes of bugs. It therefore dramatically lowers the testing load. The compile step essentially performs its own tests. Think about all the test cases I save myself from having to write... Beyond that, it also forces me to think structurally from the start. But I tend to be working on rather complex applications, I almost certainly wouldn't use a static lang for data processing or similar tasks. > It feels a lot like the people who used to try to convince everyone functional programming was the only way to go and object-oriented programming was for dinosaurs. What do you mean "used to"?? Haha
- deleted 4y ago[deleted]
- Yoric 4y agoStrongly and statically typed languages are not very common. Most languages that pretend to be strongly + statically typed aren't, by a fairly large margin (I'm looking at you, C++, Objective C or Dart). However, once you have strongly + statically typed languages, you can very often create safe-by-design (tm) APIs, APIs that are simply impossible to misuse (for some definition of misusing). A trivial example (which among industrial languages works only in Rust and perhaps Ada) is a file system API in which the compiler detects that, in some codepaths, you're attempting to try to write to a file after closing it. Exactly how much value this has for your programming depends on how many invariants you need to guarantee. If you're writing (for instance) a CRUD for non-critical data, that's usually not many. If you're writing a network protocol or a garbage collector, this can save you from worlds of pain. I have had to fix data loss and privacy issues in Firefox that would have been detected years earlier if we had used a strongly-typed language such as TypeScript (which didn't exist at the time) instead of JavaScript for the front-end. In fact, I wear a large number of scars from fixing Firefox bugs in JavaScript (or C++) code. These days, I prefer strong, static typing. I sleep more soundly :) But, as usual, we're not in a one-size-fits-all industry. There are developments for which static typing gets in the way of zero-to-deployment. As usual, tradeoffs everywhere! Note: Strongly + statically typed languages also typically offer strong support for other forms of static analysis (e.g. model checking, abstract interpretation, etc.) that are considered critical in some industries (e.g. aeronautics – or writing Windows device drivers). But we're getting into something of a niche.
- munificent 4y ago> Most languages that pretend to be strongly + statically typed aren't, by a fairly large margin (I'm looking at you, C++, Objective C or Dart). What about Dart doesn't feel sufficiently typed for you?
- Yoric 4y agoLast time I tried Dart (2020?), it was pretty easy to confuse the type system and get it to just abandon all hope of typing a fairly simple expression. I remember the early Dart presentations in which the developers very clearly stated that they didn't even try to make the Dart type system sound, because they felt that it would complicate the life of users. Apparently, these days, Dart claims to be sound... except they seem to have redefined the meaning of type soundness along the way: https://dart.dev/guides/language/type-system#runtime-checks https://dart.dev/guides/language/type-system#runtime-checks
- treis 4y agoIt comes down to project size. Small projects with a small team tend to be fine. Bigger ones tend to break down a bit and the application becomes ossified because there's no safety when changing things. You can power through it but productivity takes a nose dive. The big ones that stay on Ruby tend to invent typing like things to solve the issue.
- vidarh 4y agoIf there's no safety when changing things, then you've failed to define and verify adherence to contracts along component boundaries, and the lack of a proper test suite. I've certainly seen that happen in Ruby, but I've also seen that happen in every other language - most of them statically typed - I've worked with, as very few languages have type systems expressive enough to prevent it (and it tends to massively destroy productivity to try check everything strictly enough anyway).
- hbrn 4y agoUnfortunately static typing has turned into a religion. IIRC someone looked at Github issues a while ago to understand the impact of dynamic typing on defect rate. What he found was that around ~1% of bugs in JS/Python/Ruby enterprise systems were type-related.