Conventions

Overview

We spend much, much more time reading code than writing code. Conventions are there to improve software readability and allow developers to understand code faster and better.

Breaking with convention is allowed if it’s intentional. You must have a good reason to do so.

Naming

  • Names must clearly describe the object

  • Use PascalCase for all names

  • Don’t use Hungarian notation (like intNumber)

  • Don’t use abbreviations except if they are well-known

Applies To
Convention
Example

Service

[Noun]Service

TimerService

Type

[Noun]

Car

Type property

[Noun]

Brand

Boolean type property

Is/Has[State]

IsFast

Function

[Verb][Noun]

GetCar

Function parameter

[Noun]

Colour

Setting

[Noun]

Key

Variable

[Noun]

Car

IfElse function

Name the IfElse function If[Description] and the conditions [Verb][Noun], where the Verb reflects the boolean nature of the condition – words like Is, IsNot, Has, and Contains. Examples are

  • Function: IfWeather, Conditions: IsCold, IsWarm, IsRainy, IsDryAndWindy

  • Function: IfText. Conditions: ContainsLetters, ContainsNumbers, HasLessThanThreeCharacters