CodyBugstein
CodyBugstein

Reputation: 23322

In the source files of an Eclipse plug-in, why are a lot of variables prefixed with "f"?

I'm going through the source code for Eclipse plugins (right now I'm exploring the class TextMergeView) and I notice ALOT of variables are given the starting letter f.

I know that we often give interfaces the prefix I to make it easy to identify them as interfaces upon first glance. But what could f mean?

Here's a fragment:

......
private int fInheritedDirection;    // inherited direction
    private int fTextDirection;         // requested direction for embedded SourceViewer

    private ActionContributionItem fIgnoreAncestorItem;
    private boolean fHighlightRanges;

    private boolean fShowPseudoConflicts= false;

    private boolean fUseSplines= true;
    private boolean fUseSingleLine= true;
    private boolean fUseResolveUI= true;
    private boolean fHighlightTokenChanges = false;

    private String fSymbolicFontName;

    private ActionContributionItem fNextDiff;   // goto next difference
    private ActionContributionItem fPreviousDiff;   // goto previous difference
    private ActionContributionItem fCopyDiffLeftToRightItem;
    private ActionContributionItem fCopyDiffRightToLeftItem;

    private CompareHandlerService fHandlerService;

    private boolean fSynchronizedScrolling= true;
...

Why do these variable start with f? What does the f mean as a prefix?

Upvotes: 4

Views: 77

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502066

It almost certainly means "field" but it goes explicitly against the Eclipse coding conventions:

Private class variables must not have any field prefix or suffix.

class Person
{
    private String name; // NOT private String _name;
    // NOT private String fName;
    // NOT private String name_;
    ...
}

I suspect this code is older than the coding conventions...

Upvotes: 6

Related Questions