Design decisions: Why and when to make an interface private?

前端 未结 3 852
我在风中等你
我在风中等你 2021-02-04 05:26

Are private interfaces ever used in design decisions ? If so, what are the reasons and when do you know the need for a private interface?

3条回答
  •  别那么骄傲
    2021-02-04 06:06

    It has to be package protected if the interface if for internal use. In general if the interface hasn't any interest outside it's ambit it's a good api design decision to hide it because there's less complexity for the users of the interface and also allows you to refactor it more easily, because when the interface is public and in the API you loss the liberty to change it.

提交回复
热议问题