DescriptionSome code style changes.
I'd like to establish a consistent and fairly conventional code style,
if it's OK. Else please let me know which code style is prefered so I
can set up my IDE to enforce it.
Here's a summary of changes to the best of my recollection:
- No need to have multi-line comments where a single line suffices.
- Opening brace goes on the same line as the declaration start. This
is Java style, as opposed to C or C++ where it's customary to have
the brace on the next line. This also saves some screen
real-estate, which is good.
- timeout variables should encode the units they're expressed in,
since reading: timeout = 3000 doesn't say much about what that 3000
is, while timeoutMs = 3000 does a lot with just an extra two
letters.
- 'else' clause can be compacted with the surrounding braces.
- space after if, for, while etc, so 'if (cond) { ...' rather than
if(cond).
- don't use short-form ifs, even if the consequent/alternative are one
line long. Doing so may introduce subtle bugs in nested conditional
code.
- Removed unused imports.
- No lines beyond 100 columns. That's about the place where it stops
being comfortable for reading on a modern hires monitor.
- No ascii-art in parameter formatting. When you need to break lines
in parameter lists, just use normal indent. Doing otherwise will
cause formatting to break if any of the params or methods get
refactored and renamed.
- The byte[] vs byte... comment is bogus. byte... is equivalent to
byte[]. There is ambiguity for uncast null *constant* because
compiler doesn't know if null is the null array or null as the first
array parameter. But since production code never passes in pure
null constant, this is solved by inserting appropriate conversion in
the test code. Varargs are quite OK, but arrays of primitves as
parameters aren't stellar: Iterable should be used instead, but let
that come later.
Patch Set 1 #Patch Set 2 : Touch-ups. #
MessagesTotal messages: 6
|