5 ms·
I understood the concept of literate programming of a way to organize _source code_ in such a way that it 'flows' better for a human, i.e. it starts with the me
by freekh 10y ago
I understood the concept of literate programming of a way to organize _source code_ in such a way that it 'flows' better for a human, i.e. it starts with the methods/functions/modules/blocks where you naturally would start if you were to explain your code and then on to the next method/function/module/block that you would explain. Perhaps some comments here and there to explain where to start and what are special points of interest.
I should have read the wikipedia article I suppose where it seems to be actual prose... :)
Now I am not sure I like the idea - always found well-written source code to be easier maintainable and understandable than prose...
- eru 10y agoLook at Knuth's Adventure example: http://www.literateprogramming.com/adventure.pdf http://www.literateprogramming.com/adventure.pdf Plenty of code with your prose there.
- efaref 10y agoI hero-worship Knuth as much as anyone, but that document is frankly terrible. Take a look at section 6. There's a flowery sentence that says no more than "Add word to vocabulary" (completely pointless if this were a method called "add_word" on a class named "Vocabulary") and then a dense chunk of completely unexplained code.
- habitue 10y agoI think the issue is treating Knuth's literate programming examples as received wisdom, or the pinnacle of the form, rather than as a pioneering effort by someone very talented, but done without the benefit of a developed culture around the practice. He makes mistakes we have memes now for (e.g. "explain why not how", useless comments for imports). I think if literate programming takes off, we'll see the form surpassing Knuth quickly