Update Naming Guidelines authored by Brennan Mulligan's avatar Brennan Mulligan
......@@ -4,24 +4,27 @@ Great styling and naming schemes for classes, variables, objects, and methods is
When the same thing is used in multiple places such as variables, methods, objects, use the same name. This helps readability between classes as you are clearly talking about a specific thing that is used there and nowhere else.
## Variable Guidelines
**Variables** must follow camelCase (including IDs). Examples: freshmenFunTimes, teacherId.
**Variables** must follow camelCase (including Ids, capital I, lowercase d). Examples: freshmenFunTimes, teacherId.
Variables should **match** what they are in the database and in other classes if its the exact same thing.
This is especially important when covering JSON encoding between the Front End and the Back End. The ObjectMapper packs the object into JSON by using specific names of variables. Keep their names the exact same so that it is easy to know which is which when switching between the two.
If **multiple similar variables** use similar names, maintain a consistent style. For example, do not create playerHat and shirtPlayer, stick to the same style like playerHat and playerShirt.
## Method Guidelines
This also goes for **methods** and **classes**. Multiple similar objects, like DTOs, should have the consistently styled names, like PlayerDTO and QuestDTO.
This also goes for **methods** and **classes**.
Keep **method names** brief, but descriptive. They should be easy to use, specific to what it is doing, and easy to quickly understand by those who use it.
Always use "get" in methods, not "receive". For example, use getObject, not receiveObject.
## Class Guidelines
**Singleton** classes will have a singleton variable, not an instance. (This means that the method for getting the singleton is getSingleton, not getInstance.)
**Name classes** off of what they specifically do, not off of a single method inside of it.
In **GameServer**, **Class names** should be CamelCase with the first letter being capitalized.
Multiple similar objects, like DTOs, should have the consistently styled names, like PlayerDTO and QuestDTO.
In **GameServer** (The Back End, Java), **Class names** should be CamelCase with the first letter being capitalized.
In **GameManager**, **Class names** should be snake_case.
\ No newline at end of file
In **GameManager** (The Front End, DART), **Class names** should be snake_case.
\ No newline at end of file