4 ms·
After reading the title, I was thinking "Agreed, adding type to your code definitely make it more readable".
by breakds 4y ago
After reading the title, I was thinking "Agreed, adding type to your code definitely make it more readable".
- pjmorris 4y agoExactly. I was wondering if someone had done a study comparing readability of static vs. dynamic typing.
- IshKebab 4y agoI haven't seen one for readability, ease of maintenance and so on, since those are hard to objectively measure. There is one where they added Typescript and Flow annotations to JavaScript projects to see if it would have detected known bugs. It found about 15% of them.
- layer8 4y agoExplicit vs. implicit typing may be more useful. A statically-typed language with full type inference may look identical to a dynamically-typed language.
- lucideer 4y ago*Caveat For me, typed code is more readable than untyped code. As someone who writes & is very used to typed code. Thinking back to a previous iteration of myself, learning C/C++, Javascript & (old, hint-less) PHP in my early 20s, typed code looked alien. Sure, if I'd applied myself a little to the reading, I guess I could've figured it out pretty easily, but I wasn't inclined to because it appeared impenetrable to me. In a similar way to regex or terse perl (though not as bad obviously). TL;DR: It needs the advocacy because the readability gains aren't obvious/implicit.
- User23 4y agoI find Haskell to be strongly typed and hard to read.
- lucideer 4y agoSame argument re: familiarity really. The question is: if there were a weakly typed haskell (same/similar syntax & conventions, no strong typings), which one would a person familiar with haskell find easier to read? Effective readability has two components: familiarity, & actual readability. We'll automatically find everything unfamiliar to be less readable, but once we're familiar with all options, which is most readable then?
- hoosieree 4y agoI love how this thread is making a type error about the word "type". I upgraded my keyboard from Cherry Red to Blue, so my Haskell is now strongly typed.
- simplify 4y agoAgree that familiarity is important. The "actual readability" you mention I call "communication" in my post breaking down readability[0]. Self-awareness on familiarity is important for any developer to have before declaring code as readable or unreadable :) https://gilbert.ghost.io/dissecting-code-readability/ https://gilbert.ghost.io/dissecting-code-readability/
- loloquwowndueo 4y agoA quick glance at the url fonts.google.com might have suggested that this was about typography instead :)