Difference between revisions of "Naming convention"
From DarkWiki
(→Getters and setters) |
(→Getters and setters) |
||
| Line 4: | Line 4: | ||
* Getters (get, is) | * Getters (get, is) | ||
| + | ** Takes no parameters | ||
** Does not alter the object in any way; it is constant | ** Does not alter the object in any way; it is constant | ||
** Can be called multiple times, and in any order | ** Can be called multiple times, and in any order | ||
| − | ** Returns a consistent result | + | ** Returns a consistent single result |
* Setters (set) | * Setters (set) | ||
| + | ** Takes one parameter | ||
** May or may not alter the object | ** May or may not alter the object | ||
** Only affects the object that has the setter; it does not persist anywhere else | ** Only affects the object that has the setter; it does not persist anywhere else | ||
** Can be called multiple times, and in any order | ** Can be called multiple times, and in any order | ||
Revision as of 08:50, 29 March 2019
Java naming convention
Getters and setters
- Getters (get, is)
- Takes no parameters
- Does not alter the object in any way; it is constant
- Can be called multiple times, and in any order
- Returns a consistent single result
- Setters (set)
- Takes one parameter
- May or may not alter the object
- Only affects the object that has the setter; it does not persist anywhere else
- Can be called multiple times, and in any order