What is the proper way to format code?

前端 未结 22 2219
没有蜡笔的小新
没有蜡笔的小新 2021-02-18 18:33

When I write code, I try to group lines of similar code together, then leave a blank line and write another block.

I believe this contributes to the neatness and readabi

22条回答
  •  梦如初夏
    2021-02-18 18:57

    Use little methods, in order to have a low cyclomatic complexity. High cyclomatic complexity in methods generally means that your method must be divided into several others sub methods, which will be more easier to read, and more easier to test!

    I think that your code is facing this kind of problem.

    Generally, a method with 100+ lines is too big and too complex, and then must be refactored.

    To summarize, instead of breaking code with line spaces, break it into separate methods...

提交回复
热议问题