Naming convention: Final fields (not static)
- by Zeeker
Today I had a discussion with a co-worker about the naming of final fields in Java classes.
In his opionion final fields should also be considered constants since their values won't change after the creation of the instance.
This would lead to the following naming convention for final fields:
public class Foo {
private static final String BLA_BLA = "bla";
private final String BAR_BATZ;
...
}
In my opinion only static final fields should be considered constants while fields which are only final should follow the usual camelCase naming convention.
public class Foo {
private static final String BLA = "bla";
private final String barBatz;
...
}
Now I'm a bit uncertain since he is a far more experienced programmer than I am and I usually agree with his opinions and consider him a very good developer.
Any input on this?