| > Is imperative programming more intuitive to people than functional programming? If so, is it because it matches the way our brains are configured, or because it’s simply the most common form of programming? (I think) It's not because of brains or abundance, it's because of the human language. > How far should we go to match people’s natural processes versus trying to change the way people think about programming? Economically, it is your time (of one person only) versus the time of potentially thousands of users. What do you think? > How impactful are comments in understanding a program? Variable names? Types? Control flow? Ideally, I think, comments would not be contained in the source code, polluting the general vision of its structure, but would be placed outside, as documentation. For variable names, as long as its meaning/use is made immediately clear on first sight, without needing to figure out its frequency pattern or see its declaration to figure it out (maybe placing it in a separate place from the code, again), the variable name shouldn't matter much (as long as its not purposefully unrelated or obscure). I think it would be useful to have something like a "live documentation" in a REPL (commands like man commands documenting each part of the language (and program), each word an entry, non-sequentially accesible). That is something I would do if I were to design a programming language, a structure called a "dictionary" documenting each and every reserved/defined word in the environment. |
I believe Donald Knuth, who introduced Literate Programming, would disagree with this.
"According to Knuth, literate programming provides higher-quality programs, since it forces programmers to explicitly state the thoughts behind the program, making poorly thought-out design decisions more obvious. Knuth also claims that literate programming provides a first-rate documentation system, which is not an add-on, but is grown naturally in the process of exposition of one's thoughts during a program's creation."
https://en.wikipedia.org/wiki/Literate_programming
https://www-cs-faculty.stanford.edu/~knuth/lp.html
I have not used full-fledged Literate Programming, but I find having part of documentation interleaved with code helps improve both and reduces cognitive load required to search for relevant documentation elsewhere.