Update Naming Guidelines authored by Brennan Mulligan's avatar Brennan Mulligan
......@@ -8,22 +8,23 @@ When the same thing is used in multiple places such as variables, methods, objec
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.
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**.
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.
If a method is returning a boolean, pose it as a question that makes logical sense. For example, our quests have an easterEgg boolean, so it's getter is isEasterEgg. That way when you are putting it into something like an if statement, it will be if(isEasterEgg) to test for true.
## Class Guidelines
**Name classes** off of what they specifically do, not off of a single method inside of it.
Multiple similar objects, like DTOs, should have the consistently styled names, like PlayerDTO and QuestDTO.
**Singleton** classes will have a singleton variable, not an instance. (This means that the method for getting the singleton is getSingleton, not getInstance.)
In **GameServer** (The Back End, Java), **Class names** should be CamelCase with the first letter being capitalized.
......
......