Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.


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)


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.


So try and avoid it, like Scala - you have now found yourselves trapped in an incomprehensible maze of GenTraversable and the like.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: