7

Pet peeve: the claim that static typing prevents errors.

Today I worked on a C# project that's a mess of nulls, side-effects, inferences, and race conditions. Then I went back to a JS project that's twice the size but written in a clean, well-tested, FP style and currently has fewer than 10 issues logged.

Look, I get that there are upsides to static typing, and I'm open to introducing typescript or flow for our JS code.

I just can't stand the faux-concern from the static typing dingleberries when they are the ones who produce these horrendous lumps of unmaintainable shit, and the JS/Python/Ruby/etc people are over here quietly reinventing functional programming and code modularity.

Comments
  • 0
    When I say the JS project I worked on is twice the size, I mean it has twice as many features (and probably needs to be broken up a bit). It probably has fewer lines of code.
  • 5
    doesn't matter the language, bad devs write bad code.
  • 3
    I don't think the argument is that statically typed languages and have bad code. I think the idea is that they are less likely to produce code that is bad
  • 2
    You can chop a burger with a spoon if you want but a knife makes it easier.
  • 0
    Well, the problem here does not seem to be with typing but rather going willy-nilly with side-effects. If only Haskell style purity were the norm, a lot of these would be gone.
  • 0
    The problem with these kinds of languages is you can't go purely functional even if you were fully disciplined to. How will you get monads and such if you don't have proper typing like HKT and nicer parametricity?
  • 2
    Yes! Sometimes I feel like I'm going crazy thinking this, its good to hear another out there. What are these terrible bugs they're talking about? Did I miss the fucking memo or something? Do they concat strings to ints all the time or something? Most bugs I've encountered are from inconsistent state flying around shittily-named, over-engineered, misspelled, objects that are following an irrelevant design pattern, supporting a feature that nobody gives two shits about! How does static typing address that shit?
  • 2
    @debug well, obviously you don't, which is a shame because Haskell's type system is one I really like. But you can still use immutable data, write pure functions and combine them with HoFs so the code is intelligible and maintainable.

    I was really putting the boot in to C# and Java, which have been used to write so many lines of fucking terrible, buggy, confused, side-effect laden code that I can't believe they still have such a grip on corporate development.
  • 2
    @zzguy Exactly! Perfectly put. Like, about once a year I have to fix a bug that makes me think, "oh right; c#-style typing would actually have caught that" - is that worth the extra cognitive workload of constantly appeasing the type system?
  • 0
    C# is not statically typed.
    Standard ML is.
Add Comment