英語で読む「達人プログラマ#6」

ようやく6章。「While You Are Coding」という前の章からは少し柔らかそうなタイトルで、かつユニットテストやリファクタリングなど、様々なプログラミング環境に根付くエッセンスが詰まっている。

The soldier's initial probes for mines revealed nothing, but this was merely lucky. He was led to a false conclusion—with disastrous results. As developers, we also work in minefields. There are hundreds of traps just waiting to catch us each day. Remembering the soldier's tale, we should be wary of drawing false conclusions. We should avoid programming by coincidence—relying on luck and accidental successes—in favor of programming deliberately.

プログラマを「地雷を探す兵士」という物騒な例えをしているが、programming by coincidence、つまり「偶然うまくいってる」という状況を避けなければいけない。ではどうするかという具体例は、様々な章に飛んでいる。

There's nothing magic about Perl itself in this regard. Perl makes it easier to collate and analyze test results to ensure compliance, but the big advantage is simply that it's a standard -- tests go in a particular place, and have a certain expected output. Testing is more cultural than technical;

Perlコミュニティはユニットテストとレグレッションテストに強いコミットメントがあるが、別にPerlが特別というわけではなく「テストは技術というより文化」だと紹介している。

But using a wizard designed by a guru does not automatically make Joe developer equally expert. Joe can feel pretty good—he's just produced a mass of code and a pretty spiffy-looking program. He just adds in the specific application functionality and it's ready to ship.

Evil Wizardという節ではVisual C++などに実装されたウイザード機能でコードを生成することを批判している。この本を読んでて、Railsの作者が影響を受けたであろうと感じるが、Railsのscaffoldはこの章から、どういう影響を受けたのだろう。ちなみにJoeって誰かと思ったら「典型的な米国人男性」ということらしい。

ちょっと新鮮味がなかったが、それだけ現代のプログラミングに馴染んでいるということだろう。

残すところ2章。年内に読了できそうだな。


この記事が気に入ったらサポートをしてみませんか?