How to mark logical sections of code in Java comments?

前端 未结 11 2101
温柔的废话
温柔的废话 2021-01-29 19:42

Java classes are generally divided into logical \"blocks\". Is there a convention to mark these sections? Ideally, it would be supported by the major IDEs.

I personally

11条回答
  •  庸人自扰
    2021-01-29 20:30

    In addition to Andrey's answer provided, to use //region //endregion, we insert [BigAscii letters][1] in major code sections. When scrolling fast, it really stands out. One drawback of this approach is that I cannot search for it so you'd need to add a search term just below the "banner" like I do below.

    Blockquote

    //    _      _____          _____                  _   _
    //   | |    |  __ \   /\   |  __ \      /\        | | | |
    //   | |    | |  | | /  \  | |__) |    /  \  _   _| |_| |__
    //   | |    | |  | |/ /\ \ |  ___/    / /\ \| | | | __| '_ \
    //   | |____| |__| / ____ \| |       / ____ \ |_| | |_| | | |
    //   |______|_____/_/    \_\_|      /_/    \_\__,_|\__|_| |_|
    //
    //   Search here with: LDAP Auth
    

    [1]: http://patorjk.com/software/taag/#p=display&c=c%2B%2B&f=Big&t=LDAP Auth

提交回复
热议问题