Re: PgJDBC: code reformat

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: PgJDBC: code reformat
Дата
Msg-id CADK3HHKz1DGhNOoCjCQAST6p-4cDrU_Xw7aE3t+1GfMWD2TJ8w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PgJDBC: code reformat  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Список pgsql-jdbc


On 29 December 2015 at 13:31, Gavin Flower <GavinFlower@archidevsys.co.nz> wrote:
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!

I actually find this easier to read as the logic is clear.

Cheers,

Dave 

Cheers,
Gavin

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Gavin Flower
Дата:
Сообщение: Re: PgJDBC: code reformat
Следующее
От: Vladimir Sitnikov
Дата:
Сообщение: Backend protocol wanted features