Mudanças entre as edições de "Don't Use Member Prefixes"

De Basef
Ir para: navegação, pesquisa
(Criou página com '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 edit...')
(Sem diferença)

Edição das 12h17min de 27 de janeiro de 2020

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