1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

使用する単語の統一

使われている単語が異なる場合、読み手は異なる処理が行われることを考慮してコードを読む必要がある。
このような混乱を防ぐためにも、同じ意味合いの単語は統一する。

類似語例

  • start、begin
  • stop、end
  • modify、update、change
  • create、new、factory
  • find、search
  • done、finish、complete
  • deliver、dispatch、send
  • select、choose
  • show、display

対比語を正確に使用する

反対の意味を持つ値の命名を、数字やその他適当なワードで埋めてしまうことがある。
正しく対比の単語が命名されていれば、処理内容の理解がぐっと向上する。

対比語例

  • first <-> last
  • next <-> previous
  • create <-> delete
  • source <-> destination
  • add <-> remove
  • show <-> hide
  • min <-> max
  • public <-> private
  • success <-> failure

参考文献

プログラミング中級者になりたい人のためのクリーンコード入門

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?