ztkmkoo / dss

Asynchronous distributed server system (dss)
MIT License
19 stars 13 forks source link

Update CodeStyle Wiki #122

Closed ztkmkoo closed 4 years ago

ztkmkoo commented 4 years ago

motivation

In resolving #36, i recognized that the code style wiki need improvement.

to do

We talk a lots in pr #108. And we decide:

The class code convention like

class Foo {

    // static fields
    // static initializer
    // static methods
    // instance fields
    // constructors
    // instance methods
    // static inner class
    // inner class
}

But there are some exceptions that,

ztkmkoo commented 4 years ago

@Alencion @Amazansia Any missing part?

ztkmkoo commented 4 years ago

Please update https://github.com/ztkmkoo/dss/wiki/Code-Style(KR) this wiki

Alencion commented 4 years ago

Hi, @ztkmkoo @Amazansia

I have some question.

  1. Will we allow both non-static and static loggers?
  2. Logger field always should be on top unless static keyword?

Ref : http://slf4j.org/faq.html#declared_static

ztkmkoo commented 4 years ago

Hi @Alencion

I read your slfj document.

  1. I think we still need static logger in some cases. There are many advantages with using static logger and i do not want to pass the logger as a parameter to a static method.

    private static void someMethod(Logger logger, String name) {
    logger.info("Hello {}", name);
    }

    (Of cource, we can design the class that we do not have to use logger in static method, then we do not need static logger.)

  2. I suggest that

    • logger field usually on top of the class
    • in serializable class logger will be position after serialVersionUID
    • in serializable class not recommend using logger
    • logger should be final

@Alencion @Amazansia @RulLu16 @Doyuni Please give some advices.

Alencion commented 4 years ago

I agree to your suggestion.

I think the logger should not need static.

Alencion commented 4 years ago

I updated the code style wiki (KR).

If you have any idea, plz tell me.

ztkmkoo commented 4 years ago

I updated the code style wiki (KR).

If you have any idea, plz tell me.

Thank you for the job. I approval your update.

ztkmkoo commented 4 years ago

I will close this job. If any opinion, please reopen this issue or create new issue.