V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
KitAndrewLee
V2EX  ›  问与答

定制化需求实现

  •  
  •   KitAndrewLee · Apr 26, 2020 · 1822 views
    This topic created in 2192 days ago, the information mentioned may be changed or developed.

    各种各样的定制化需求,在接口里面全都是 if/else,看的头都大 大佬们的公司都是如何处理这种 想写的优雅简洁一点 求建议

    2 replies    2020-04-26 11:47:28 +08:00
    airyland
        1
    airyland  
       Apr 26, 2020
    加上 hook,设计一个 plugin 机制。
    SilentDepth
        2
    SilentDepth  
       Apr 26, 2020
    接口啊?那就是不涉及视图层呗。逻辑上多抽象出几个层,写一个 Map,每个客户(或者定制业务)贴一个 ID,靠 ID 来从 Map 里找具体需要执行的逻辑。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2997 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 15:11 · PVG 23:11 · LAX 08:11 · JFK 11:11
    ♥ Do have faith in what you're doing.