The following are two examples of E-methods design patterns.
Consider a class C for which some extenders are defined. Instances of C have an internal state and some methods of C modify it. For each method m() that modify the state, it is useful to notify the extension object what is happening.
A convenient way to do so is to declare in C three E-methods:
|
Consider a class C for which there are extenders. Each instance of C contains a set of objects belonging to the same class, we refer to them as the elements. Extension objects add information to that elements. For example, a graph contains a set of vertices; an extender that menages vertex labelling adds a string to each vertex.
A method m() performs an output in which all the stored information is shown. Part of that information is managed by the extension objects. Output must contain information about extension, too.
m() is implemented as a cycle over the vertices. The body of the cycle performs an output operation for each vertex. m() emits a header before all vertices. It consist of general information about the object. The following pattern can be used:
|