Choose names that clearly communicate purpose, intent, and functionality rather than generic or abbreviated alternatives. Names should follow Rust conventions (snake_case for variables, functions, modules) and accurately describe what they represent or do.
Choose names that clearly communicate purpose, intent, and functionality rather than generic or abbreviated alternatives. Names should follow Rust conventions (snake_case for variables, functions, modules) and accurately describe what they represent or do.
Key principles:
cw20_impl
instead of cw20_base
GetStatusCommitment
instead of GetCommittedStatus
when returning a hash commitmentconsensus_state_bytes
not consensusStateBytes
Address
and B256
instead of generic &[u8]
SharedMap
without contextExample:
// Poor naming
pub fn new_beacon_light_client_update() -> BeaconUpdate { ... }
pub const UNION_IBC: &str = "union:union-ibc";
struct MsgCreateClient {
bytes consensusStateBytes; // camelCase, unclear
}
// Better naming
pub fn into_beacon_light_client_update() -> BeaconUpdate { ... }
pub const UNION_IBC: &str = "union:ibc-union";
struct MsgCreateClient {
bytes consensus_state_bytes; // snake_case, clear
}
Names are the primary way developers understand code intent - invest in clarity over brevity.
Enter the URL of a public GitHub repository