http://api.unrealengine.com/KOR/Programming/Development/CodingStandard/index.html


μœ„μͺ½ 링크 ν•œ 번 μ­‰ μ •λ…ν•˜λ©΄ μ’‹λ‹€.

가독성에 정말 λ„μ›€λ˜λŠ” 팁 λͺ‡ κ°€μ§€λ§Œ 정리해봄.

// λ‚˜λΉ μš”: // Leaves 증가 ++Leaves; // μ’‹μ•„μš”: // 찻잎이 더 μžˆλ‹€λŠ” 것을 μ•Œμ•˜μŠ΅λ‹ˆλ‹€. ++Leaves;

자체적으둜 μ„€λͺ…이 λ˜λŠ” μ½”λ“œλ₯Ό μž‘μ„±ν•˜μ„Έμš”:

// λ‚˜λΉ μš”: t = s + l - b; // μ’‹μ•„μš”: TotalLeaves = SmallLeaves + LargeLeaves - SmallAndLargeLeaves;

λ‚˜μœ μ½”λ“œμ— μ½”λ©˜νŠΈλ₯Ό 달지 λ§ˆμ„Έμš” - κ·Έλƒ₯ λ‹€μ‹œ μž‘μ„±ν•˜μ„Έμš”:

// λ‚˜λΉ μš”: // 잎의 총 κ°―μˆ˜λŠ” // μž‘μ€ 잎과 큰 μžŽμ„ λ”ν•œ κ²ƒμ—μ„œ // λ‘˜ 닀인 것을 λΊ€ κ²ƒμž…λ‹ˆλ‹€. t = s + l - b; // μ’‹μ•„μš”: TotalLeaves = SmallLeaves + LargeLeaves - SmallAndLargeLeaves;


λ³΅μž‘ν•œ ν‘œν˜„μ‹μ€ 쀑간 λ³€μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ λ‹¨μˆœν™”μ‹œν‚€μ„Έμš”.Β λ³΅μž‘ν•œ ν‘œν˜„μ‹μ„, λΆ€λͺ¨ ν‘œν˜„μ‹ λ‚΄μ—μ„œ κ·Έ μ˜λ―Έκ°€ 잘 μ„€λͺ…λ˜λ„λ‘ 이름지은 μž‘μ€ ν‘œν˜„μ‹λ“€μ„ κ°€μ§„ 쀑간 λ³€μˆ˜μ— ν• λ‹Ήλœ ν•˜μœ„ ν‘œν˜„μ‹μœΌλ‘œ λ‚˜λˆŒ 수 μžˆλ‹€λ©΄, μ΄ν•΄ν•˜κΈ°κ°€ μˆ˜μ›”ν•΄μ§ˆ κ²ƒμž…λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄:

if ((Blah->BlahP->WindowExists->Etc && Stuff) && !(bPlayerExists && bGameStarted && bPlayerStillHasPawn && IsTuesday()))) { DoSomething(); }

이런 μ½”λ“œλŠ” λ‹€μŒμœΌλ‘œ κ°ˆμŒν•©λ‹ˆλ‹€:

const bool bIsLegalWindow = Blah->BlahP->WindowExists->Etc && Stuff; const bool bIsPlayerDead = bPlayerExists && bGameStarted && bPlayerStillHasPawn && IsTuesday(); if (bIsLegalWindow && !bIsPlayerDead) { DoSomething(); }

값을 λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜λŠ” λ°˜ν™˜κ°’μ— λŒ€ν•œ μ„€λͺ…을 ν•΄μ•Ό ν•©λ‹ˆλ‹€. 이름을 톡해 ν•¨μˆ˜κ°€ λ°˜ν™˜ν•˜κ²Œ 될 값을 λͺ…ν™•νžˆ μ•Œ 수 μžˆμ–΄μ•Ό ν•˜μ§€μš”. μ΄λŠ” λΆ€μšΈ ν•¨μˆ˜μ˜ 경우 νŠΉνžˆλ‚˜ μ€‘μš”ν•©λ‹ˆλ‹€. λ‹€μŒ 두 예제 λ©”μ„œλ“œλ₯Ό μ‚΄νŽ΄ λ΄…μ‹œλ‹€:

bool CheckTea(FTea Tea) {...} // true λ©΄ λ­λΌλŠ” κ±ΈκΉŒμš”? bool IsTeaFresh(FTea Tea) {...} // true λ©΄ μ°¨κ°€ μ‹ μ„ ν•˜λ‹€λŠ” 것이 λͺ…ν™•ν•΄μ§‘λ‹ˆλ‹€.
λ³€μˆ˜, λ©”μ„œλ“œ, 클래슀 이름은 λͺ…ν™•ν•˜κ³  μ• λ§€ν•˜μ§€ μ•ŠμœΌλ©° μ„œμˆ μ μ΄μ—¬μ•Ό ν•©λ‹ˆλ‹€. μ΄λ¦„μ˜ λ²”μœ„κ°€ 클 수둝, μ„œμˆ μ μΈ 쒋은 μ΄λ¦„μ˜ μ€‘μš”μ„± μ—­μ‹œ μ»€μ§‘λ‹ˆλ‹€. κ³Όλ„ν•œ 좕약은 ν”Όν•˜μ‹œκΈ° λ°”λžλ‹ˆλ‹€.
예제 float TeaWeight; int32 TeaCount; bool bDoesTeaStink; FName TeaName; FString TeaFriendlyName; UClass* TeaClass; USoundCue* TeaSound; UTexture* TeaTexture;



μ΄κ²ƒλ§Œ μ§€μΌœλ„ 과거의 μžμ‹ κ³Ό μ‹ΈμšΈ 일이 80%λŠ” 쀄어듦.