You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Ophir Cohen <op...@gmail.com> on 2011/02/21 16:26:01 UTC
Coding conventions
Hi All,
I started to work on my first issue:
https://issues.apache.org/jira/browse/HBASE-2965
<https://issues.apache.org/jira/browse/HBASE-2965> and I have few
questions regarding coding conventions:
1. Do you have any convention for configuration paramters names (those
that comes from the Configuration class)?
2. I saw few places that uses '+' to concat strings. Is that OK or you
prefer other means (say StringBuilder)?
3. Generally do you prefer to pass between classes the Job class or the
Configuration class (assuming, of course, that both of them holds the
needed data)?
Thanks for the answer,
Ophir
Re: Coding conventions
Posted by Ted Yu <yu...@gmail.com>.
Reading source code would answer most of your questions.
Below is a snippet from HTable:
* <p>{@link HConnection} will read most of the
* configuration it needs from the passed {@link Configuration} on initial
* construction. Thereafter, for settings such as
* <code>hbase.client.pause</code>,
<code>hbase.client.retries.number</code>,
* and <code>hbase.client.rpc.maxattempts</code> updating their values in
the
* passed {@link Configuration} subsequent to {@link HConnection}
construction
* will go unnoticed. To run with changed values, make a new
* {@link HTable} passing a new {@link Configuration} instance that has the
* new configuration.
Parameter names should clearly identify whether the parameter is a server
side or client side one. Limit the number of dots to three, if possible.
Use Configuration to pass information.
It depends on how many strings you concatenate. If there are many, you
should use StringBuilder.
On Mon, Feb 21, 2011 at 7:26 AM, Ophir Cohen <op...@gmail.com> wrote:
> Hi All,
>
>
> I started to work on my first issue:
> https://issues.apache.org/jira/browse/HBASE-2965 <
> https://issues.apache.org/jira/browse/HBASE-2965> and I have few questions
> regarding coding conventions:
>
>
> 1. Do you have any convention for configuration paramters names (those that
> comes from the Configuration class)?
>
> 2. I saw few places that uses '+' to concat strings. Is that OK or you
> prefer other means (say StringBuilder)?
>
> 3. Generally do you prefer to pass between classes the Job class or the
> Configuration class (assuming, of course, that both of them holds the needed
> data)?
>
>
>
> Thanks for the answer,
>
> Ophir
>
>