27 lines
604 B
Plaintext
27 lines
604 B
Plaintext
== Why is this an issue?
|
|
|
|
The name of a method should communicate what it does, and the names of its parameters should indicate how they're used. If a method and its parameter have the same name it is an indication that one of these rules of thumb has been broken, if not both. Even if by some trick of language that's not the case, it is still likely to confuse callers and maintainers.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
public void Login(string login) // Noncompliant
|
|
{
|
|
//...
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
public void Login(string userName)
|
|
{
|
|
//...
|
|
}
|
|
----
|
|
|