0

What the proper visibility for a class members should be, if the class visibility itself is set to internal and the class members are intended to be used internally to the current assembly only? I want to consider possible promotion of the class to become public in the future and reduce the effort of changing the members visibility from internal to public.

QUESTION: What are ups and downs of such a solution?

With Variant 1 i posses full control of the promotion and must be more conscious about it, but if you have large number of internal members the developer could easily just search/replace the visibility and wont gain the 'conscious' benefit.

With Variant 2 i am more conscious during the current design of the class, assuming it could be consumed outside of the library even now is restricted only for internal library use. While in the same time this breaks the KISS principle making me thing of scenarios not needed to be used at the moment.

Variant 1:

internal class A
{
    internal void Memeber1() {}
    internal void Memeber2() {}
}

Variant 2:

internal class B
{
    public void Memeber1() {}
    public void Memeber2() {}
}
kalitsov
  • 1,319
  • 3
  • 20
  • 33
  • Hi @CodeCaster, thanks for the feedback! But I already read the topic you pointed to. It does not answer my question though. I"m really looking for an opinion here, deferment then the inheritance example. Please, read my question one more if you find time for this. Thank you in advance! – kalitsov Jan 11 '20 at 08:57
  • See [this answer](https://stackoverflow.com/a/9302642/2791540) for an informed opinion on the topic. – John Wu Jan 11 '20 at 09:05
  • 1
    Yeah and Stack Overflow is not about opinions. There's plenty of questions on the subject that deal in facts, the linked duplicate being one, and the one added by @JohnWu being another. – CodeCaster Jan 11 '20 at 09:17
  • Thanks! The topic pointed by John Wu is the one i was looking for. – kalitsov Jan 11 '20 at 12:04

0 Answers0