News for hackers. Stuff that matters.
Re:38% of bugs at Airbnb could have been prevented by using ... by mattmanser on Monday February 11, 2019 @04:34AM (#19133129)
As someone who is very pro-static typing, the big annoyance for me is that sometimes you have to write a load of boilerplate purely because of the type system.

It's got a lot better in the last decade, but with the more advanced features of a language you can find yourself slowed down in a few ways. Maybe by having to explicitly declare types where you'd normally implicitly declare them. Or you might have a load of methods that actually throw 'Not Implemented' errors because you are forced to match a massive interface but it only has to do one thing (yes, C# has an actual NotImplemented exception because this is so common).

It's annoying and can interrupt your flow, mean you have to spend a bit of time searching for the right voodoo code to make it work or you sometimes feel like you're doing a rain dance just because of the type system.

The other thing is that you're sometimes forced to cast a variable to a type that you know is already that type, but a method has returned it as an 'object'. It feels really clunky, e.g. event listeners.

Re:38% of bugs at Airbnb could have been prevented by using ... by koyote on Monday February 11, 2019 @04:50AM (#19133196)
I'm playing a bit of devil's advocate here, but:

> Or you might have a load of methods that actually throw 'Not Implemented' errors because you are forced to match a massive interface but it only has to do one thing (yes, C# has an actual NotImplemented exception because this is so common).

I would heavily argue that if you encounter such a scenario you are probably Doing It Wrong® or you were unfortunate enough to inherit/have to work with some badly designed code.

Re:38% of bugs at Airbnb could have been prevented by using ... by mattmanser on Tuesday February 12, 2019 @02:05PM (#19146428)
In an ideal world maybe, but there's no point fully fleshing out an interface where you know you're not using those methods. I'm old enough and ugly enough to comprehensively know what I'm doing.

It's simply because interfaces in a framework are occasionally quite big and unwieldy, I'm sure their developer thought it was for good reasons, the other option is to split the interface up and have a class inherit from a ton of interfaces, which is just as annoying.

There's a few other replies here I'm rolling my eyes at because real-world programming is messy and being too dogmatic with ideals simply isn't practical.

Re:38% of bugs at Airbnb could have been prevented by using ... by regularfry on Monday February 11, 2019 @05:36AM (#19133418)
Then you run into the problem of the massive global framework having Done It Wrong and not being able to deprecate.

(note: this is not unique to static type systems)

Re:38% of bugs at Airbnb could have been prevented by using ... by dorgo on Monday February 11, 2019 @05:48AM (#19133485)
Yes, but even Java standard libraries throw UnsupportedOperationExceptions. It is so sad.

Edit: This is exactly the point where a type system betrayes its promises.

Re:38% of bugs at Airbnb could have been prevented by using ... by twic on Monday February 11, 2019 @10:36AM (#19135142)
So try and avoid it, like Scala - you have now found yourselves trapped in an incomprehensible maze of GenTraversable and the like.
Re:38% of bugs at Airbnb could have been prevented by using ... by scarface74 on Monday February 11, 2019 @06:02AM (#19133549)
Or you might have a load of methods that actually throw 'Not Implemented' errors because you are forced to match a massive interface but it only has to do one thing (yes, C# has an actual NotImplemented exception because this is so common).

That’s where the “I” in SOLID comes in.

Re:38% of bugs at Airbnb could have been prevented by using ... by marcosdumay on Monday February 11, 2019 @06:24AM (#19133645)
Hum... I think it was upper on this thread that some GP was preemptively excusing the people hurt by Java. Well, C# is the same.
Re:38% of bugs at Airbnb could have been prevented by using ... by zozbot123 on Monday February 11, 2019 @06:26AM (#19133652)
> Or you might have a load of methods that actually throw 'Not Implemented' errors because you are forced to match a massive interface but it only has to do one thing ... The other thing is that you're sometimes forced to cast a variable to a type that you know is already that type, but a method has returned it as an 'object'. It feels really clunky

These are not "problems with static typing", though. Dynamically-typed languages have you do these things all the time, it's just that you don't even notice it anymore because it's so common and you don't have static types as an alternative there.