An interface is intended to be a gateway to multiple implementations, and a typical way to produce objects that fit the interface is the
Factory Method design pattern. Instead of calling a constructor directly, you call a creation method on a factory object which produces an implementation of the interface—this way, in theory, your code is completely isolated from the implementation of the interface, thus making it possible to transparently swap one implementation for another.
No comments:
Post a Comment