The Webshop E-Commerce Framework: Marcus Fontoura Wolfgang Pree Bernhard Rumpe
The Webshop E-Commerce Framework: Marcus Fontoura Wolfgang Pree Bernhard Rumpe
Framework
Wolfgang Pree Bernhard Rumpe
Marcus Fontoura
Professor of Computer Software and Systems
IBM Almaden Research
Science Engineering
Center
Software Research Lab Munich University of
650 Harry Road, San Jose,
University of Constance, D- Technology, D-80290
CA 95120, U.S.A.
78457 Constance, Germany Munich, Germany
e-mail:
e-mail: [email protected] e-mail: [email protected]
[email protected]
Web-site with
Product information product catalog
WebShop and shopping
& store configuration
facilities
Payment
Promotions options
Administrative
reports
Transaction
concluded Figure 4. Typical Shopping page for WebShop.
Shopping
page Report1
Process @
transaction
@ Transaction @
Report
- Add product to error list
Select report
shopping cart
- Alter product
quantities
- Payment method
@ @ Report K
selection & information - Report selection &
Figure 3. Navigational structure of a typical information
WebShop application. @
Figure 5. Report listing on a separate site.
WebShop allows the creation of a
complementary site for displaying the 2.1. Shopping Cart
administrative reports. Typically, the structure
of the administrative is set up as a simple list The core entity of the WebShop framework is
of reports. The end user can select from an the shopping cart. For each client access to a
overview list any of the reports available (see Web store a new shopping cart object is
Figure 5). created. This shopping cart takes care of the
connection and is responsible for controlling
the user selection of products and the checkout
2. WebShop components operation. Figure 6 shows an UML-F diagram
The following sections present the core demonstrating what a shopping cart contains -
aspects of WebShop by means of UML-F [1] the exact number of products and one
diagrams. UML-F is an UML [4] extension for transaction log.
documenting object-oriented frameworks and Methods addProduct(),
design patterns. This presentation forms the removeProduct(), and changeQuantity() in
basis for identifying patterns that are useful in class ShoppingCart modify the products
the context of e-commerce frameworks. already chosen accordingly. Method
checkout() processes the payment transaction.
It is also responsible for updating the system transactions in Figure 8(a), and the electronic
transaction log by invoking method addLog() money transactions in Figure 8(b).
in class TransLog. The transaction log may be
used for various customer relationship
management activities such as promotions. «Sep-T» «interface»
ShoppingCart payment 1 «Sep-H»
Thus, it forms the basis of various reports. Payment
...
+processPayment() «Sep-h»
Product +checkout() «Sep-t»
+getName()
... CreditCard EMoney
+addProduct() +getValue()
+processPayment() +processPayment()
+removeProduct()
transLog 1
Figure 7. The Payment interface.
+changeQuantity() TransLog
...
+checkout()
+addLog() :ShoppingCart
classes. The method checkout() is the template Figure 8. Creating the appropriate payment object
method («Sep-t»), since it is responsible for (a) for credit cards and (b) for electronic money.
invoking processPayment() («Sep-h»), which
is a hook method that varies for different Note that the parameter specifying the
classes that implement the Payment interface. payment option is a string that represents the
The «adapt-dyn» tag indicates that the classes class name of the specific payment class. The
are dynamically loaded into the system when checkout() method uses dynamic class loading
needed. to instantiate the appropriate class based on its
From the client’s perspective, a Web name. Example C.1 illustrates the code for the
form should present the payment options checkout(). A more elaborate (and flexible)
available. The client selection is then design would have a table mapping the string
proceeded to the store that has to instantiate parameters to the actual class names.
the appropriate payment object and plug it into
public boolean checkout(
the shopping cart. The sequence diagram in String paymentClassName,
Figure 8 illustrates this scenario. It shows the String paymentInfo) {
creation of an object to process credit card
boolean paymentOK = false;
Payment payment = null; The COR pattern allows each
promotion object to check if the current
try { // tries to instantiate a Payment object
Class c = Class.forName(paymentClassName); transaction follows the conditions required by
payment = (Payment) c.newInstance(); it. The object then forwards the request to the
} next promotion object, if any. The object
catch(Exception e) { diagram in Figure 10 exemplifies a
// error, throws framework exception
}
combination of two such promotion objects to
// The method total() calculates the total value which a ShoppingCart object refers to.
// of goods in the shopping cart. This method is a
//private method in class ShoppingCart. :ShoppingCart
«COR-ConcreteHandler» «COR-ConcreteHandler»
report(“ListLog”)
Over1000 BaseDiscount
+definePromo() +definePromo()
«create» : ListLog
«COR-handleRequest» «COR-handleRequest»
2.4. Reports
Figure 14. Creating the appropriate report object
The report generation in WebShop relies on
the Separation construction principle (see «WebR-L» «interface»
request 1
Figure 13). Analogous to the Payment Report «WebR-H»
ReportImp
...
subclasses, a string is used to uniquely specify +report() «WebR-load»
+generateReport() «WebR-handle»
+generateReport() «WebR-handle»
the dynamic loading of the appropriate
Figure 15. Using the Web Request tags to model
ReportImp class and for the invocation of the the report generation variation point.
generateReport() method, which returns a
string containing the report written/generated Web Request keeps the execution of a request
in HTML. For example, class ListLog lists the flexible and applies the Separation
entire log while class ByProduct might lists construction principle [2] for this purpose. The
the transactions related to a given product. «WebR–load» method is responsible for
dynamic loading of the appropriate «WebR–
«Sep-T»
reportImp 1
«interface»
ConcreteHandler» class based on its input
Report «Sep-H»
ReportImp arguments
...
+generateReport() «Sep-h»
+report() «Sep-t»
«adapt-dyn» 3. Conclusions
ListLog ByProduct
The paper presented the core components of
+ generateReport() + generateReport()
the WebShop framework, which focus
Figure 13. Annotating the report variation point
assisting the development of online stores. The
through the Separation construction principle tags UML extensions, namely the UML-F profile
[1] used to describe WebShop proved very
2.5. The Web Request pattern effective to provide an application developer
an intuitive and easy overview of the
As the design used for the Report variation framework. The UML-F profile mainly
point is analogous to the one used for provides a set of tags together with
Payment, and as it is quite useful to have a mechanisms to introduce new tags and to
dynamically created object to treat end-user describe their meaning and intention in an
requests, we define a domain-specific pattern informal yet systematic way.
called Web Request. The payment and
administrative reports variation points both
use the Web Request structure. Payment, for
4. References
[1] M. Fontoura, W. Pree, and B. Rumpe, The
UML Profile for Framework Architectures,
Addison-Wesley, 2001.