< Day Day Up > |
Sometimes the paradigm of the underlying implementation does not match the paradigm of the interface you have created. Usually you can create an adapter that hides this difference. A dictionary holds pairs of keys with associated values. If you add a key that already exists, the value for the previous entry in the dictionary is overwritten silently. In other implementations , the duplication generates an error. You might have created an interface that works one way. An implementation might work the other way. You can add logic to make that implementation work the other way. For example, if your interface assumed silent overwriting, the logic can check for the existence of the key and delete the current key before adding the new one. You cannot adapt some paradigm mismatches in this manner. You might not be able to find an implementation that works in the paradigm of the interface you designed. In that case, you will have to rewrite the interface and redo the methods that depend upon it. [*]
|
< Day Day Up > |