|
|
|||||||||
|
||||||||||
Notes on Design |
||||||||||
Why Dealing with Resources through Abstract Factory ?Because we must stay independent of AWT. For example, we could move to ASCII, Postscript, PDF or Java2D. In this case the colors, fonts and metrics will depend of the concrete implementation. |
||||||||||
Why Reifiying Codes ?Because Java has no enum, encoding the enum as a class is the only solution to get strong typing. |
||||||||||
Why not Using a Proxy for Defered Resources ?Because we don't want to pay the cost of delegation for such heavy used objects. When the resource is loaded there is no good reason to maintain the indirection. |
||||||||||
Why not Using Exceptions to Propagate Errors ?Because exception specification is a real maintenance nightmare. A chain of responsability is more flexible and is sometimes the only solution. For exemple, in Java you can not cause an exception (different of ThreadDeath and InterruptedException) in another thread. So we need to set up explicit communication between the threads via a shared object. |
||||||||||
Trade-off Between Safety and Transparency in CompositeWe opt for transparency and maximize the component interface. But the implementation of problematic operations on leaves raises an error. We prefer to bypass a programming style based on dynamic cast. We think that visitor and iterator patterns provide also a good way to deal with the whole-part hierarchie uniformly. |
||||||||||
Why not Providing a Font Attribute for SelectionBecause this would involve a formatting cost for a very current and so sensitive operation (selecting text). In addition, we could mix this scheme with another one where the selections are first class objects of the box structure. |
||||||||||
Why Reifiying Graphical Context ?We are using AWT for the current effort, but Java environment is still moving. Reifying the context is a provision to deal with the raise of a new library (java2D, swing, ...). This could also be an issue if we want to move to formatting of ASCII or Postscript files. We could also use double buffering or not with few modifications. |
||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
|