ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Pavlov <dpavlov....@gmail.com>
Subject Re: method arguments code style
Date Thu, 03 May 2018 09:09:04 GMT
Hi Dmitriy,

I like your proposal, so +1 from me.

I think it would make code more readable and easy to understand.

Sincerely,
Dmitriy Pavlov

чт, 3 мая 2018 г. в 11:31, Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com
>:

> Hi folks,
>
> I read
> https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines,
> but did not find anything about code style for method arguments.
>
> In many places in the code, I see different code style, this creates
> difficulties for reading.
>
> It seems to me an example below is rather difficult to perceive.
>
> ```java
> public void foo(Object obj1,
>     Object obj2, Object obj3,... ,Object objN){
> ....
> }
> ```
> An example GridCacheProcessor.addCacheOnJoin(...)
>
> ```java
>     private void addCacheOnJoin(CacheConfiguration<?, ?> cfg, boolean sql,
>         Map<String, CacheInfo> caches,
>         Map<String, CacheInfo> templates)
> ```
> I suggest two options for writing arguments.
>
> If arguments are placed in a line before the page delimiter.
>
> ```java
> public void foo(Object obj1, Object obj2, Object obj3 , ... , Object objN){
> ....
> }
> ```
> If the arguments are not placed in the line before the page delimiter.
>
> ```java
> public void foo(
>     Object obj1,
>     Object obj2,
>     Object obj3,
>     ... ,
>     Object objN
> ){
> ....
> }
> ```
> In my personal experience, the last example is much easier to merge if
> method arguments were changed.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message