Skip to Content
ルールズ・オブ・プログラミング ―より良いコードを書くための21のルール
book

ルールズ・オブ・プログラミング ―より良いコードを書くための21のルール

by Chris Zimmerman, 久富木 隆一
August 2023
Intermediate to advanced
452 pages
5h 11m
Japanese
O'Reilly Japan, Inc.
Content preview from ルールズ・オブ・プログラミング ―より良いコードを書くための21のルール

ルール3優れた名前こそ最高のドキュメントである

 至極当たり前のことだが、シェイクスピアを引用せずして、プログラミングについて書くことなどできようか。今となっては、言い古された耳タコ的な話だ。だがしかし、ここであえて『ロミオとジュリエット』をさくっとおさらいしておきたい。ロミオとジュリエットは不運な星のせいで行き違いとなった110代の若者たちで、互いに愛し合っているものの、両家の間にある怨恨に阻まれ、幸福な人生を添い遂げることができない。この物語は、関係者全員にとって残念な結末に終わる。

1 訳注:原文は、『ロミオとジュリエット』のプロローグに出てくるstar-crossedという表現を使っている。

 第2幕第2場。ジュリエットは、劇中で5番目に有名な引用で、そういう状況を嘆くのだ。

名前に、どんな意味があるというの? わたしたちが薔薇と呼ぶもの、

それは他のどんな名前で呼ばれたって、変わらず甘く香るものだというのに。

 コードに関しても、似たような主張を耳にしたことがある。それは決まって、物事の名前の付け方について、ぼくが重箱の隅をつつくようにコードレビューする態度にいらだった、同僚からの声。変数名、関数名、メンバー名、ソースファイル名、クラス名、構造体名……どれもこれも難癖をつけやがる、らしい。

 頭がイカれた相手を軽蔑するようにたいていは白目をむき、連中は主張する。「名前が重要なんじゃない、重要なのは名前が付いている物の方だ。変数(または関数、クラス、などなど)の本当の意味は、コードを実際に見ることでしか決定できない。変数の真の意味とは、変数が表現する物だ。つまり、その変数がどのように設定され、どのように使われるかであって、その名前が何であるかってことじゃない。名前が変わっても、機能は変わりゃしない」 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

リーンエンタープライズ ―イノベーションを実現する創発的な組織づくり

リーンエンタープライズ ―イノベーションを実現する創発的な組織づくり

Jez Humble, Joanne Molesky, Barry O'Reilly, 角 征典, 笹井 崇司, Eric Ries
行動を変えるデザイン ―心理学と行動経済学をプロダクトデザインに活用する

行動を変えるデザイン ―心理学と行動経済学をプロダクトデザインに活用する

Stephen Wendel, 武山 政直, 相島 雅樹, 反中 望, 松村 草也

Publisher Resources

ISBN: 9784814400416Other