iiicarus
V2EX  ›  Java

大家会不会用 id 作为 代码唯一标识,或者枚举的值。比如直接取公司这条数据的 id=1 代表这个公司

  •  
  •   iiicarus · May 25, 2020 · 2094 views
    This topic created in 2201 days ago, the information mentioned may be changed or developed.

    后面可能会为( 1,公司 A )建立枚举,1 代表公司 A 。不管前后台代码,都用 1 代表或者判断为公司 A 。

    gauzung
        1
    gauzung  
       May 25, 2020   ❤️ 1
    不会被打吗?
    dilu
        2
    dilu  
       May 25, 2020
    用 id 没毛病,但是不定义常亮,常量名字不清晰,绝对会被打
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5699 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 03:22 · PVG 11:22 · LAX 20:22 · JFK 23:22
    ♥ Do have faith in what you're doing.