The
main advantage I was able to find regarding the use of hidden implementations is
to not have to address the complexity that exists within. As long as the function of the hidden
implementation is understood then it can even be reapplied to other scenarios in
a similar manner. An analogy would be
operating a vehicle. When the key is
turned, the driver doesn’t need to understand what is happening with each
individual part of the engine. In fact,
you could even take the same engine, as a whole, and place it into another
vehicle (providing the configuration is similar) and will work to operate the
other vehicle, there is a seamless transition as far as the driver is concerned
– they still just turn the key, what’s happening beyond that isn’t
important. How this analogy applies to a
situation where it would be an advantage is if the methods are being created for
a client to plug in. The details and
complexity aren’t necessary for the client to know, but only the behavior of the
method and enough knowledge of when to apply it. (The thought occurred to me that this could
also be proprietary code that an author may not want to make available to the
client; but I was unable to find anything online to support this
idea.)
A
disadvantage to both the analogy and the methods in programming is that if the
scope of usage is unclear or a problem occurs internally then the program (or in
the vehicle analogy, the automobile) become inoperable.
Sources: