Information Technology Reference
In-Depth Information
Separately, the abstract interfaces have been refined with Java Modelling Lan-
guages (JML) annotations derived from the pre- and post-conditions. These can
be checked at runtime, and we plan to use them for further static analysis in
future work: the JML code snippet of the enterItem() design is shown on the left
of Fig. 13. Notice that the code in the dotted rectangle gives the specification of
the exception.
/*@ public normal_behaviour
@ requires ( \exists Object o; theStore.theProductList.contains(o);
@ ((Product)o).theBarcode.equals(code)); …
@ ensures theLine != \old (theLine) &&
@ theLine.theBarcode.equals(code) &&…
@ also
@ public exceptional_behaviour
@ requires !( \exists Object o; theStore.theProductList.contains(o);
@ ((Product)o).theBarcode.equals(code));
@ signals_only Exception;
@*/
public void enterItem(Barcode code, int qty) throws Exception;
public void enterItem(Barcode code, int qty)
throws Exception{
if (find(code) != null ) {
line = new LineItem(code, qty);
line.setSubtotal(find(code).price * qty);
sale.addLine(line);
t = true ;
} else {
throw new Exception ();
}
}
Fig. 13. JML Specification and Implementation
In the detailed design, some of the object-oriented interfaces are replaced by
appropriate interaction mechanisms and middlewares, for example
- We keep the interface StoreIf between the application layer and the data
representation layer as an oo interface.
- As all the SalesHandler instances share the same inventory, we can introduce
a connector by which that the cash desks get product information or request
the inventory to update information of a product by passing a product code.
This can be implemented asynchronously using an event channel.
- The interaction between the SalesHandler instances and Bank can be made
via RMI or CORBA.
- The interaction between the Inventory instance and the Supplier can be made
via RMI or CORBA.
Design of GUI and Controllers of Hardware Devices. In our approach,
we keep the design of an application independent from the design of the GUI,
so that we do not need to change the application. The GUI design is only con-
cerned about how to link methods of GUI objects to interface methods of the
application components to delegate the operation requested and to get the in-
formation that are needed to display on the GUI. In general, the application
components should not call methods of the GUI objects. Also, no references
should be passed between application components and GUI components (the
so called service-oriented interfaces should be used). This requires that all in-
formation that is displayed on the GUI should be provided by the application
components and corresponding interface operations should be provided by the
Search WWH ::




Custom Search