Programmer's Note



ブログ記事:読書:ソフトウェア作法 - Programmer's Dialy で「ソフトウェア作法」について書いたが、原書を買った。
やっぱ直接Kernignhan & Plaugerの言葉を読みたい。Amazonでさくっと買えちゃうなんていい時代。(一方、読んでみると日本訳も実に丁寧だというのが分かった。)

Software Tools

Software Tools


It may seem silly to write a five-line function to be called only once, but the purpose of settab is to conceal a data representation from a routine that does not have to know it.
it is vital to break larger program into small pieces that communicate only though well-defined interfaces. The less one part of a program knows about how another part operates, the more easily each may be changed.

うん、"communicate only through well-defined interfaces"がキーですね。
そして、well-defined interfaceを設計するのって一番難しいとこだ。

By writing a program in a straightforward manner, you get it working correctly and minimize the change of confusion. You can then measure how it performs to decide whether it works well enough and, if not, where to concentrate your attention.
Sacrifice clarity for speed only when you know that you are solving the correct problem correctly and when you know that the sacrifice is worthwhile.

この本が書かれた1976年はちょうどUNIX V6の時期。本書の冒頭にプログラムの動作確認にIBM 370, Honeywell 6070, PDP-11を使ったとある。

But our primary tool for writing good program is to strive to make them readable. In our experience, readability is the single best criterion of program quality: If a program is easy to read, it is probably a good program; if it is hard to read, it probably isn't good.

リーダビリティ"readability"の重要性を、the single best criterionて本当に強く主張している感じですね。