crella
V2EX  ›  问与答

问个变量命名的问题

  •  
  •   crella · Feb 20, 2020 via Android · 2029 views
    This topic created in 2302 days ago, the information mentioned may be changed or developed.
    一个分布类似矩形的元素集合,要记录其左上角的位置,右上角、左下角、右下角的位置,值都是正整数。该怎么命名这四个变量?

    命名越短越好。我刚才想到一个,就是从右上角开始,按顺时针方向依次是 p45、p135、p225、p315,是四个方向的角度,p 指代 position 位置。

    还有其他好的命名吗?
    6 replies    2020-02-20 20:24:43 +08:00
    momocraft
        1
    momocraft  
       Feb 20, 2020
    ⌜⌝⌞⌟
    fanqiang07
        2
    fanqiang07  
       Feb 20, 2020
    pNE -> NorthEast
    pSE -> SouthEase
    pSW -> SouthWest
    pNW -> NorthWest
    fanqiang07
        3
    fanqiang07  
       Feb 20, 2020
    SE -> SouthEast
    CismonX
        4
    CismonX  
       Feb 20, 2020
    upperLeft/topLeft upperRight/topRight
    lowerLeft/bottomLeft lowerRight/bottomRight
    xupefei
        5
    xupefei  
       Feb 20, 2020
    最常用的命名是
    TopLeft
    TopRight
    LeftBottom
    RightBottom

    顺序是左上角开始逆时针。
    nirvanacqw
        6
    nirvanacqw  
       Feb 20, 2020
    一楼的好
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3099 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 13:19 · PVG 21:19 · LAX 06:19 · JFK 09:19
    ♥ Do have faith in what you're doing.