4 ms·
Honestly, I found the code a bit hard to follow, mostly because everything was so disjoint. It would be nice to have "folding" so I could move comments out the
by saagarjha 8y ago
Honestly, I found the code a bit hard to follow, mostly because everything was so disjoint. It would be nice to have "folding" so I could move comments out the way once I'm done with them, to allow me to look at the code as a whole. Once I know what a snippet does, I can "name" chunks myself mentally–any further labels, especially multi-lines ones that show up in between code, are unnecessary.
- KayEss 8y agoFollow the link to the Gist <https://gist.github.com/KayEss/45a2e88675832228f57e2d598afc02ae> https://gist.github.com/KayEss/45a2e88675832228f57e2d598afc0... and your code editor should give you the comment folding you want.
- saagarjha 8y agoFair point, although my editor (Sublime Text) is apparently to stupid to recognize those as block comments…
- svat 8y agoYour comment illustrates another reason literate programming never took off :-) Until a reader has spent enough time reading and getting familiar with the conventions, how to navigate, etc (in my case it was several dozen hours), they experience a lot of resistance against simply reading the literate program, and keep wanting to read “the real code”. Ultimately a program is a set of instructions to a computer, and when we as humans look at a program we're trying to conceptualize how these instructions are organized. (Essentially, “translate” them into a mental map.) We have so much more experience doing this with “real” code, knowing what we can ignore and when, and being able to do this at well — e.g. with things like function docstrings or public/private declarations, we're able to read them once and then have them basically fade away from our consciousness so we don't read them again. When faced with unfamiliar conventions, it takes a while to get that ability again.
- javajosh 8y agoPerhaps literate programs shine when they help us build that mental map. One way is positively describing parts of the map with metaphor or intent (where the OP shines). Another way is by discussing alternatives that weren't used. Yes, this can be a lot of content and sometimes crowds out the code, as in this example.