Dear Wiki user, You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.
The "CodeStyle" page has been changed by JonathanEllis: https://wiki.apache.org/cassandra/CodeStyle?action=diff&rev1=20&rev2=21 Comment: r/m obsolete comments about underscores in field names == General Code Conventions == - * The Cassandra project follows Sun's Java coding conventions (http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html) with an important exception: + * The Cassandra project follows Sun's Java coding conventions (http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html) with an important exception: { and } are always placed on a new line - * { and } are always placed on a new line - * Please make sure to use 4 spaces instead of the tab character for all your indentation == Exception handling == * Never ever write `catch (...) {}` or `catch (...) { logger.error() }` merely to satisfy Java's compile-time exception checking. Always propagate the exception up or throw RuntimeException (or, if it "can't happen," AssertionError). This makes the exceptions visible to automated tests. @@ -34, +32 @@ ? doFoo() : doBar(); }}} - == Private_ _Members and Underscores == - * The goal is to not have an "_" character appended or prepended to private variables' names - * There's currently a lot of private variables with an "_" appended to them... here's our current policy on this. - * if you're working on a file with foo_ style private members then please keep using that convention. - * when writing a new class please do not name private variables w/ an appended or prepended "_" - - {{{ - public class ExampleStuff - { - private String foo_; // bad - but it's all over the code. if the file uses this style then keep using that style - private String _foo; // bad - don't do this - private String foo; // more better - } - }}} == Whitespace == * Please make sure to use 4 spaces instead of the tab character for all your indentation * Many lines in many files have a bunch of trailing whitespace... Please either clean these up in a separate patch, or leave them alone, so that reviewers now and anyone reading code history later don't have to pay attention to whitespace diffs.