3 ms·
Wait, ARE TYPESYTEMS POKA-YOKE FOR PROGRAMMING?!?!?! On of the well known Poka-Yoke strategies are cables that can not be plugged to the wrong port since there
by turbinerneiter 6y ago
Wait, ARE TYPESYTEMS POKA-YOKE FOR PROGRAMMING?!?!?!
On of the well known Poka-Yoke strategies are cables that can not be plugged to the wrong port since there is a different one for everything. Kind of relates well to function signatures that make sure only the right type of data comes in.
- TeMPOraL 6y agoThat's how I see static typing in languages, yes. I've not yet experienced the languages that offer the purported transformation of the way of programming, in which you spend 90% of the time designing the types, 10% cleaning up, and the program magically works. So for me, static typing is quintessential programming poka-yoke. And that's why I like it.
- jansan 6y agoAnother Poka Yoke system for programming are asserts.
- przemo_li 6y agoIt's not that simple. You can easily design type system + compiler, which will have destructive "attitude". It's no different from human interactions and how being "right" is not always "being constructive". Best type systems have low mental overhead, can be selectively applied (to benefit when it's profitable, and to avoid costs where it's too costly), are humble, and are good companions by helping developer learn the domain space. E.g. 1 there are good blog posts describing how you can write Haskell code by just asking Haskell compiler what type is needed to fit with the rest of your code. Step by step you fill in the blanks. E.g. 2 there are good videos from Clojure about how you can follow types to implement a new idea. Counter example: Neither 1) nor 2) is possible in C, and yet you pay hefty price mandated by C type system. All 3 type systems have their own trade offs. Picking one that is most aligned with goals of your project does have impact :)
- lmm 6y agoWhat C has isn't really a type system, it's more a system for expressing storage characteristics. Custom types are cumbersome, polymorphism is nonexistent, but blatant errors are not prevented.
- williamdclt 6y agoYes absolutely. Linters too! "parse, don't validate" (https://news.ycombinator.com/item?id=21476261 https://news.ycombinator.com/item?id=21476261) too. An API that prevents you from doing the wrong thing too. Banning a dangerous function too (that's linting, I suppose).