bugbear said:
Does anyone have a convention (with reasons!)
for the order in which
public/final/static
appear in a declaration?
Reasons? The majority of reasons for coding style conventions are
subjective. The value of following a convention is to get a uniform,
known result and often not so much in a particular rule.
Some rules are there to avoid common language pitfalls, but for the
majority there are no technical reasons or very light technical reasons.
That said, I prefer the order
[public|protected|private] [static] [final] *type* *name*
Reason? Well, let me make some up
Seriously, when dealing with a
class I am first interested if/how I can access a method or field, so
visibility (public, private, etc ...) should be first. Then I care if I
need an instance or not (static), and if I can only read or change
things (final).
Or in short, because of the following subjective reasons:
- I like it that way
- It improves readability
- It is more logical this way
- Many people do it the same way