7 ms·
Counterpoint[0]: Knuth really is a fan of writing monolithic (rather than "modular") programs from scratch, in a way that goes against all the experience of so
by svat 7y ago
Counterpoint[0]:
Knuth really is a fan of writing monolithic (rather than "modular") programs from scratch, in a way that goes against all the experience of software engineering accumulated over decades, so that criticism is well-deserved.
For example, his big programs TeX (1982) and METAFONT (1984) are each book-length and the source code of each is in a single large file amounting to about 20000+ lines of Pascal code. His programs do not contain much in the way of standard software-engineering practices like abstraction, modules (hiding implementation behind an interface), unit tests, libraries, etc. In fact, he has spoken out against unit tests and code reuse! [1]
> the idea of immediate compilation and "unit tests" appeals to me only rarely, when I’m feeling my way in a totally unknown environment and need feedback about what works and what doesn’t. Otherwise, lots of time is wasted on activities that I simply never need to perform or even think about. Nothing needs to be "mocked up." ...
> With the caveat that there’s no reason anybody should care about the opinions of a computer scientist/mathematician like me regarding software development, [...] I also must confess to a strong bias against the fashion for reusable code. To me, "re-editable code" is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace.
Moreover, his sympathies always lay with the "other" side of the "structured programming" revolution (he still liberally uses GOTOs, etc -- still coding like a 1950s/1960s machine code programmer), and in his 1974 paper "Structured Programming With Go To Statements", he approvingly quotes something that might horrify many software engineers today:
> In this regard I would like to quote some observations made recently by Pierre-Arnoul de Marneffe:
> In civil engineering design, it is presently a mandatory concept known as the "Shanley Design Criterion" to collect several functions into one part . . . If you make a cross-section of, for instance, the German V-2, you find external skin, structural rods, tank wall, etc. If you cut across the Saturn-B moon rocket, you find only an external skin which is at the same time a structural component and the tank wall. Rocketry engineers have used the "Shanley Principle" thoroughly when they use the fuel pressure inside the tank to improve the rigidity of the external skin! . . . People can argue that structured programs, even if they work correctly, will look like laboratory prototypes where you can discern all the individual components, but which are not daily usable. Building "integrated" products is an engineering principle as valuable as structuring the design process.
> ... Engineering has two phases, structuring and integration: we ought not to forget either one...
(This comment is slightly tongue-in-cheek, but hopefully provocative enough.)
[0]: Hey it's been a couple of hours and there's no reply attacking my comment, guess I better do it myself. :-)
[1]: http://www.informit.com/articles/article.aspx?p=1193856 http://www.informit.com/articles/article.aspx?p=1193856
- jeffdavis 7y ago"... you find only an external skin which is at the same time a structural component and the tank wall ... Engineering has two phases, structuring and integration: we ought not to forget either one..." That could be interpreted in non-horrifying ways. Sure, the cost of a function call (especially with a modern compiler that can intelligently inline) is negligible in most cases compared with the engineering benefits it offers. But what about cases where it's less clear? In databases, there are constantly cycles between: Cycle phase 0: Abstract Storage: separate storage from computation to make the database system easier to test, replace, and reconfigure. Cycle phase 1: Push computation down to storage: wow, look how much better performance we can get if we intermingle storage and computation! GOTO cycle phase 0.
- GuB-42 7y agoThat's extremism, but I think we need people like that. Nowadays, it seems that we forgot how to write monolithic programs from scratch. I think we went too far with code reuse. See the LeftPad npm fiasco. Knowing that the one who is possibly the most respected person in the field of computer science has an opinion that goes against the current trends gives us perspective. In the same way, I don't fully agree with Richard Stallman's activism and Linus Torvald's famous rants, but I'm glad there are people like that to shake things up.
- Blaisorblade0 7y agoKnuth also uses assembly in his book on algorithms. But generally, algorithms researchers seem to not care about abstractions, as witnessed by TeX and LaTeX in multiple ways. That's probably because when you really need to invent a fancy algorithm (which is their job), that will often not be built out of reusable components.
- rumanator 7y ago> Knowing that the one who is possibly the most respected person in the field of computer science has an opinion that goes against the current trends gives us perspective. Computer science is not software engineering. You also don't get physicists and mathematicians determine engineering best practices for precisely the same reason. For example, the reference to Shanley's design principle is not only wrong in it's core (aerospace engineering instead of civil engineering) it also completely misses the underlying design requirements and constraints. More precisely, aerospace pays a premium for weight, thus design requirements emphasize the need to optimize structural systems wrt structural weight. This design choice favours operational economy at the expense of production costs, maintainability, robustness, and simplifying analysis. None of this applies to software development, or even civil engineering structures. Appeals to authority are a dangerous fallacy.