Method, parameter, and variable names should clearly describe their purpose and behavior, making code self-documenting. Choose names that indicate exactly what the code does and how it behaves with different inputs.
For methods:
setTileCacheEnabled(bool)
over enableTileCache(bool)
when a method can both enable and disable functionalityremoveDrawablesIf
rather than observeDrawablesRemove
to clearly communicate intentFor parameters:
center
coordinate instead of shouldCenter: YES
)CoordinateBounds
instead of LatLngBounds
in iOS)For constants and variables:
// Instead of this:
if (fo == 0.0) {
return {
.position = float4(-2.0, -2.0, -2.0, 1.0),
// Prefer this:
const float4 CULLED_POSITION = float4(-2.0, -2.0, -2.0, 1.0);
if (fo == 0.0) {
return {
.position = CULLED_POSITION,
Clear, descriptive naming reduces the need for comments and documentation while making code more maintainable and understandable for all developers.
Enter the URL of a public GitHub repository