final ooad including phase4

Click here to load reader

Upload: upendra-singh

Post on 02-Dec-2014

118 views

Category:

Documents


1 download

TRANSCRIPT

ONLINE PIZZA ORDERING SYSTEM Phase 1VKrishna Kishore B Praveen Peruri Devendra A Sri Tej V V Sumanth N

INDEX 1. Design Patterns 1.1 Design Pattern 1.2 Sequence Diagram 1.3 Design Class Diagram 1.4 Contracts 1.5 Component 1.6 Deployment 2. Project Phase 1 2.1 Use Cases 2.2 Use Case Diagrams 2.3 Domain Model Diagram 3. Project Phase 2 3.1 System sequence diagrams 3.2 Design Class Definition 4. Project Phase 3 4.1 State Machine Diagram 4.2 Activity Diagrams 3 4 5 6 7 9 10 12 14 17 18 20 23 26

Design PatternsDesign Patterns are named and well-known problem/solution pair, general enough to be applied to new contexts. We applied relevant design patterns. We identified the patterns in sequence diagrams and class diagrams.

1. Information ExpertAssign a responsibility to the information expert. This expert is the class that has the information needed to fulfill the responsibility. Please refer to place order sequence diagram for details on information expert classes. Below is the table contained design class and responsibility.

Design Class Order Item ItemDescription

Responsibility Knows total amount Knows subtotal for items Knows product price

List of information required to fulfill the responsibility and the classes that knows the information Information Required for ProductDescription.price Item.quantity List of all items in order 2.CreatorCreator gives clues on assigning responsible to a class for creating a new instance of some other class. Usually a class B creates a class B iff B contains or compositely aggregates A. B records A B closely uses A. B has initializing data for A In pizza ordering system, order creates item object because order contains list of item objects. Similarly Order creates payment class as it uses payment object. More details on these are shown in class diagram and sequence diagram.

Information Expert ProductDescription Item order

3.Controller First object beyond the UI layer that receives and coordinates (controls) a system operation is controller. Creator class is root object for overall system. For pizza ordering system we identified restaurant class as controller. It accepts the commands from UI and creates objects. 4. Low Coupling and high cohesion High cohesion is used to keep objects more focused, understandable and manageable. Low coupling causes low dependency, low change impact and increased reuse. Please find use of these patterns in sequence diagrams and class diagram.

5. Adapter Pattern

Adapter pattern is used to resolve incompatibilities and provide a stable interface to similar components. This is done by converting the original interface into intermediate adapter object. We used TaxCalculationAdapter for the purpose of calculating taxes and AccountingAdapter to register the sale details into the SAP system.

6.Factory Identify the responsible class for creating objects when there re special considerations such as complex creation logic, a desire to separate the creation responsibilities for better cohesion. Create pure fabrication object called a factory that handles the situation. Sequence Diagrams :

Sequence Diagram for Make Payment

Design Class Diagram

Operation Contracts:Contracts describe detailed system behavior in terms of state changes to objects in domain model, after a system operation has executed. We described the key operation contracts place order and make

payment below.

Place OrderSystem Sequence Diagram for Place Order use case

:System :Customer createOrder() loop [more items] addItem(itemId,qty) description,total finalizeOrder() total with taxes

Operation Contract for place order use case Operation: CrossReferences: Type: Preconditions: Postconditions: placeOrder() Usecases: makePayment, cancelOrder, modifyOrder Pizza Ordering System Customer needs to have defined street address and valid payment details. An order object was created menu items were associated with orderItem total amount of total order was finalized payment object was created and customer details and amount is finalized

Make Payment

System Sequence Diagram for Make Payment use case :System :Customer FinalizeOrder() Final amount after tax makePayment(customer details,amount) paymentStatus

Operation Contract for make paymentOperation: CrossReferences: Type: Preconditions: makePayment Usecase: place Order, Cancel order, model order Pizza Ordering System Order object was created Menu items were added to order object Total amount plus tax was calculated by TaxCalculatorAdaptor object payment object was created Customer details are accepted for authorizing payment Amount was set and payment is deducted from the customer account

Postconditions:

Process MapThe flow of Order making and delivery to the customer Pizza Hut

Cutom Place er order

Is it collection or Delivery

Delivery Prom tim ise e:30 m in

Order on Make table screen

order m ade on m ake table Tim e:3m in

Oven baking process tim e: 6m in

Collection

Cut Table Cut the Pizza tim 1m e: in

Custom take a er seat : wait tim e 10 m inutes

Team m ber em handover the order to custom er

Collection

Is it collection or Delivery

Delivery

Driver Cashed up- pays m oney to the shift m anager

Custom pays er m oney or recieve card reciept

Custom er recieve delivery with in prom ise tim : 30 m e in

Delivery dispatched to driver

15 min

Component DiagramsUML component diagrams are great for identifying the architectural landscape for the system as they enable you to model the high-level software components, and more importantly the interfaces to that component. The diagram can be shown at a very high level, with just the large-grain components, or it can be shown at the component package level. We present both for the pizza ordering system.

Component diagram showing large grain components

Component diagram at component package level

Deployment DiagramThe deployment diagram shows how a system will be physically deployed in the hardware environment. Its purpose is to show where the different components of the system will physically run and how they will communicate with each other. Since the diagram models the physical runtime, a system's production staff will make considerable use of this diagram.

In pizza ordering system we are deploying the database web server and servlet container in the same high end server. Belo diagram shows how various components are deployed. Deployment Diagram

PHASE 1In phase 1 we identified few changes to use case diagrams and domain model diagram. We havent included all the use cases for brevity. Place Order Use case

USE CASE # Goal in Context Scope & Level Preconditions

Success End Condition Failed End Condition Primary, Secondary Actors Trigger DESCRIPTION

Place Order Customer makes an order through the website and expects the pizza to be delivered. Customer & Summary Customer needs to have a)defined street address b)website address for ordering through online c)valid payment details The ordered pizza is delivered to the customer on time. 1) The order has not been delivered. 2) Delivery is different from what has been ordered. Customer. Agent who takes the order and gives it to the kitchen. Order is placed by submitting on the website. Step Action 1 Customer open the website 2 Customer chooses the delivery mode and enters zip code. 3 Customer opens the menu. 4 Customer makes his selection and finalizes the order 5 Customer selects the mode of payment 6 Customer enters delivery and billing address 7 Customer registers /creates a profile. 8 Customer submits the order Step Branching Action 4a Customer wants to use promotional coupons, online coupons 4b Customer enters the coupon code or uses the online coupon by selection. 4c Customer then has the final billing amount/discounted amount after using the coupons. 6a Customer enters invalid street address 6b Customer is requested to enter valid street address. 8 Customer submits the order and payment is declined by the bank 8a Customer is asked to check for valid payment details 8b Customer re-enters correct payment details. 8c Customer resubmits the order. Branching Action 1 1a 2 2a 5 7 Customer opens the website If customer is new, he or she directly opens the menu else if the customer is an existing customer he enters the his username and passwords. Customer selects the delivery mode If he selects pickup, show the customer the nearest store for pick up and time of pickup else if he chooses delivery show estimated time of delivery. Customer selects mode of payment If he selects cash pay at delivery or else if he selects credit, take details. If the customer is an existing customer, system will have his credit details & street address else if he is new, he creates an account by choosing a username, password, email id.

EXTENSIONS

SUBVARIATIONS

Payment Use CaseUSE CASE # Goal in Context Scope & Level Preconditions Success End Condition Failed End Condition Primary, Secondary Actors Trigger DESCRIPTION Payment Make payment for the order placed by the customer. Customer/summary Customer should be able to access the pizza ordering system from his computer. Customer successfully pays for his order. Customer fails to pay for the order. Customer Pizza ordering system, payment gateway Clicking on make payment. Step Action 1 Associate opens the pizza ordering web page 2 Selects items, enters the discount coupons and navigates to payment page. 3 4 5 6 EXTENSIONS Step Selects mode of payment. Enters the required details and clicks make payment button. If payment is successful, order is placed and the associate at the restaurant views his order. System displays success message and displays the approximate time of delivery. Branching Action 1a. Existing customer can login before adding items to the cart. 2a.1 If an existing customer he can login at this point and enter the discount coupons. 2b. new customers can register at this point or ignore and proceed further. 3a if customer selects payment by cash/check, the delivery person collects the cash when delivered at his address. 3b if payment is by credit card 3b1. Customer has to enter credit card details such as name on card, credit card number, csv number, billing address, type of card etc. 4a If payment is declined the system requests to enter correct details or try another mode of payment or using another account. 5a The details of the order are stored in register for future analysis.

Use Case Diagrams User Perspective

Store Associate Associate

Domain Model

PHASE 2 In phase 2 we identified changes to SSD and the design code.

Use Case: Place Order

Problem Domain Class Definition

Customer class definitions derived from domain class diagram.public class Customer { private int ID; private CustomerInfo customerInfo; public Customer() { // constructor } //getter public int getID() { return ID; } //setter public void setID(int id) { ID = id; } public CustomerInfo getCustomerInfo() { return customerInfo; } public void setCustomerInfo(CustomerInfo customerInfo) { this.customerInfo = customerInfo; } }

2.2) CustomerInfo class definitions derived from domain class diagram.

public class CustomerInfo { private private private private private private private String String String String String String String firstName; lastName; password; userName; address; phoneNumber; emailID;

public CustomerInfo() { // constructor } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName;

} public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getEmailID() { return emailID; } public void setEmailID(String emailID) { this.emailID = emailID; }

}

Create three Customer instances with attribute values and invoke setters to populate the three instancespublic class UseCustomer { public static void main(String[] args) { Customer cust1,cust2,cust3; //create Customer Instances cust1 = new Customer(); cust2 = new Customer(); cust3 = new Customer(); CustomerInfo custInfo1,custInfo2,custInfo3; // create 3 instances of CustomerInfo class custInfo1 = new CustomerInfo(); custInfo2 = new CustomerInfo(); custInfo3 = new CustomerInfo(); // set all customerInfo fields custInfo1.setFirstName("Venkata"); custInfo1.setLastName("Vepa"); custInfo1.setUserName("vvstej"); custInfo1.setPassword("rwer");

custInfo1.setEmailID("[email protected]"); custInfo1.setPhoneNumber("469-237-5965"); custInfo1.setAddress("Apt#6204,Plano,TX"); // assign customerInfo object to customer object. cust1.setCustomerInfo(custInfo1); cust1.setID(11550417); // set all customerInfo fields custInfo2.setFirstName("KrishnaKishore"); custInfo2.setLastName("Baratam"); custInfo2.setUserName("kkb"); custInfo2.setPassword("vxcv"); custInfo2.setEmailID("[email protected]"); custInfo2.setPhoneNumber("469-237-5964"); custInfo2.setAddress("Apt#6205,Plano,TX"); // assign customerInfo object to customer object. cust2.setCustomerInfo(custInfo2); cust2.setID(11334455); // set all customerInfo fields custInfo3.setFirstName("Devendra"); custInfo3.setLastName("Somayajula"); custInfo3.setUserName("sdevendra"); custInfo3.setPassword("dfdew"); custInfo3.setEmailID("[email protected]"); custInfo3.setPhoneNumber("469-655-4232"); custInfo3.setAddress("Apt#5443,Richardson,TX"); // assign customerInfo object to customer object. cust3.setCustomerInfo(custInfo3); cust3.setID(1185894); } }

PHASE 3 For phase 3 we made changes to state machine diagram and activity diagrams. Also the changes to class diagram are included in phase 4.

States transition table for Webpage NavigationNO 1 2 3 4 SOURCE STATE EVENT SELECT LOGIN SELECT VIEW MENU ENTER AS NEW CUSTOMER ENTER AS RETURNING CUSTOMER/VALID ID PASSWORD SELECT HOME DELIVERY/VALIDATE RANGE PICK UP/FOR NEAREST STORE LOCATOR ADD ITEM FOR CUSTOMIZING ITEM ADD ITEMS ENTER VALID COUPON CODE SUBMIT ORDER FILL DETAILS/AUTHORIZE PAYMENT INFORMATION TARGET STATE

HOMEPAGE HOMEPAGE LOGINPAGE LOGIN PAGE

LOGIN PAGE MENU PAGE ENTER DETAILS PAGE ACCOUNT PAGE

5

ACCOUNT PAGES

ORDER PAGE

6

ACCOUNT PAGE

ORDER PAGE

7 8 9 10

MENU PAGE MENU PAGE CUSTOMIZE PAGE ORDER PAGE

ORDER CUSTOMIZE PAGE ORDERPAGE ORDER PAGE

11 12

ORDERPAGE PAYMENTPAGE

PAYMENT PAGE FINALIZE ORDER PAGE

13

FINALIZE ORDER PAGE

SUBMIT

SALE/RECEIPT

14

SALE/RECEIPT

CLICK BACK TO HOME PAGE

HOME PAGE

Activity Diagram Place an Order

Cancel Order Activity