Frameworks and Packages

Interfaces are often fundamental components of frameworks. In JADE, you can implement a framework: inline (that is, in a schema hierarchy) or as a package.

The following discussion applies to those implementations.

Frameworks usually require that client-supplied objects respond to some specific methods, which are known as callback methods. Most frameworks are written as generalized as possible, so that they can be utilized in a large number of situations. When you write a framework, you do not yet know the specific classes of the objects with which it will be working but that interaction with client-supplied code should occur according to your intentions.

To define the collaboration with the eventual code that will interact with the framework, you can use the following approaches.

The second of these approaches is the best in terms of flexibility and readability, and it allows for more-specific checks at compile time.