Writing/implementing an API: testability vs information hiding

后端 未结 6 1173
春和景丽
春和景丽 2021-01-21 12:56

Many times I am involved in the design/implementation of APIs I am facing this dilemma.

I am a very strong supporter of information hiding and try to use various techniq

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-21 13:06

    what I don't like is making any sacrifices when it comes to information hiding

    First, work with Python for a few years.

    private is not particularly helpful. It makes extension of the class hard and it makes testing hard.

    Consider rethinking your position on "hiding".

提交回复
热议问题