Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(442)

Issue 4754047: Some code style changes. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 8 months ago by fmil
Modified:
13 years, 8 months ago
Reviewers:
grakic, grakic
Visibility:
Public.

Description

Some 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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+120 lines, -139 lines) Patch
M lib/src/main/java/net/devbase/jfreesteel/Reader.java View 1 3 chunks +57 lines, -75 lines 0 comments Download
M lib/src/main/java/net/devbase/jfreesteel/Utils.java View 7 chunks +18 lines, -19 lines 0 comments Download
M lib/src/test/java/net/devbase/jfreesteel/UtilsTest.java View 1 chunk +45 lines, -45 lines 0 comments Download

Messages

Total messages: 6
fmil
13 years, 8 months ago (2011-07-16 18:47:09 UTC) #1
grakic
On 2011/07/16 18:47:09, fmil wrote: Pushed. https://gitorious.org/freesteel/jfreesteel/commits/master
13 years, 8 months ago (2011-07-17 11:14:08 UTC) #2
grakic
On 2011/07/16 18:47:09, fmil wrote: I pasted your code styles notes to the wiki: https://gitorious.org/freesteel/pages/CodeStyle ...
13 years, 8 months ago (2011-07-17 12:33:17 UTC) #3
fmil
On Sun, Jul 17, 2011 at 5:33 AM, <grakic@gmail.com> wrote: > On 2011/07/16 18:47:09, fmil ...
13 years, 8 months ago (2011-07-17 20:24:08 UTC) #4
grakic
On 2011/07/17 20:24:08, fmil wrote: > Another improvement may be splitting this class into three ...
13 years, 8 months ago (2011-07-19 12:28:34 UTC) #5
fmil
13 years, 8 months ago (2011-07-19 17:14:45 UTC) #6
On Tue, Jul 19, 2011 at 5:28 AM, <grakic@gmail.com> wrote:

> On 2011/07/17 20:24:08, fmil wrote:
>
>> Another improvement may be splitting this class into three parts --
>>
> since it
>
>> already tries to do three separate things.  But it's not essential and
>>
> can
>
>> be done later.
>>
>
> I do not see use case where you would want document info and not
> personal info.
>
> The fact there are 3 different EF blobs stored on the card internally
> can be easily changed in the future with new series of cards. All 3
> files are read much faster than you can remove and insert new card.
>

Ok, we'll worry about that when the time comes.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b