An interesting question.
I agree with @Aganju that it is overkill.
The ()
's alone mean something like "with" or "by" or "in the context of" these arguments, so no need for that in the text of the identifier that names the function.
In many languages, if you use the identifier getColor
without the ()
's then that refers to the function or method itself rather than an invocation of it; for example, if you want to pass the function itself as a parameter somewhere for someone else to use. I suppose that formally the ()
's means "apply" the arguments to that function. This is seen sometimes in functional programming oriented languages, and also JavaScript, for example, has bind
, and apply
.
If you use OOP, then we might see: player.getColor()
which makes it read somewhat clear that getColor
is being done by player
(possibly in the context of ("with") other arguments, if it takes them).
Further, the notion of adding a preposition probably does not scale well for more parameters.
Some, but not all, languages offer naming actual arguments at the call site (by the formal parameter name) so you can do getColor(for:=player)
, and, with that you'd get to provide descriptive names (that could be prepositions or more) for multiple parameters.
getColor(for player: Player)
and call likeboard.getColor(for: redPlayer)