Don't Use Member Prefixes

From Basef
Revision as of 12:17, 27 January 2020 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You also don’t need to prefix member variables with m_ anymore. Your classes and functions should be small enough that you don’t need them. And you should be using an editing environment that highlights or colorizes members to make them distinct.

No:

public class Part {
    private String m_dsc; // The textual description
    void setName(String name) {
        m_dsc = name;
    }
}

Ok:

public class Part {
    String description;
    void setDescription(String description) {
        this.description = description;
    }
}

Source: Clean Code