Don't Use Member Prefixes

De Basef
Revisão de 11h17min de 27 de janeiro de 2020 por Admin (discussão | contribs)

(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para: navegação, pesquisa

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