16-04-2012, 12:29 PM
SOFTWARE DESIGN LAB
SOFTWARE DESIGN LAB.doc (Size: 717 KB / Downloads: 58)
1. EXPERT DESIGN PATTERN
The student has to draw the necessary UML diagrams using any suitable UML Drawing Tool and implement in Java OR C++ OR C# a program to demonstrate the Design Pattern specified by the Examiner.
Problem:
What is the most basic principle by which responsibilities are assigned in object-oriented design?
Intent:
The Information Expert pattern is a solution to the problem of determining which object should assume a particular responsibility.
Discussion:
Assign a responsibility to the class that has the information necessary to fulfill the responsibility. A Design Model may define hundreds or thousands of software classes, and an application may require hundreds or thousands of responsibilities to be fulfilled. During object design, when the interactions between objects are defined, we make choices about the assignment of responsibilities to software classes. If we’ve chosen well, systems tend to be easier to understand, maintain and extend and choices afford more opportunity to reuse components in future applications.
Example:
A Point Of Sale(POS) system is a computerized application used (in part) to record sales and handle payments; it is typically used in a retail store. It includes hardware components such as a computer and bar code scanner, and scanner to run the system. It interfaces to various service applications such as a third-party tax calculator and inventory control.
Furthermore, we are creating a commercial POS system that we will sell to different clients with disparate needs in terms of business rule processing. Each client will desire a unique set of logic to execute at certain predictable points in scenarios of using the system, such as when a new sale is initiated or when a new line item is added.
Therefore, we will need a mechanism to provide this flexibility and customization. The POS will be calculating the total sales at any given point of time.
Example:
Who is responsible for knowing the grand total of a sale in a typical Point of
Sale application?
Structure:
Participants:
• InformationExpert: This is the class, which has the information to
fulfill the responsibility. We assign the responsibility to this class to
accomplish the behavior.
• Client: The class which will be using the InformationExpert class.