You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by Chandni Singh <ch...@datatorrent.com> on 2016/04/06 02:12:48 UTC

Checkstyle import order needs to accomodate org.apache.apex

Hi,

We need to include org.apache.apex in the import order that we have right
now:

*Current order:*
java
javax
org
org.apache
io
com
com.datatorrent
*
all static imports

*Proposed order:*
java
javax
org
org.apache
io
com
com.datatorrent
org.apache.apex
*
all static imports

Thanks,
Chandni

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Chandni Singh <ch...@datatorrent.com>.
Also I think it will be a good idea to segregate api imports:

*Proposed order:*
java
javax
org
org.apache
io
com
com.datatorrent.api
com.datatorrent
org.apache.apex.api
org.apache.apex
*
all static imports


On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
wrote:

> Hi,
>
> We need to include org.apache.apex in the import order that we have right
> now:
>
> *Current order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> *
> all static imports
>
> *Proposed order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> org.apache.apex
> *
> all static imports
>
> Thanks,
> Chandni
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Yogi Devendra <yo...@apache.org>.
Thumb rule for import order:
As you go down the import order; you have more and more control over making
changes to that code.

Considering this idea, separation of org.apache.apex makes sense.

+1 for org.apache.apex
+0 separating api imports.


~ Yogi

On 6 April 2016 at 11:19, Thomas Weise <th...@datatorrent.com> wrote:

> Just wanted to know why, I have no preference.
>
> On Tue, Apr 5, 2016 at 10:48 PM, Chandni Singh <ch...@datatorrent.com>
> wrote:
>
> > We treated com.datatorrent in a special way earlier which is why I
> started
> > the discussion.
> > If we don't want to have anything special for org.apache.apex then there
> > will not be any change.
> >
> > Chandni
> >
> > On Tue, Apr 5, 2016 at 10:18 PM, Thomas Weise <th...@datatorrent.com>
> > wrote:
> >
> > > Why do we need something special for org.apache.apex ?
> > >
> > >
> > > On Tue, Apr 5, 2016 at 10:15 PM, Chandni Singh <
> chandni@datatorrent.com>
> > > wrote:
> > >
> > > > +1 for Ram's suggestion :-)
> > > >
> > > > On Tue, Apr 5, 2016 at 5:18 PM, Munagala Ramanath <
> ram@datatorrent.com
> > >
> > > > wrote:
> > > >
> > > > > I'd suggest keeping all the org.apache imports together and in
> > > > > lexicographic order.
> > > > >
> > > > > Ram
> > > > >
> > > > > On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <
> > chandni@datatorrent.com
> > > >
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > We need to include org.apache.apex in the import order that we
> have
> > > > right
> > > > > > now:
> > > > > >
> > > > > > *Current order:*
> > > > > > java
> > > > > > javax
> > > > > > org
> > > > > > org.apache
> > > > > > io
> > > > > > com
> > > > > > com.datatorrent
> > > > > > *
> > > > > > all static imports
> > > > > >
> > > > > > *Proposed order:*
> > > > > > java
> > > > > > javax
> > > > > > org
> > > > > > org.apache
> > > > > > io
> > > > > > com
> > > > > > com.datatorrent
> > > > > > org.apache.apex
> > > > > > *
> > > > > > all static imports
> > > > > >
> > > > > > Thanks,
> > > > > > Chandni
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Thomas Weise <th...@datatorrent.com>.
Just wanted to know why, I have no preference.

On Tue, Apr 5, 2016 at 10:48 PM, Chandni Singh <ch...@datatorrent.com>
wrote:

> We treated com.datatorrent in a special way earlier which is why I started
> the discussion.
> If we don't want to have anything special for org.apache.apex then there
> will not be any change.
>
> Chandni
>
> On Tue, Apr 5, 2016 at 10:18 PM, Thomas Weise <th...@datatorrent.com>
> wrote:
>
> > Why do we need something special for org.apache.apex ?
> >
> >
> > On Tue, Apr 5, 2016 at 10:15 PM, Chandni Singh <ch...@datatorrent.com>
> > wrote:
> >
> > > +1 for Ram's suggestion :-)
> > >
> > > On Tue, Apr 5, 2016 at 5:18 PM, Munagala Ramanath <ram@datatorrent.com
> >
> > > wrote:
> > >
> > > > I'd suggest keeping all the org.apache imports together and in
> > > > lexicographic order.
> > > >
> > > > Ram
> > > >
> > > > On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <
> chandni@datatorrent.com
> > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > We need to include org.apache.apex in the import order that we have
> > > right
> > > > > now:
> > > > >
> > > > > *Current order:*
> > > > > java
> > > > > javax
> > > > > org
> > > > > org.apache
> > > > > io
> > > > > com
> > > > > com.datatorrent
> > > > > *
> > > > > all static imports
> > > > >
> > > > > *Proposed order:*
> > > > > java
> > > > > javax
> > > > > org
> > > > > org.apache
> > > > > io
> > > > > com
> > > > > com.datatorrent
> > > > > org.apache.apex
> > > > > *
> > > > > all static imports
> > > > >
> > > > > Thanks,
> > > > > Chandni
> > > > >
> > > >
> > >
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Chandni Singh <ch...@datatorrent.com>.
We treated com.datatorrent in a special way earlier which is why I started
the discussion.
If we don't want to have anything special for org.apache.apex then there
will not be any change.

Chandni

On Tue, Apr 5, 2016 at 10:18 PM, Thomas Weise <th...@datatorrent.com>
wrote:

> Why do we need something special for org.apache.apex ?
>
>
> On Tue, Apr 5, 2016 at 10:15 PM, Chandni Singh <ch...@datatorrent.com>
> wrote:
>
> > +1 for Ram's suggestion :-)
> >
> > On Tue, Apr 5, 2016 at 5:18 PM, Munagala Ramanath <ra...@datatorrent.com>
> > wrote:
> >
> > > I'd suggest keeping all the org.apache imports together and in
> > > lexicographic order.
> > >
> > > Ram
> > >
> > > On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <chandni@datatorrent.com
> >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > We need to include org.apache.apex in the import order that we have
> > right
> > > > now:
> > > >
> > > > *Current order:*
> > > > java
> > > > javax
> > > > org
> > > > org.apache
> > > > io
> > > > com
> > > > com.datatorrent
> > > > *
> > > > all static imports
> > > >
> > > > *Proposed order:*
> > > > java
> > > > javax
> > > > org
> > > > org.apache
> > > > io
> > > > com
> > > > com.datatorrent
> > > > org.apache.apex
> > > > *
> > > > all static imports
> > > >
> > > > Thanks,
> > > > Chandni
> > > >
> > >
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Thomas Weise <th...@datatorrent.com>.
Why do we need something special for org.apache.apex ?


On Tue, Apr 5, 2016 at 10:15 PM, Chandni Singh <ch...@datatorrent.com>
wrote:

> +1 for Ram's suggestion :-)
>
> On Tue, Apr 5, 2016 at 5:18 PM, Munagala Ramanath <ra...@datatorrent.com>
> wrote:
>
> > I'd suggest keeping all the org.apache imports together and in
> > lexicographic order.
> >
> > Ram
> >
> > On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
> > wrote:
> >
> > > Hi,
> > >
> > > We need to include org.apache.apex in the import order that we have
> right
> > > now:
> > >
> > > *Current order:*
> > > java
> > > javax
> > > org
> > > org.apache
> > > io
> > > com
> > > com.datatorrent
> > > *
> > > all static imports
> > >
> > > *Proposed order:*
> > > java
> > > javax
> > > org
> > > org.apache
> > > io
> > > com
> > > com.datatorrent
> > > org.apache.apex
> > > *
> > > all static imports
> > >
> > > Thanks,
> > > Chandni
> > >
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Chandni Singh <ch...@datatorrent.com>.
+1 for Ram's suggestion :-)

On Tue, Apr 5, 2016 at 5:18 PM, Munagala Ramanath <ra...@datatorrent.com>
wrote:

> I'd suggest keeping all the org.apache imports together and in
> lexicographic order.
>
> Ram
>
> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
> wrote:
>
> > Hi,
> >
> > We need to include org.apache.apex in the import order that we have right
> > now:
> >
> > *Current order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > *
> > all static imports
> >
> > *Proposed order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > org.apache.apex
> > *
> > all static imports
> >
> > Thanks,
> > Chandni
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Munagala Ramanath <ra...@datatorrent.com>.
I'd suggest keeping all the org.apache imports together and in
lexicographic order.

Ram

On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
wrote:

> Hi,
>
> We need to include org.apache.apex in the import order that we have right
> now:
>
> *Current order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> *
> all static imports
>
> *Proposed order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> org.apache.apex
> *
> all static imports
>
> Thanks,
> Chandni
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Timothy Farkas <ti...@datatorrent.com>.
+1 for David's suggestion except for the blank lines.

On Wed, Apr 6, 2016 at 11:30 AM, Chandni Singh <ch...@datatorrent.com>
wrote:

> Except the blanks lines I agree with David.
>
> It is future proof to have everything in lexicographic order.
>
> Will still like to have blank lines.
> Chandni
>
> On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com> wrote:
>
> > I think the import order should be alphabetical or lexicographical, and
> no
> > blank lines are needed.
> >
> > The reason is this:
> >
> > 1) It's simple and future proof, and there will be no need to have this
> > discussion again in the future about what order it should be and where
> the
> > blank lines should be placed
> > 2) It's easy to follow, and there is no rule to remember other than it's
> > alphabetical
> > 3) It's easy to find where a particular import lines are because it's
> > alphabetical
> >
> > Whatever we come up with, we should make the change ASAP and fix all the
> > style violations once and for all.
> >
> > David
> >
> >
> > On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
> > wrote:
> >
> > > Hi,
> > >
> > > We need to include org.apache.apex in the import order that we have
> right
> > > now:
> > >
> > > *Current order:*
> > > java
> > > javax
> > > org
> > > org.apache
> > > io
> > > com
> > > com.datatorrent
> > > *
> > > all static imports
> > >
> > > *Proposed order:*
> > > java
> > > javax
> > > org
> > > org.apache
> > > io
> > > com
> > > com.datatorrent
> > > org.apache.apex
> > > *
> > > all static imports
> > >
> > > Thanks,
> > > Chandni
> > >
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Chandni Singh <ch...@datatorrent.com>.
Except the blanks lines I agree with David.

It is future proof to have everything in lexicographic order.

Will still like to have blank lines.
Chandni

On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com> wrote:

> I think the import order should be alphabetical or lexicographical, and no
> blank lines are needed.
>
> The reason is this:
>
> 1) It's simple and future proof, and there will be no need to have this
> discussion again in the future about what order it should be and where the
> blank lines should be placed
> 2) It's easy to follow, and there is no rule to remember other than it's
> alphabetical
> 3) It's easy to find where a particular import lines are because it's
> alphabetical
>
> Whatever we come up with, we should make the change ASAP and fix all the
> style violations once and for all.
>
> David
>
>
> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
> wrote:
>
> > Hi,
> >
> > We need to include org.apache.apex in the import order that we have right
> > now:
> >
> > *Current order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > *
> > all static imports
> >
> > *Proposed order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > org.apache.apex
> > *
> > all static imports
> >
> > Thanks,
> > Chandni
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Priyanka Gugale <pr...@datatorrent.com>.
I would prefer to have org.apache.apex with other org.apache projects as
Vlad suggested. Rest what we have is good w.t.r. standard practices
followed.

-Priyanka

On Thu, Apr 7, 2016 at 4:09 AM, Pramod Immaneni <pr...@datatorrent.com>
wrote:

> Like original suggestion from Chandni, current order + org.apache.apex.* at
> the end.
>
> On Wed, Apr 6, 2016 at 3:36 PM, Vlad Rozov <v....@datatorrent.com>
> wrote:
>
> > I would prefer not to change the current import order and once
> > org.apache.apex is introduced to keep it together with the org.apache
> > group. It will be extremely inconvenient to work on different branches
> with
> > different import orders.
> >
> > Thank you,
> >
> > Vlad
> >
> >
> > On 4/6/16 13:18, Munagala Ramanath wrote:
> >
> >> I prefer imports to be organized in groups with the groups themselves
> >> ordered by decreasing order of "scope" where I
> >> consider java to have the widest scope and com.datatorrent the narrowest
> >> (roughly the way we have it now) with a
> >> single blank line separating groups. When "scope" is not clear we can
> >> default to lexicographic. I think this helps
> >> readability.
> >>
> >> No major project does completely lexicographic ordering as far as I
> know.
> >> As a couple of data points : both Hadoop and
> >> Flink are doing roughly what I propose though they are not always
> >> consistent. Here are some examples:
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java
> >>
> >> -- java imports come after org.apache
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java
> >>
> >> -- java imports come before org.apache
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
> >>
> >> -- org imports not alphabetic
> >>
> >>
> >>
> hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:
> >>
> >> AbstractService.java
> >>
> >> -- import groups not lexicographic: java comes before org but com comes
> >> after.
> >>
> >> Service.java
> >>
> >> -- java comes after org
> >>
> >> Ram
> >>
> >> On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com>
> wrote:
> >>
> >> I think the import order should be alphabetical or lexicographical, and
> no
> >>> blank lines are needed.
> >>>
> >>> The reason is this:
> >>>
> >>> 1) It's simple and future proof, and there will be no need to have this
> >>> discussion again in the future about what order it should be and where
> >>> the
> >>> blank lines should be placed
> >>> 2) It's easy to follow, and there is no rule to remember other than
> it's
> >>> alphabetical
> >>> 3) It's easy to find where a particular import lines are because it's
> >>> alphabetical
> >>>
> >>> Whatever we come up with, we should make the change ASAP and fix all
> the
> >>> style violations once and for all.
> >>>
> >>> David
> >>>
> >>>
> >>> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <chandni@datatorrent.com
> >
> >>> wrote:
> >>>
> >>> Hi,
> >>>>
> >>>> We need to include org.apache.apex in the import order that we have
> >>>> right
> >>>> now:
> >>>>
> >>>> *Current order:*
> >>>> java
> >>>> javax
> >>>> org
> >>>> org.apache
> >>>> io
> >>>> com
> >>>> com.datatorrent
> >>>> *
> >>>> all static imports
> >>>>
> >>>> *Proposed order:*
> >>>> java
> >>>> javax
> >>>> org
> >>>> org.apache
> >>>> io
> >>>> com
> >>>> com.datatorrent
> >>>> org.apache.apex
> >>>> *
> >>>> all static imports
> >>>>
> >>>> Thanks,
> >>>> Chandni
> >>>>
> >>>>
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Yogi Devendra <de...@gmail.com>.
I agree with Pramod. Current order + org.apache.apex.* with delta change.

IMO, com.datatorrent.* should be after org.apache.apex.
For example, if some company xyz is developing their applications on top of
apex; they would put com.xyz.* after org.apache.apex.

I understand that, com.datatorrent.* imports would be eventually removed
once we have all the classes migrated to org.apache.apex.*. But, still
having a explicit mention of it, in the import order will give some
guidelines for the other projects dependent on apex.

~ Yogi

On 7 April 2016 at 04:09, Pramod Immaneni <pr...@datatorrent.com> wrote:

> Like original suggestion from Chandni, current order + org.apache.apex.* at
> the end.
>
> On Wed, Apr 6, 2016 at 3:36 PM, Vlad Rozov <v....@datatorrent.com>
> wrote:
>
> > I would prefer not to change the current import order and once
> > org.apache.apex is introduced to keep it together with the org.apache
> > group. It will be extremely inconvenient to work on different branches
> with
> > different import orders.
> >
> > Thank you,
> >
> > Vlad
> >
> >
> > On 4/6/16 13:18, Munagala Ramanath wrote:
> >
> >> I prefer imports to be organized in groups with the groups themselves
> >> ordered by decreasing order of "scope" where I
> >> consider java to have the widest scope and com.datatorrent the narrowest
> >> (roughly the way we have it now) with a
> >> single blank line separating groups. When "scope" is not clear we can
> >> default to lexicographic. I think this helps
> >> readability.
> >>
> >> No major project does completely lexicographic ordering as far as I
> know.
> >> As a couple of data points : both Hadoop and
> >> Flink are doing roughly what I propose though they are not always
> >> consistent. Here are some examples:
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java
> >>
> >> -- java imports come after org.apache
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java
> >>
> >> -- java imports come before org.apache
> >>
> >>
> >>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
> >>
> >> -- org imports not alphabetic
> >>
> >>
> >>
> hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:
> >>
> >> AbstractService.java
> >>
> >> -- import groups not lexicographic: java comes before org but com comes
> >> after.
> >>
> >> Service.java
> >>
> >> -- java comes after org
> >>
> >> Ram
> >>
> >> On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com>
> wrote:
> >>
> >> I think the import order should be alphabetical or lexicographical, and
> no
> >>> blank lines are needed.
> >>>
> >>> The reason is this:
> >>>
> >>> 1) It's simple and future proof, and there will be no need to have this
> >>> discussion again in the future about what order it should be and where
> >>> the
> >>> blank lines should be placed
> >>> 2) It's easy to follow, and there is no rule to remember other than
> it's
> >>> alphabetical
> >>> 3) It's easy to find where a particular import lines are because it's
> >>> alphabetical
> >>>
> >>> Whatever we come up with, we should make the change ASAP and fix all
> the
> >>> style violations once and for all.
> >>>
> >>> David
> >>>
> >>>
> >>> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <chandni@datatorrent.com
> >
> >>> wrote:
> >>>
> >>> Hi,
> >>>>
> >>>> We need to include org.apache.apex in the import order that we have
> >>>> right
> >>>> now:
> >>>>
> >>>> *Current order:*
> >>>> java
> >>>> javax
> >>>> org
> >>>> org.apache
> >>>> io
> >>>> com
> >>>> com.datatorrent
> >>>> *
> >>>> all static imports
> >>>>
> >>>> *Proposed order:*
> >>>> java
> >>>> javax
> >>>> org
> >>>> org.apache
> >>>> io
> >>>> com
> >>>> com.datatorrent
> >>>> org.apache.apex
> >>>> *
> >>>> all static imports
> >>>>
> >>>> Thanks,
> >>>> Chandni
> >>>>
> >>>>
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Pramod Immaneni <pr...@datatorrent.com>.
Like original suggestion from Chandni, current order + org.apache.apex.* at
the end.

On Wed, Apr 6, 2016 at 3:36 PM, Vlad Rozov <v....@datatorrent.com> wrote:

> I would prefer not to change the current import order and once
> org.apache.apex is introduced to keep it together with the org.apache
> group. It will be extremely inconvenient to work on different branches with
> different import orders.
>
> Thank you,
>
> Vlad
>
>
> On 4/6/16 13:18, Munagala Ramanath wrote:
>
>> I prefer imports to be organized in groups with the groups themselves
>> ordered by decreasing order of "scope" where I
>> consider java to have the widest scope and com.datatorrent the narrowest
>> (roughly the way we have it now) with a
>> single blank line separating groups. When "scope" is not clear we can
>> default to lexicographic. I think this helps
>> readability.
>>
>> No major project does completely lexicographic ordering as far as I know.
>> As a couple of data points : both Hadoop and
>> Flink are doing roughly what I propose though they are not always
>> consistent. Here are some examples:
>>
>>
>> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java
>>
>> -- java imports come after org.apache
>>
>>
>> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java
>>
>> -- java imports come before org.apache
>>
>>
>> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
>>
>> -- org imports not alphabetic
>>
>>
>> hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:
>>
>> AbstractService.java
>>
>> -- import groups not lexicographic: java comes before org but com comes
>> after.
>>
>> Service.java
>>
>> -- java comes after org
>>
>> Ram
>>
>> On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com> wrote:
>>
>> I think the import order should be alphabetical or lexicographical, and no
>>> blank lines are needed.
>>>
>>> The reason is this:
>>>
>>> 1) It's simple and future proof, and there will be no need to have this
>>> discussion again in the future about what order it should be and where
>>> the
>>> blank lines should be placed
>>> 2) It's easy to follow, and there is no rule to remember other than it's
>>> alphabetical
>>> 3) It's easy to find where a particular import lines are because it's
>>> alphabetical
>>>
>>> Whatever we come up with, we should make the change ASAP and fix all the
>>> style violations once and for all.
>>>
>>> David
>>>
>>>
>>> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
>>> wrote:
>>>
>>> Hi,
>>>>
>>>> We need to include org.apache.apex in the import order that we have
>>>> right
>>>> now:
>>>>
>>>> *Current order:*
>>>> java
>>>> javax
>>>> org
>>>> org.apache
>>>> io
>>>> com
>>>> com.datatorrent
>>>> *
>>>> all static imports
>>>>
>>>> *Proposed order:*
>>>> java
>>>> javax
>>>> org
>>>> org.apache
>>>> io
>>>> com
>>>> com.datatorrent
>>>> org.apache.apex
>>>> *
>>>> all static imports
>>>>
>>>> Thanks,
>>>> Chandni
>>>>
>>>>
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Vlad Rozov <v....@datatorrent.com>.
I would prefer not to change the current import order and once 
org.apache.apex is introduced to keep it together with the org.apache 
group. It will be extremely inconvenient to work on different branches 
with different import orders.

Thank you,

Vlad

On 4/6/16 13:18, Munagala Ramanath wrote:
> I prefer imports to be organized in groups with the groups themselves
> ordered by decreasing order of "scope" where I
> consider java to have the widest scope and com.datatorrent the narrowest
> (roughly the way we have it now) with a
> single blank line separating groups. When "scope" is not clear we can
> default to lexicographic. I think this helps
> readability.
>
> No major project does completely lexicographic ordering as far as I know.
> As a couple of data points : both Hadoop and
> Flink are doing roughly what I propose though they are not always
> consistent. Here are some examples:
>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java
>
> -- java imports come after org.apache
>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java
>
> -- java imports come before org.apache
>
> https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
>
> -- org imports not alphabetic
>
> hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:
>
> AbstractService.java
>
> -- import groups not lexicographic: java comes before org but com comes
> after.
>
> Service.java
>
> -- java comes after org
>
> Ram
>
> On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com> wrote:
>
>> I think the import order should be alphabetical or lexicographical, and no
>> blank lines are needed.
>>
>> The reason is this:
>>
>> 1) It's simple and future proof, and there will be no need to have this
>> discussion again in the future about what order it should be and where the
>> blank lines should be placed
>> 2) It's easy to follow, and there is no rule to remember other than it's
>> alphabetical
>> 3) It's easy to find where a particular import lines are because it's
>> alphabetical
>>
>> Whatever we come up with, we should make the change ASAP and fix all the
>> style violations once and for all.
>>
>> David
>>
>>
>> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
>> wrote:
>>
>>> Hi,
>>>
>>> We need to include org.apache.apex in the import order that we have right
>>> now:
>>>
>>> *Current order:*
>>> java
>>> javax
>>> org
>>> org.apache
>>> io
>>> com
>>> com.datatorrent
>>> *
>>> all static imports
>>>
>>> *Proposed order:*
>>> java
>>> javax
>>> org
>>> org.apache
>>> io
>>> com
>>> com.datatorrent
>>> org.apache.apex
>>> *
>>> all static imports
>>>
>>> Thanks,
>>> Chandni
>>>


Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by Munagala Ramanath <ra...@datatorrent.com>.
I prefer imports to be organized in groups with the groups themselves
ordered by decreasing order of "scope" where I
consider java to have the widest scope and com.datatorrent the narrowest
(roughly the way we have it now) with a
single blank line separating groups. When "scope" is not clear we can
default to lexicographic. I think this helps
readability.

No major project does completely lexicographic ordering as far as I know.
As a couple of data points : both Hadoop and
Flink are doing roughly what I propose though they are not always
consistent. Here are some examples:

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FSDataOutputStream.java

-- java imports come after org.apache

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java

-- java imports come before org.apache

https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java

-- org imports not alphabetic

hadoop-2.7.2-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service:

AbstractService.java

-- import groups not lexicographic: java comes before org but com comes
after.

Service.java

-- java comes after org

Ram

On Wed, Apr 6, 2016 at 12:24 PM, David Yan <da...@datatorrent.com> wrote:

> I think the import order should be alphabetical or lexicographical, and no
> blank lines are needed.
>
> The reason is this:
>
> 1) It's simple and future proof, and there will be no need to have this
> discussion again in the future about what order it should be and where the
> blank lines should be placed
> 2) It's easy to follow, and there is no rule to remember other than it's
> alphabetical
> 3) It's easy to find where a particular import lines are because it's
> alphabetical
>
> Whatever we come up with, we should make the change ASAP and fix all the
> style violations once and for all.
>
> David
>
>
> On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
> wrote:
>
> > Hi,
> >
> > We need to include org.apache.apex in the import order that we have right
> > now:
> >
> > *Current order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > *
> > all static imports
> >
> > *Proposed order:*
> > java
> > javax
> > org
> > org.apache
> > io
> > com
> > com.datatorrent
> > org.apache.apex
> > *
> > all static imports
> >
> > Thanks,
> > Chandni
> >
>

Re: Checkstyle import order needs to accomodate org.apache.apex

Posted by David Yan <da...@datatorrent.com>.
I think the import order should be alphabetical or lexicographical, and no
blank lines are needed.

The reason is this:

1) It's simple and future proof, and there will be no need to have this
discussion again in the future about what order it should be and where the
blank lines should be placed
2) It's easy to follow, and there is no rule to remember other than it's
alphabetical
3) It's easy to find where a particular import lines are because it's
alphabetical

Whatever we come up with, we should make the change ASAP and fix all the
style violations once and for all.

David


On Tue, Apr 5, 2016 at 5:12 PM, Chandni Singh <ch...@datatorrent.com>
wrote:

> Hi,
>
> We need to include org.apache.apex in the import order that we have right
> now:
>
> *Current order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> *
> all static imports
>
> *Proposed order:*
> java
> javax
> org
> org.apache
> io
> com
> com.datatorrent
> org.apache.apex
> *
> all static imports
>
> Thanks,
> Chandni
>