3 ms·
There are multiple reasons to want this, some are dysfunction, but others are useful. Every time you use a function from elsewhere you become coupled to that f
by bluGill 2y ago
There are multiple reasons to want this, some are dysfunction, but others are useful.
Every time you use a function from elsewhere you become coupled to that function and how it works. That means that if however maintains that function wants to make a change someone must be responsible for keeping your code working with the change. (this can be handled many ways - all too often this customers get mad because a feature doesn't work right and they can't complain to anyone). If you put control over who can use what you can prevent a lot of issues.
In a compiled system changing an interface means more code to recompile, so control over who can use what reduces build times.
If you know some function is for internal use in one place you won't spend time designing a good interface. If the function is for use by everyone you should spend more time making it a nice interface that is easy to use correctly. Every once in a while I design something for internal use like that, but someone external discovers it is useful and they are using a bad interface that meets my needs but isn't quite right for them.