Abbreviation and Hungarian (ARCH6011)
Ce contenu n’est pas encore disponible dans votre langue.
Key ruby.naming.no-hungarian-notation · Severity info · Category naming
Adding type prefixes such as strName, iCount, b_flag (Hungarian notation) and cryptic abbreviations adds noise. Ruby is dynamically typed, so these prefixes are meaningless and hurt readability.
Incorrect
Section titled “Incorrect”strName = user.nameiCount = orders.sizeb_active = account.active?Correct
Section titled “Correct”name = user.nameorder_count = orders.sizeactive = account.active?Drop the type prefix and cryptic abbreviation; rename the identifier to a clear, intent-revealing snake_case name.