Panu Viljamaa wrote:

> Marc Gluch wrote:
>
> > ...
> > I'm all for intention revealing selectors (and more generally,
> > intention revealing names), but you left out a discussion
> > of tradeoffs in naming parameters after their types
> > vs their roles in the method.
>
> An excerpt  from  http://members.fcc.net/panu/SRNC-ST.htm   discusses this:
>
>
>
>  As I argue in the excerpt, C is better because then the semantics is visible *at the places where the method is called*. Consider that your method is called from 100 places. With alternative A) you would have 100 places in your program/library where to the reader of the program it is not immediately clear about what type of an argument is expected by the method. Should it be an instance of Person or an instance of String ?
>
> Wouldn't  this be obvious  from the calling context ? Not necessarily because the actual argument that is passed may be an argument of the calling method - confusingly named - or some value derived from it through elaborate processing via local variables, manipulated within loops and multiple levels of conditionals..
>
> With alternative B) there is no confusion either in the method-header, or in the calling places. Even though you may think that " registerPerson: nameString  " looks nicer as a method-definition, don't forget that what is more importantactually is how the places where the method is called from look - because there are more of them.
>
> This comes down to what I call "Principle of Ethical Software Design". If you were a library vendor that creates classes and methods you never use yourself, you might prefer alternative A). It "looks nicer". It might  attract more users to your class library because of that. So you 'sell' more of your library then (selfishly!). However, if you're 'ethical', you take some time to think about your fellow programmer who actually needs to create working software with your methods. You then realize that what really matters is not the clarity of *your* method-headers, but the clarity of *their* software created by using your headers. Thus you'd prefer alternative B, ethically.
>
> -Panu Viljamaa