Discussion between John Ousterhout and Robert Martin ("Uncle Bob"" on "A Philosophy of Software Design" and "Clean Code"
Discussion between John Ousterhout and Robert Martin ("Uncle Bob") on "A Philosophy of Software Design" and "Clean Code" - feddit.org
This is a discussion between Ousterhout and Martin, who advocated in “Clean Code” to omit comments and split code in extremely small functions. Ousterhout takes that to town by asking Martin to explain an algorithm which Martin presented in his book on “Clean Code”, and algorithm that generates a list of prime numbers. It turns out that Martin essentially does not understand his own code because of the way it is written - and even introduces a performance regression! It gets even more hilarious when one considers where Martin has taken from the algorithm, and who designed it originally: Martin took it from a 1972 publication of Donald E. Knuths seminal article on Literate Programming: http://www.literateprogramming.com/knuthweb.pdf [http://www.literateprogramming.com/knuthweb.pdf] In this article, Knuth explains that the source code of a program should be ideally understood as a by-product of an explanation which is directed at humans, explaining reasoning, design, invariants and so on. He presents a system which can extract and assemble program source code from such a text. Even more interesting, the algorithm was not invented by Knuth himself. It was published in 1970 by Edsger Dijkstra in his “Notes on Structured Programming” [https://repositories.lib.utexas.edu/items/e7a89f42-dbf6-4929-802d-c75d1cbac378/full] (with a second edition [https://www.informatik.uni-bremen.de/agbkb/lehre/programmiersprachen/artikel/EWD-notes-structured.pdf] in 1972). In this truly fascinating and timeless text, Disjkstra writes on software design by program decomposition, proving properties of program modules by analysis, using invariants to compose larger programs from smaller algorithms and design new data types, and so on. Also, how this makes software maintainable. In this, he uses the prime number generation algorithm as an extended example. He sresses multiple times that both architecture and invariants need to be documented on their on, to make the code understandable. So, Robert Martin is proven wrong here. He does not even understand, and could not properly maintain, the code from his own book. Nor did he understand that his code is hard to understand for others.