belle@skipper.dfrf.nasa.gov (Steve Belle) (02/08/91)
I have recently been poking around in the Eiffel graphics classes from ISE. I have discovered that for any graphical application, there are two instances of "device" created. One of these comes from the window cluster, in class DEV_CONST, and the other comes from the figure cluster, in class GRAPH_CONST. To the limited extent that I have dug into this, it seems that this is not necessary. All of the figure classes (POINT, POLYLINE, POLYGON, etc.) have respective *_IMP classes that in turn inherit from class FIGURE_IMP, which inherits from DEV_CONST. The various *_IMP classes redefine the attributes device, black_color, and white_color inherited from FIGURE_IMP to avoid conflict with attributes of the same names coming from GRAPH_CONST. This implementation results in 2 instances of DEVICE being created, the first when the application is started up, and the second when any type of figure is Created. It seems that only 1 instance of a device (and a black_color & white_color) is required (or desired). I believe the attributes device, black_color, and white_color should be removed from class GRAPH_CONST, as well as the renaming clauses in the various figure_IMP classes. This also requires the addition of DEV_CONST to the inherit clause of class GEN_FIGURE, because one of the routines in that class has a pre-condition that requires an instance of device. In my opinion, the implementation I suggest seems to make more sense because it means that, per application, there is only one instance each of device, black_color, and white_color. Anyone else have thoughts or experience with this? Steve Belle PRC belle@skipper.dfrf.nasa.gov