Summary
Some method names in the codebase don’t follow a consistent naming convention. In many cases, we use names like GetUser(), when a simpler and clearer User() would be more appropriate.
To improve readability and maintainability, methods that return a resource should drop the Get or Set prefix unless it adds necessary clarity. Instead, use the format Resource().
This does not apply to:
- API or repository-related methods
- Methods named exactly
Get()
- Methods like
GetBy<Resource>(), GetAllBy<Resource>(), or similar
Valid renames:
GetDefault() → Default()
GetValidator() → Validator()
GetTaskInfo() → TaskInfo()
GetWriteSession() -> WriteSession()
SetWriteSession() -> `
- ...
Do not rename the following patterns (commonly found in the repository directory):
These methods are "API or repository-related methods"
GetByCreator()
GetByResource()
GetByUser()
GetAllForIssue()
- ...
Review the codebase for methods that can be simplified according to this convention, and update them where appropriate.
Example Use-cases
As someone who maintains the code, I want to have a pleasant feeling looking at it.
Drawbacks
NA
Summary
Some method names in the codebase don’t follow a consistent naming convention. In many cases, we use names like
GetUser(), when a simpler and clearerUser()would be more appropriate.To improve readability and maintainability, methods that return a resource should drop the
GetorSetprefix unless it adds necessary clarity. Instead, use the formatResource().This does not apply to:
Get()GetBy<Resource>(),GetAllBy<Resource>(), or similarValid renames:
GetDefault()→Default()GetValidator()→Validator()GetTaskInfo()→TaskInfo()GetWriteSession()->WriteSession()SetWriteSession()-> `Do not rename the following patterns (commonly found in the
repositorydirectory):These methods are "API or repository-related methods"
GetByCreator()GetByResource()GetByUser()GetAllForIssue()Review the codebase for methods that can be simplified according to this convention, and update them where appropriate.
Example Use-cases
As someone who maintains the code, I want to have a pleasant feeling looking at it.
Drawbacks
NA