4 ms·
This was part of the beauty of Knuth's Literate Programming concept: The code was meant to be read, rather than scanned. The ability to do things like replace b
by dhosek 6y ago
This was part of the beauty of Knuth's Literate Programming concept: The code was meant to be read, rather than scanned. The ability to do things like replace blocks of code with
```
@<Description of what happens here@>
```
and then provide the description in a part of the .web file that made sense for talking about it made it possible to, for example, describe a complex algorithm in understandable steps, allowing the reader to then delve into the details of how those steps worked at a later time. When I wrote LP-style code, though, I liked to put my main method at the head of the file rather than buried somewhere deep as Knuth usually did, as it made it easier to give a high-level take of how the program worked.
With modern coding, though, where things are broken down into modular chunks, LP, I think, breaks down. It's a lot easier to have a single readable weave-generated document when you have a single compilation unit. One of the things that turned me off of cweb was that I realized that my practice of putting the .h and .c files together in a single .cweb source file made sense for the presentation, it greatly increased compilation times since the .h file would be regenerated even if it wasn't changed which then meant that all the files that read the .h file would also be regenerated. Given that compilation times back in the 90s were a significant issue (and in many cases, we were in a single-processing environment), this was a big handicap.
With a lot of modern coding, the biggest challenge is just finding a starting point for grokking the code. In a Spring application, for example, the main() method is literally the least interesting part of the code. Usually, I will look for a controller and start digging from there. Given the fact that so many of my co-workers seem unwilling to create simple readme.md files that talk about how to build and run code, I think it would be a lot to ask for them to provide a guide to reading the code.
- akkartik 6y ago> With modern coding, though, where things are broken down into modular chunks, LP, I think, breaks down. I wonder if it makes sense to blame our culture of extreme modularization here, rather than LP. Somewhere out there is a parallel universe where codebases are divided up into mostly linear chapters. The build system builds a hierarchical module tree out of it (in combination with compiler caches to speed up incremental compilation), but nobody actually looks at it. > Given the fact that so many of my co-workers seem unwilling to create simple readme.md files that talk about how to build and run code, I think it would be a lot to ask for them to provide a guide to reading the code. Well, there goes my idea :) Yeah, totally valid point. LP is perhaps more useful for those of us interested in practicing code exposition (with lots of secondary benefits) rather than as something for a whole org to buy into.
- dhosek 6y agoI was talking to a therapist recently about the team-oriented organization of software development and he found it incredible that things are organized that way rather than by individual work. Certainly, in the early part of my career, I worked much more autonomously. While tools like version control allow for greater collaborative effort, I'm not entirely convinced this is a good thing.