Frameworks are large bodies (usually many classes) of prewritten code to which you add your own code to solve a problem in a specific domain. Perhaps you could say that the framework uses your code because it is usually the framework that is in control. You make use of a framework by calling its methods, inheritance, and supplying "callbacks", listeners, or other implementations of the Observer pattern.
Constrast to library. Although sometimes large libraries are referred to as frameworks, this is probably not the most common use of the term.
The distinction between framework and library is defined quite well in Patterns and Software: Essential Concepts and Terminology.
The difference between a framework and an ordinary programming library is that a framework employs an inverted flow of control between itself and its clients. When using a framework, one usually just implements a few callback functions or specializes a few classes, and then invokes a single method or procedure. At this point, the framework does the rest of the work for you, invoking any necessary client callbacks or methods at the appropriate time and place. For this reason, frameworks are often said to abide by the Hollywood Principle ("Don't call us, we'll call you.") or the Greyhound Principle ("Leave the driving to us.").
No comments:
Post a Comment