Am I immoral for using a variable name that differs from its type only by case?

前端 未结 8 1018
醉梦人生
醉梦人生 2021-02-11 11:43

For instance, take this piece of code:

var person = new Person();

or for you Pythonistas:

person = Person()

I

8条回答
  •  青春惊慌失措
    2021-02-11 12:12

    If the Person is a general Person in the context, then "person" is a really good name. Of course if the Person has a specific role in the code then it's better to name her using the role.

提交回复
热议问题