Nothing is as Simple as it Seems(何事も見た目ほど簡単ではない)

add to hatena hatena.comment (0) add to del.icio.us (0) add to livedoor.clip (0) add to Yahoo!Bookmark (0) Total: 0

 私は、よく職場で「言うのは簡単なんだけど、○○って機能は追加できるかな?」というような発言をします。

 プログラムを自分で書くようになると、何事も見た目ほど簡単ではないという事を理解するようになります。Joel on Softwareには、これについて面白い記事があります。

 Something as simple as copying a file is full of perils. What if the first argument is a directory? What if the second argument is a file? What if a file with the same name already exists in the destination? What if you don’t have write permission?

 What if the copy fails in the middle? What if the destination is on a remote machine which is available, but which requires authentication to continue? What if the files are large and the link is slow and you need to show a progress indicator? What if the transfer speed slows down to almost zero… when do you give up and return an error message?

 ファイルのコピーのような単純なことでさえ多くの危険に満ちている。もし最初の引数(コピー元)がディレクトリだったら?2番目の引数(コピー先)がファイルだったら?コピー先に同じ名前のファイルがすでにある場合は?もし書き込み権限がない場合は?

 コピーが途中で失敗した場合は?コピー先が別のマシンにあり、使用可能ではあるが認証が必要な場合は?ファイルが大きく回線が遅いためプログレスバーを表示しなければならない場合は?転送速度がほとんど0に落ちたら・・・どの時点でコピーを断念してエラーメッセージを出したらいい?

   > Joel on Software(Nothing is as Simple as it Seems)より 和訳本はこちら

 このように、何事も見た目ほど簡単ではない(特に自由度が上がるほど、複雑になる)という事が分ります。それ自体が職業として成り立っている場合は特にです。

コメントする

名前:

メールアドレス:

Website:

Comment: