Improve final Objects handling #13

Open
opened 2023-01-16 02:16:36 +01:00 by bea · 2 comments
Owner

Currently, final constants mostly use camel-case for naming, which is wrong.

final static int maxPlayers = 10;

They should instead be all uppercase with underscores as separators.

final static int MAX_PLAYERS = 10;

Additionally, we often have methods returning final constants. Following Java best practices, final constants should be public and directly accessible, if that's their scope - not requiring a useless method call that isn't doing any logic (and is ambiguous).

Currently, `final` constants mostly use camel-case for naming, which is wrong. ```java final static int maxPlayers = 10; ``` They should instead be all uppercase with underscores as separators. ```java final static int MAX_PLAYERS = 10; ``` Additionally, we often have methods returning final constants. Following Java best practices, final constants should be public and directly accessible, if that's their scope - not requiring a useless method call that isn't doing any logic (and is ambiguous).
bea added the
enhancement
label 2023-01-16 02:16:36 +01:00
bea changed title from Fix final variables treatment to Improve final Objects handling 2023-01-16 02:17:13 +01:00
Author
Owner

Keep in mind that not all final constants are required to be uppercase. Non-static fields and local variables are often left in camel case.

See: [Link 1] [Link 2].

Keep in mind that not all final constants are required to be uppercase. Non-static fields and local variables are often left in camel case. See: [[Link 1]](https://softwareengineering.stackexchange.com/questions/252243/naming-convention-final-fields-not-static) [[Link 2]](https://stackoverflow.com/questions/46407151/naming-convention-for-java-final-variable-which-is-not-static).
Author
Owner

This was partially addressed in 94037b252f. More checks are due.

This was partially addressed in 94037b252f. More checks are due.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: bea/HidekoBot#13
No description provided.