t298
V2EX  ›  问与答

如何给方法起名?

  •  
  •   t298 · Jul 14, 2022 · 2091 views
    This topic created in 1574 days ago, the information mentioned may be changed or developed.
    8 replies  •  2022-07-14 18:17:32 +08:00
    storyxc
    storyxc
    Jul 14, 2022❤️1
    1
    推荐个 alfred workflow: https://github.com/xudaolong/CodeVar
    pendulum
    pendulum
    Jul 14, 2022
    2
    尽量选择动词或动宾结构
    soupu626
    soupu626
    Jul 14, 2022❤️1
    3
    com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState

    每次看到命名相关问题我就想发这个
    QingXuJiaZhi
    QingXuJiaZhi
    Jul 14, 2022
    4
    如果起名困难,很有可能是在设计上不清晰,如果一个方法的作用很清晰,起名应该不难才对。
    icyalala
    icyalala
    Jul 14, 2022
    7
    论超长方法名,没有比苹果更擅长的了:
    initWithEnableFan:enableAirConditioner:enableClimateControl:enableAutoMode:airCirculationMode:fanSpeedIndex:fanSpeedPercentage:relativeFanSpeedSetting:temperature:relativeTemperatureSetting:climateZone:

    更多见: https://github.com/Quotation/LongestCocoa
    yunye
    yunye
    Jul 14, 2022
    8
    主谓宾 主谓双宾 主谓复合宾
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1460 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 18:44 · PVG 02:44 · LAX 10:44 · JFK 13:44
    ♥ Do have faith in what you're doing.