Closed DanVanAtta closed 6 years ago
@ssoloff should we pursue this? does the above make sense? There is no hard rule of 'statics' first, as 'private static' are helper methods and can be found next to public methods. Idea is for best cohesion, though I'm not 100% sure why statics methods go above constructor :man_shrugging:
Please re-open if you'd like to see about adding some checkstyle rules or to discuss further.
though I'm not 100% sure why statics methods go above constructor
Right, that's why I brought this up in the first place. That's atypical in the Java codebases I've looked at.
I was simply suggesting we enforce member ordering via Checkstyle so we don't have a potpourri of styles. Unfortunately, Checkstyle only supports one member ordering style (Oracle's), so if we don't want to use that, then, yeah, there's really nothing else to discuss here.
Following up on: https://github.com/triplea-game/triplea/pull/3205#discussion_r172066196 with @ssoloff
Good set of questions. We have not actually formalized all of these points beyond 'depth first ordering'.
We have agreed that our first precedent will be google java code style, second would be the default java community (oracle) standards.
Here is what google has to say:
https://google.github.io/styleguide/javaguide.html#s3.4.2-ordering-class-contents
That does not give us a lot of guidance. AFAIK the java community convention is:
The ordering of methods within a class are to some extent determined by the class itself. Whether a public static method is considered part of a depth-first ordering or a proper public static is up to the author (but such examples probably indicate an abstraction problem).