Re: PgJDBC: code reformat - Mailing list pgsql-jdbc

From Gavin Flower
Subject Re: PgJDBC: code reformat
Date
Msg-id 5682D19B.6000006@archidevsys.co.nz
Whole thread Raw
In response to Re: PgJDBC: code reformat  (Steven Schlansker <stevenschlansker@gmail.com>)
Responses Re: PgJDBC: code reformat  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
On 29/12/15 11:39, Steven Schlansker wrote:
> JMH is an awesome harness for constructing exactly these sorts of performance tests:
> http://openjdk.java.net/projects/code-tools/jmh/
>
> If we care about driver performance, it might be interesting to construct
> some representative tests and include them as part of the build process, to
> ensure that metrics we care about don't get regressions.  Obviously this would be
> some work that needs volunteers interested in working on it, just an idea to think on.
>
>
> And while we're bikeshedding, I personally would -1 the "only one exit per function".
>
> Sometimes it's nice to bail early e.g. :
>
> if (offset == length) { return 0; }
> ... do work ...
> return result;
[...]

Sorry , don't have time to reply in depth, possibly in about a week
(holiday).

Only one exit per function works best when it is an absolute rule - with
possibly very rare exceptions, and I've yet to see a valid exception in
over 40 years of programming.

In practice, having multiple returns is unnecessary & makes code harder
to read.

Remember the Just-in-Time compiler is very good at optimising, even way
back in the JDK 1.6 days, and we're now up to 1.8!


Cheers,
Gavin


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: PgJDBC: code reformat
Next
From: Dave Cramer
Date:
Subject: Re: PgJDBC: code reformat