Friday, March 30, 2001 06:42 PM
Here is a less formal definition:
A framework is a set of classes which handles the flow necessary to perform a complex task, but which requires plug-in classes specific to your application (database, app server), and which allows for additional plug-in classes to extend the functionality. For example, you could have a framework which handles the general flow of an online store. This framework would handle tasks such as "put item in shopping cart", "generate order on checkout", etc. On the other hand, you would need to provide the classes which enable the framework to persist the shopping cart to the database of your choice, to connect to a credit-card processor, to send orders to a warehouse, among other things. Further, if you wanted to decided that you wanted to offer monogramming, you would need to provide classes to do so, and the framework should make it easy to plug these in.
An API is really no more than a set of method signatures and other information necessary to use a class or set of classes. The API is totally distinct from the implementation. For example, a number of vendors have implemented the servlet API, each in a different way. The API by itself has no implementation.
A class library would have an API, as would a framework.