Java Coding Style – Benefits of Prefixing Function Parameter Names with p*

auto-completioncoding-styleeclipsejavanaming

I often see projects (in Java projects and teams using Eclipse) that prefix function parameters with p.

For example

public void filter (Result pResult) ...

I personally don't see any benefit in this, but would like to know what the reasoning is. The best explanation I've heard yet is that it is to distinguish the name of identical named fields.I have my issues with that explanation but I can understand the point.

Best Answer

The practices of adding meaningful prefixes to symbols, such as the well-publicized Hungarian Notation, date back to the times when IDEs did not exist or were too primitive. Today, when finding a point of declaration is a mouse click away, there is no point in spoiling the most precious part of the name, its first few letters, by assigning a common prefix.

Related Topic