Top Banner
18 Example of SIP • Solo Iteration Process(SIP) • Software begins by a very simple initial development • Functionality is added one step at a time by software changes (SC) • initial development + 11 SC’s © 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 1
29

18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Dec 25, 2015

Download

Documents

Cory Goodman
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

18 Example of SIP

• Solo Iteration Process(SIP)• Software begins by a very simple initial

development• Functionality is added one step at a

time by software changes (SC)• initial development + 11 SC’s

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 1

Page 2: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Point of Sale

• Keeps inventory

• Keeps records of cashiers

• Allows sale of items at terminal

• Records store cash balance

• Keep track of fluctuating regular prices and sale prices

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 2

Page 3: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Sequence of tasks

1. Initial version: single item sold, only cash payment, single price, etc.

2. Expand inventory to support multiple items.3. Support multiple prices with effective

dates.4. Implement promotional prices.5. Support the log-in of a single cashier.6. Support multiple cashiers.7. Add cashier session.

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 3

Page 4: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Sequence of tasks (cont.)

8. Keep detailed sale records such as item sold and date/time of sale.

9. Support multiple items per transaction.

10. Expand concept of cash payment to include cash tendered, change, and keep track of these values with regards to a specific sale.

11. Implement credit card payment.

12. Implement check payment.

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 4

Page 5: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

1. Initial version (one class)

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 5

Page 6: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Task 1. Expand inventory

• Concept location, impact analysis• trivial

• Prefactoring• two extractions

• class Inventory• class Item

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 6

Page 7: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

After prefactoring

+getBalance() : double+processSale() : double+resetStore() : void+calcSubTotal() : double+calcTotal() : double+Main() : void

-balance : double-inventory : Inventory

Store -item : Item

Inventory

-inventory : int-price : double-tax : double

Item

1

1 1

1

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 7

Page 8: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Completing SC

• Actualization• new fields in the Item class

• UPC, item name, current quantity

• class Inventory • a new data structure to hold a collection of items

• Change Propagation• field Item is removed

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 8

Page 9: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Class diagram after Task 1

+getBalance() : double+processSale() : double+resetStore() : void+Main() : void

-balance : double-inventory : Inventory

Store -inventory : Item

Inventory

+calcSubTotal() : double+calcTotal() : double

-upc : long-name : string-inventory : int-price : double-tax : double

Item

1

1 1

*

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 9

Page 10: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Task 7: Add cashier session

• Explicit concept: “Session”

• Each login will start a new session

• Session data• login/logout times• number of transactions• cash totals

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 10

Page 11: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Before SC

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 11

Page 12: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Concept location

• Static dependency search begins at class containing main()

Store

Inventory Item

Price

PromoPrice

Cashier

CashierRecord

main()

Not foundFound

Not found

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 12

Page 13: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Impact analysis

• Highlighted classes represent the impact set

Store

Inventory Item

Price

PromoPrice

Cashier

CashierRecord

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 13

Page 14: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Prefactoring

• Extract class Session from CashierRecord

Store

Inventory Item

Price

PromoPrice

Cashier

CashierRecord

Session

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 14

Page 15: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Actualization

• Add new fields• logout time• total cash • total number of transactions

• Create methods to increment cash and transaction totals

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 15

Page 16: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Change Propagation• CashierRecord

– Changed to keep collection of sessions

• Cashier – Supporting methods were

added

• Store – commitSale() method

changed to update current session data

• Inventory Visited, not changed

Store

Inventory Item

Price

PromoPrice

Cashier

CashierRecord

Session

STOP

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 16

Page 17: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Testing

• 7 test classes before SC• 55 assertions

• 8 test classes after SC• 1 new test class to test Session (SessionTest)• relevant test methods moved from

CashierRecordTest to SessionTest• 65 total assertions after SC

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 17

Page 18: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

After SC

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 18

Page 19: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Task 9: Multiple Items per Sale

• System currently only supports one item type per sale.

• This SC expands on the sale concept to include multiple line items for a sale.

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 19

Page 20: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Concept Location

• Examine class dependencies, starting with Main() method in the Store class• located in Sale class, as the saleItem field.

• explicit concept• we will expand the primitive concept

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 20

Page 21: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Impact Analysis

• Shaded classes are in the impact set

Store Inventory

Item

1 1

1*

Price*

1

PromoPrice

Cashiers 1 1

CashierRecord

Session

*1

*1

Sale

1*

1

*

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 21

Page 22: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Prefactoring

• SaleLineItem class is extracted from the Sale class

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 22

Store Inventory

Item

1 1

1*

Price*

1

PromoPrice

Cashiers 1 1

CashierRecord

Session

*1

*1

Sale

1*

1

*

SaleLineItem

Page 23: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Actualization

• SaleLineItem instance in the Sale class is changed to a collection of line items.

• quantity field added to SaleLineItem.

• Supporting methods added to the SaleLineItem class.

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 23

Page 24: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Change propagation

• Sale class• SaleLineItem instance changed to a collection

of objects.• support methods added.

• Store class• processSale method changed to remove

inventory for all line items.

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 24

Page 25: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Case study dataPhase Total Classes

Before New Changed(propagation)

After

1: initial 0 1 0 1

2: inventory 1 2 1 3

3: multiple prices 3 1 3 4

4: promo prices 4 1 3 5

5: cashier login 5 2 1 7

6: multiple cashiers 7 1 2 8

7: cashier sessions 8 1 4 9

8: detailed sale 9 1 4 10

9: multiple line items 10 1 2 11

10: payment 11 1 1 12

11: credit payment 12 2 2 14

12: check payment 14 1 1 15

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 25

Page 26: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Case study dataPhase Explicit / Implicit Concept Prefactoring Postfactoring

1: initial N/A N/A N/A

2: inventory explicit extract class extract methodmove method

3: multiple prices explicit extract class none

4: promo prices implicit none extract method

5: cashier login implicit none none

6: multiple cashiers explicit extract class extract methodrename class

7: cashier sessions explicit extract class none

8: detailed sale explicit extract class none

9: multiple line items explicit extract class none

10: payment implicit none none

11: credit payment implicit extract superclass none

12: check payment implicit none none

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 26

Page 27: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Case study testing overviewStep Test Classes Assertions

1 1 12

2 3 34

3 4 37

4 5 40

5 6 53

6 7 55

7 8 65

8 9 68

9 10 71

10 11 77

11 13 89

12 14 98

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 27

Page 28: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Tool support

• JUnit – unit testing framework for Java

• Abbot – functional testing framework for graphical user interfaces

• Refactoring browser• built in refactorings in Eclipse• we need more (extract class)

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18 28

Page 29: 18 Example of SIP Solo Iteration Process(SIP) Software begins by a very simple initial development Functionality is added one step at a time by software.

Resulting architecture

StoreCashiers

CashierRecord

Session

Inventory

Item

Price

PromoPrice

Sale

SaleLineItemPayment

Cash Check ChargeOOD

SIP

StoreCashier

Person

Session

Register CashDrawer

Sale

Payment

Cash AuthorizedPayment

Check Charge

Item

SaleLineItem

Price

PromoPrice

TaxCategory

UPC

ReturnLineItem

© 2012 Václav Rajlich Software Engineering: The Current Practice Ch. 18

29