Presentation is loading. Please wait.

Presentation is loading. Please wait.

Webapp Design with System Sequence Diagrams

Similar presentations


Presentation on theme: "Webapp Design with System Sequence Diagrams"— Presentation transcript:

1 Webapp Design with System Sequence Diagrams
Webapp Design with System Sequence Diagrams

2 A Key Software Design Principle…
Also: Each of your objects should have only one reason to change. From Head First Software Development Chapter 5

3 Design Questions: How many servlets should you have
Design Questions: How many servlets should you have? How to assign responsibilities to servlets?

4 Creating System Sequence Diagrams (SSDs) can help!
Model interactions between the system to be build and external actors Capture one scenario of events System is a black box Emphasizes system events Represented using UML sequence diagram notation

5 Consider a Use Case (UC) for a POS System
Point-of-Sale (POS) System Use Case: Archetypal scenario of interaction w/ system

6 Process Sale Use Case (UC)
Main Success Scenario Customer arrives at POS checkout with goods to purchase Cashier starts a new sale Cashier enters item identifier System records sale line item and presents item description, price, and running total Cashier repeats steps 3-4 until indicates done System presents total, and asks for payment Customer pays and System handles payment System logs completed sale System presents receipt

7 POS Example: Process Sale SSD
External actor System as black box Actor lifelines Time progresses downward

8 Process Sale UC Main Success Scenario
Customer arrives at POS checkout with goods to purchase Cashier starts a new sale Cashier enters item identifier System records sale line item and presents item description, price, and running total Cashier repeats steps 3-4 until indicates done System presents total, and asks for payment Customer pays and System handles payment System logs completed sale System presents receipt

9 POS Example: Process Sale SSD
Message event

10 Process Sale UC Main Success Scenario
Customer arrives at POS checkout with goods to purchase Cashier starts a new sale Cashier enters item identifier System records sale line item and presents item description, price, and running total Cashier repeats steps 3-4 until indicates done System presents total, and asks for payment Customer pays and System handles payment System logs completed sale System presents receipt

11 POS Example: Process Sale SSD
Looping event Loop guard “Return” values from previous message

12 Process Sale UC Main Success Scenario
Customer arrives at POS checkout with goods to purchase Cashier starts a new sale Cashier enters item identifier System records sale line item and presents item description, price, and running total Cashier repeats steps 3-4 until indicates done System presents total, and asks for payment Customer pays and System handles payment System logs completed sale System presents receipt

13 POS Example: Process Sale SSD

14 Process Sale UC Main Success Scenario
Customer arrives at POS checkout with goods to purchase Cashier starts a new sale Cashier enters item identifier System records sale line item and presents item description, price, and running total Cashier repeats steps 3-4 until indicates done System presents total, and asks for payment Customer pays and System handles payment System logs completed sale System presents receipt

15 POS Example: Process Sale SSD

16 Why are SSDs useful? Help you come up with a minimal set of system operations your system must support Each system operation can be a servlet System operations

17 System events discovered with the SSDs
reveal System operations that handle the events all of which form The system interface

18 Translate this SSD into a servlet-based web app
New Sale itemID: Quant.: Enter Description: … Total: $ ... End Total+tax: $ ... Payment: $ Enter Change: $... Receipt: …

19 Design Question: What standard actions should a servlet perform?
Validate input! Perform appropriate interaction with model Forward request to appropriate view

20 What types of bad input should you check for?
Hint:

21 What types of bad input should you check for?
Values that violate preconditions of model operations SQL injection attacks If input contains evil SQL snippet, and your program inserts that input into an SQL query, then ... Cross-site scripting attacks If input contains evil JavaScript snippet, and your program inserts that input into a web page, then … Anything that might be a problem (hard!)

22 Recap Single-Responsibility Principle (SRP)
Create SSDs to reveal system operations Each servlet has responsibility to handle one system operation Make sure your servlets validate input!


Download ppt "Webapp Design with System Sequence Diagrams"

Similar presentations


Ads by Google