• 请不要在回答技术问题时复制粘贴 AI 生成的内容
WildCat
V2EX  ›  程序员

变量命名问题,是 replies_count 还是 reply_count,是 topicList 还是 topicsList

  •  
  •   WildCat · Feb 12, 2015 · 2674 views
    This topic created in 4116 days ago, the information mentioned may be changed or developed.
    在 GitHub 上搜了下这两种用法,发现数量都不小。
    6 replies    2015-02-13 12:37:22 +08:00
    fortunezhang
        1
    fortunezhang  
       Feb 12, 2015   ❤️ 1
    banana trees ?
    bananas tree ?
    mthli
        2
    mthli  
       Feb 12, 2015 via Android   ❤️ 1
    replies_count(计算回复的次数,至少Dribbble API是这样的风格)。
    topicList(List已经有包含很多item的意思了,不需要单独为topic写复数)。
    raincious
        3
    raincious  
       Feb 12, 2015   ❤️ 1
    每当遇到这种无关紧要问题的时候,掏出一元钱硬币是最佳的解决方案了。

    不过貌似我从来没遇到过这种问题。
    topicList => topics
    replies_count => count_replies (count_likes、count_followers)

    我好机灵。
    mhycy
        4
    mhycy  
       Feb 12, 2015   ❤️ 1
    同一类型数据使用同样的前缀
    topicList/topics
    topicInfo

    下划线命名看应用,一般都是因为过长而使用驼峰法
    xhacker
        5
    xhacker  
       Feb 13, 2015
    reply_count, topicList
    pright
        6
    pright  
       Feb 13, 2015   ❤️ 1
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3189 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 12:14 · PVG 20:14 · LAX 05:14 · JFK 08:14
    ♥ Do have faith in what you're doing.