What does “to stub” mean in programming?

后端 未结 10 1010
盖世英雄少女心
盖世英雄少女心 2020-12-12 10:06

For example, what does it mean in this quote?

Integrating with an external API is almost a guarantee in any modern web app. To effectively test such i

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-12 10:28

    This phrase is almost certainly an analogy with a phase in house construction — "stubbing out" plumbing. During construction, while the walls are still open, the rough plumbing is put in. This is necessary for the construction to continue. Then, when everything around it is ready enough, one comes back and adds faucets and toilets and the actual end-product stuff. (See for example How to Install a Plumbing Stub-Out.)

    When you "stub out" a function in programming, you build enough of it to work around (for testing or for writing other code). Then, you come back later and replace it with the full implementation.

提交回复
热议问题