Ways to show your co-programmers that some methods

2020-06-12 05:55发布

What approaches can you use when:

  • you work with several (e.g. 1-3) other programmers over a small C++ project, you use a single repository
  • you create a class, declare its methods
  • you don't have a time do implement all methods yet
  • you don't want other programmers to use your code yet (because it's not implemented yet); or don't want to use not-yet-implemented parts of the code
  • you don't have a time/possibility to tell about all such not-yet-implemented stuff to you co-workers
  • when your co-workers use your not-yet-implemented code you want them to immediately realize that they shouldn't use it yet - if they get an error you don't want them to wonder what's wrong, search for potential bugs etc.

7条回答
ゆ 、 Hurt°
2楼-- · 2020-06-12 06:30

I actually like the concept from .Net of a NotImplementedException. You can easily define your own, deriving from std::exception, overriding what as "not implemented".

It has the advantages of:

  1. easily searchable.
  2. allows current & dependent code to compile
  3. can execute up to the point the code is needed, at which point, you fail (and you immediately have an execution path that demonstrates the need).
  4. when it fails, it fails to a know state, so long as you're not blanketly swallowing exceptions, rather than relying upon indeterminable state.
查看更多
登录 后发表回答