DOC PREVIEW
UT Dallas CS 6359 - S18_Chapter_18

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1What will we learn?OverviewGetting Started …NextGen POS – Getting StartedInitialization?Process Sale: makeNewSaleProcess Sale: makeNewSaleProcess Sale: makeNewSaleSlide 10Process Sale: enterItemProcess Sale: enterItemProcess Sale: enterItemProcess Sale: enterItemSlide 15Slide 16Process Sale: endSaleSlide 18Process Sale: Calculate Sale TotalProcess Sale: Calculate Sale TotalSlide 21Process Sale: Calculate Sale TotalSlide 23Process Sale: makePaymentProcess Sale: makePaymentSlide 26Process Sale: Logging the SaleSlide 28Slide 29Process Sale: Calculating the BalanceSlide 31Slide 32Process Sale: Connecting UI and Domain LayerSlide 34Slide 35InitializationInitializationSlide 38Takeaways from Chapter 18Next …Object-Oriented Analysis and DesignCHAPTER 18: GRASP PATTERNS - EXAMPLES1What will we learn?GRASP – Object Design ExamplesApplying GRASP to our case studies2OverviewWe will practice assigning responsibilities, using the GRASP principles we have learnedBefore we apply the GRASP principles to Domain Objects, we first need to look at how to design the Domain Objects for an entire use case scenarioUse Case Realization: How a use case is realized in the Design Model in terms of collaborating objectsThis connects the requirements (expressed in a use case) and the object design that satisfies the requirements3Getting Started …The use case suggests system operations that are shown in the SSDsThe system operations become the starting messages entering the Controllers for the domain layer interaction diagramsDomain layer interaction diagrams illustrate how objects interact to fulfill the required tasks and meet the responsibility defined by the system operation – this is the use case realization4NextGen POS – Getting StartedRecall that for the basic Process Sale use case, the SSD gave us the following system operations:makeNewSaleenterSaleendSalemakePaymentThese will be the starting messages into the Domain Layer controller objectWe can also consider the Operation Contracts we developed to further help explain how the system changes with these operationsWe will assign the responsibility of handling these system operations to various objects in the Domain Layer – this is RDD5Initialization?Shouldn’t we first design a “Start up” use case to initialize the objects, i.e. “turn the system on”?Not a bad idea, and when coding this is often the first thing doneBut in design, we usually do this last, once we know all the objects that will make up the designSo we will first explore the Process Sale use case, and leave the details of a Start Up use case until later6Process Sale: makeNewSaleWe start with the makeNewSale system operation – this occurs when the Cashier initiates a request to begin a new saleRecall we had an operations contract for this operation, which had the following post conditions:-A Sale instance s was created -s was associated with the Register-Attributes of s were initializedWe need to define a Domain Layer object to receive the makeNewSale message that occurs when this system operation is started7Process Sale: makeNewSaleWe could look to the Domain Model, and consider Store or Register. We could also create a special handler class to deal with this use caseSince this use case has few system operations, defining a new handler class is probably not needed – we can use an existing Domain Object without overloading it (losing cohesion)Defining a Register software object makes sense, since it can handle the few system operations, and is related to the Domain Model object that hosts the softwareSo we have decided that there will be a Register object, and this object will handle the responsibility of processing the makeNewSale system operation - we have made our first design decision!8Process Sale: makeNewSaleNote the operation contract mentions that a new Sale object is created; applying the GRASP Creator principle, we look to find an object that can contain, aggregate, or record the SaleAgain, looking in the Domain Model, it appears the Register object meets the need (a register literally means to “register” sales)Also recall that the Sale object was a composite of SalesLineItem objects in the Domain ModelAt this point, we can decide to initialize an (empty) collection of SalesLineItem objects, to be filled in later as the sale is processedAgain, the Creator principle implies that the Sale object is the likely creator for this list …910:RegistermakeNewSale:SalecreateRegister creates a Sale by CreatorcreatelineItems :List<SalesLineItem>by Creator, Sale creates an empty collection (such as a List) which will eventually hold SalesLineItem instancesby Creator and Controllerthis execution specification is implied to be within the constructor of the Sale instanceProcess Sale: enterItemThis system operation occurs when the Cashier enters an itemID and possibly a quantity for an item in the sale. The postconditions in the operations contract were:-A SalesLineItem instance sli was created-sli was associated with the current Sale-sli.quantity became quantity-sli was associated with a ProductDescription, based on itemID matchWe will now walk through the design decisions required to handle this system operation11Process Sale: enterItemController: Based upon what we decided earlier, the Register will handle this incoming messageNote the original use case mentioned that the description and price for the item are displayedBy Model-View separation, we generally do not allow Domain Objects to be involved in output tasks, so we will not worry about this requirement right nowOperations Contract states that a new SalesLineItem is createdBased upon the Domain Model, it appears that the Sale object would be the likely candidate to create the new SalesLineItemPostcondition implies that SalesLineItem needs a quantity when created, and this is derived from the original system operation (input by Cashier)Register must pass this parameter to Sale, which must pass it in the creation message to SalesLineItem12Process Sale: enterItemNote that we also need to associate a ProductDescription with this item, based upon the itemID entered by the Cashier and included in the system operation handled by the RegisterWho should do the lookup – who gets this responsibility? I.e., who should have the responsibility for knowing a ProductDescription based on an itemID match?This is an application of the Expert GRASP principleQuestion: Who knows the most about the ProductDescription


View Full Document

UT Dallas CS 6359 - S18_Chapter_18

Documents in this Course
Lecture2

Lecture2

63 pages

Lecture3

Lecture3

49 pages

Lecture4

Lecture4

48 pages

Lecture5

Lecture5

47 pages

Lecture6

Lecture6

45 pages

Lecture7

Lecture7

63 pages

Lecture8

Lecture8

77 pages

Lecture9

Lecture9

48 pages

Lecture10

Lecture10

84 pages

Lecture11

Lecture11

45 pages

Lecture12

Lecture12

134 pages

Lecture13

Lecture13

62 pages

Lecture14

Lecture14

76 pages

Project

Project

2 pages

Chapter_1

Chapter_1

25 pages

Load more
Download S18_Chapter_18
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view S18_Chapter_18 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view S18_Chapter_18 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?