It seems to me that anytime I come across internal calls or types, it’s like I hit a road block.
Even if they are accessible in code like open-source, it still feels they are not usable parts of the API code itself. i.e. it’s as if they are discouraged to be modified.
Should one keep oneself from using the internal keyword unless it’s absolutely necessary?
I am asking this for an open-source API. But still not everyone will want to change the API, but mostly use it to write their own code for the app itself.
There is nothing wrong with having an internal type in your DLL that is not a part of your public API. In fact, if you have anything other than a trivial DLL is more likely a sign of bad design if you don’t have an internal type (or at least a non-public type)
Why? Public APIs are a way of exposing the parts of your object model you want a consumer to use. Having an API of entirely public types means that you want the consumer to see literally everything in your DLL.
Think of the versioning issues that come along with that stance. Changing literally anything in your object model is a breaking change. Having internal types allows you great flexibility in your model while avoiding breaking changes to your consumers.