コーディング規約 (Coding Standard)

名前

反義語の組み合わせ

変数名
名前1 名前2
begin end
first last
locked unlocked
min max
next previous
old new
opend closed
visible invisible
source target
source destination
up down
ルーチン名
名前1 名前2
add remove
begin end
create destroy
first last
get put
get set
increment decrement
insert delete
lock unlock
min max
next previous
old new
open close
show hide
source target
start stop
up down

大文字と小文字のスタイル (キャメルケース / Camel case)

形式 特徴 記述例
キャメルケース (CamelCase) / Lower Camel Case 最初の文字は小文字にし、各単語の最初の文字を大文字にします。 backColor
パスカルケース (PascalCase) / Upper Camel Case 最初の文字と各単語の最初の文字を大文字にします。 BackColor
CamelCase - Wikipedia

接頭辞 (prefix)

MicrosoftはWin32のコードにおいて、次の接頭辞を用いています。

Prefix Description
a Array
b BOOL (int)
c Char
cb Count of bytes
cr Color reference value
cx Count of x (short)
dw DWORD (unsigned long)
f Flags (usually multiple bit values)
fn Function
g_ Global
h Handle
i Integer
l Long
lp Long pointer
m_ Data member of a class
n Short int
p Pointer
s String
sz Zero terminated String
tm Text metric
u Unsigned int
ul Unsigned long (ULONG)
w WORD (unsigned short)
x,y x, y coordinates (short)
Coding Style Conventions - Windows applications | Microsoft Learn

レイアウト

「視覚的に優れたレイアウトは、プログラムの論理構造を明らかにする」

参考

資料

参考書

複数の技術系サイトから、まとめて検索