SlideShare a Scribd company logo
Mapping Designs to
Mapping Designs to
Code
Code
Larman, Chapter 20
Larman, Chapter 20
CSE432
CSE432
Object Oriented Software
Object Oriented Software
Engineering
Engineering
OO development is iterative
OO development is iterative
 OOA/D artifacts feed into implementation
OOA/D artifacts feed into implementation
model in a traceable manner
model in a traceable manner
 Some tools generate partial code from UML
Some tools generate partial code from UML
 But programming not trivial generation!
But programming not trivial generation!
 Programmers make changes as the work
Programmers make changes as the work
out the details
out the details
 Therefore, Expect and plan for change and
Therefore, Expect and plan for change and
deviation from design during programming
deviation from design during programming
Mapping Designs to Code
Mapping Designs to Code
 Write source code for:
Write source code for:
– Class and interface definitions
Class and interface definitions
– Method definitions
Method definitions
 Work from OOA/D artifacts
Work from OOA/D artifacts
– Create class definitions for Domain Class
Create class definitions for Domain Class
Diagrams (DCDs)
Diagrams (DCDs)
– Create methods from Interaction diagrams
Create methods from Interaction diagrams
From DCD to Java class
From DCD to Java class
public class SalesLineItem
{
private int quantity;
private ProductDescription description;
public SalesLineItem(ProductDescription desc, int qty) { ... }
public Money getSubtotal() { ... }
}
SalesLineItem
quantity : Integer
getSubtotal() : Money
ProductDescription
description : Text
price : Money
itemID : ItemID
...
1
description
Fig. 20.1
Fig. 20.1
From Interaction diagram to method
From Interaction diagram to method
Fig. 20.4
Fig. 20.4
2: makeLineItem(desc, qty)
enterItem(id, qty)
1: desc := getProductDescription(id)
:Register :Sale
:Product
Catalog
{
ProductDescription desc = catalog.ProductDescription(id);
currentSale.makeLineItem(desc, qty);
}
Collection classes
Collection classes
SalesLineItem
quantity : Integer
getSubtotal()
1..*
Sale
isComplete : Boolean
time : DateTime
becomeComplete()
makeLineItem()
makePayment()
getTtotal()
public class Sale
{
...
private List lineItems = new ArrayList();
}
A collection class is necessary to
maintain attribute visibility to all the
SalesLineItems.
lineItems
Fig. 20.5
Fig. 20.5
What collection class has been added to the design and why?
Exception handling
Exception handling
 Why is it wise to consider large-scale
Why is it wise to consider large-scale
exception handling strategies during
exception handling strategies during
design modeling?
design modeling?
 In UML, exceptions can be inserted as
In UML, exceptions can be inserted as
property strings of messages
property strings of messages
Why implement from least-coupled
Why implement from least-coupled
to most-coupled?
to most-coupled?
SalesLineItem
quantity : Integer
getSubtotal()
ProductCatalog
...
getProductDesc(...)
ProductDescription
description : Text
price : Money
itemID : ItemID
...
Store
address : Address
name : Text
addSale(...)
Payment
amount : Money
...
1..*
1..*
Register
...
endSale()
enterItem(...)
makeNewSale()
makePayment(...)
Sale
isComplete : Boolean
time : DateTime
becomeComplete()
makeLineItem(...)
makePayment(...)
getTotal()
...
1
1
1
1
1
1
*
1
2
3
4
5
6
7
Fig. 20.7
Fig. 20.7

More Related Content

PPT
Week3 to-design
PPT
Object Oriented Analysis and Design with UML2 part2
PPT
(OOAD) UML Slides
PPT
Object oriented analysis and design. SE 221
PPT
Object Oriented Design
PPT
Object Oriented Design
PPT
UML and You
Week3 to-design
Object Oriented Analysis and Design with UML2 part2
(OOAD) UML Slides
Object oriented analysis and design. SE 221
Object Oriented Design
Object Oriented Design
UML and You

Similar to 11MappingDesigntoCode.ppt ooad software software (20)

PDF
OOM Unit I - III.pdf
PPTX
5-Oject Design & Mapping on Code__ .pptx
PDF
Oo aand d-overview
PPT
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
PDF
DOC
Onlineshoppingonline shopping
DOC
Onlineshopping 121105040955-phpapp02
PPT
Chapter20 object oriented analysis and design
PDF
CS8592-OOAD Lecture Notes Unit-2
PPT
Unit-1 OOMD- Inthhro- class modeling.ppt
PPTX
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
PPT
Software System Engineering - Chapter 10
PPTX
11 topic 9 ooa
PPTX
Software Engineering and Project Management - Introduction, Modeling Concepts...
PPT
Object oriented analysis_and_design_v2.0
PPTX
Object Oriented Analysis and Design - OOAD
PDF
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
PPT
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
PPTX
Object Oriented System Design
OOM Unit I - III.pdf
5-Oject Design & Mapping on Code__ .pptx
Oo aand d-overview
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
Onlineshoppingonline shopping
Onlineshopping 121105040955-phpapp02
Chapter20 object oriented analysis and design
CS8592-OOAD Lecture Notes Unit-2
Unit-1 OOMD- Inthhro- class modeling.ppt
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
Software System Engineering - Chapter 10
11 topic 9 ooa
Software Engineering and Project Management - Introduction, Modeling Concepts...
Object oriented analysis_and_design_v2.0
Object Oriented Analysis and Design - OOAD
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
Object Oriented System Design
Ad

More from kavitamittal18 (20)

PPT
awt.ppt java windows programming lecture
PPT
ejb.ppt java lecture notes enterprise java
PPT
pptTopic2IntroductionToJavaProgramming.ppt
PPT
11MappingDesigntoCode.ppt Software engineering
PPT
UseCase.ppt software engineering use3 cases
PPT
Introduction.ppt wireless
PPT
CellularNetworks.ppt ppt
PPTX
Dr.C S Prasanth-Physics ppt.pptx computer
PPT
CSL101_Ch1.ppt Computer Science
PPT
maincse-150510153437-lva1-app68Computer Science92.ppt
PPT
Programming language basics.ppt Computer Science
PPT
02-chapter-1.ppt programming languages 10
PPT
CS553_ST7_Ch14-CellularWirelessNetworks.ppt
PPT
Lec7!JavaThreads.ppt java multithreading
PPT
JDBC.ppt database connectivity in java ppt
PPT
chapter7.ppt java programming lecture notes
PPT
09slide.ppt oops classes and objects concept
PPT
480 GPS Tech mobile computing presentation
PPT
gsm-archtecture.ppt mobile computing ppt
PPT
AdHocTutorial.ppt
awt.ppt java windows programming lecture
ejb.ppt java lecture notes enterprise java
pptTopic2IntroductionToJavaProgramming.ppt
11MappingDesigntoCode.ppt Software engineering
UseCase.ppt software engineering use3 cases
Introduction.ppt wireless
CellularNetworks.ppt ppt
Dr.C S Prasanth-Physics ppt.pptx computer
CSL101_Ch1.ppt Computer Science
maincse-150510153437-lva1-app68Computer Science92.ppt
Programming language basics.ppt Computer Science
02-chapter-1.ppt programming languages 10
CS553_ST7_Ch14-CellularWirelessNetworks.ppt
Lec7!JavaThreads.ppt java multithreading
JDBC.ppt database connectivity in java ppt
chapter7.ppt java programming lecture notes
09slide.ppt oops classes and objects concept
480 GPS Tech mobile computing presentation
gsm-archtecture.ppt mobile computing ppt
AdHocTutorial.ppt
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Well-logging-methods_new................
PPT
Project quality management in manufacturing
PPTX
Artificial Intelligence
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
additive manufacturing of ss316l using mig welding
DOCX
573137875-Attendance-Management-System-original
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Internet of Things (IOT) - A guide to understanding
R24 SURVEYING LAB MANUAL for civil enggi
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Well-logging-methods_new................
Project quality management in manufacturing
Artificial Intelligence
Operating System & Kernel Study Guide-1 - converted.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
OOP with Java - Java Introduction (Basics)
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Construction Project Organization Group 2.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Foundation to blockchain - A guide to Blockchain Tech
additive manufacturing of ss316l using mig welding
573137875-Attendance-Management-System-original
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Model Code of Practice - Construction Work - 21102022 .pdf
Internet of Things (IOT) - A guide to understanding

11MappingDesigntoCode.ppt ooad software software

  • 1. Mapping Designs to Mapping Designs to Code Code Larman, Chapter 20 Larman, Chapter 20 CSE432 CSE432 Object Oriented Software Object Oriented Software Engineering Engineering
  • 2. OO development is iterative OO development is iterative  OOA/D artifacts feed into implementation OOA/D artifacts feed into implementation model in a traceable manner model in a traceable manner  Some tools generate partial code from UML Some tools generate partial code from UML  But programming not trivial generation! But programming not trivial generation!  Programmers make changes as the work Programmers make changes as the work out the details out the details  Therefore, Expect and plan for change and Therefore, Expect and plan for change and deviation from design during programming deviation from design during programming
  • 3. Mapping Designs to Code Mapping Designs to Code  Write source code for: Write source code for: – Class and interface definitions Class and interface definitions – Method definitions Method definitions  Work from OOA/D artifacts Work from OOA/D artifacts – Create class definitions for Domain Class Create class definitions for Domain Class Diagrams (DCDs) Diagrams (DCDs) – Create methods from Interaction diagrams Create methods from Interaction diagrams
  • 4. From DCD to Java class From DCD to Java class public class SalesLineItem { private int quantity; private ProductDescription description; public SalesLineItem(ProductDescription desc, int qty) { ... } public Money getSubtotal() { ... } } SalesLineItem quantity : Integer getSubtotal() : Money ProductDescription description : Text price : Money itemID : ItemID ... 1 description Fig. 20.1 Fig. 20.1
  • 5. From Interaction diagram to method From Interaction diagram to method Fig. 20.4 Fig. 20.4 2: makeLineItem(desc, qty) enterItem(id, qty) 1: desc := getProductDescription(id) :Register :Sale :Product Catalog { ProductDescription desc = catalog.ProductDescription(id); currentSale.makeLineItem(desc, qty); }
  • 6. Collection classes Collection classes SalesLineItem quantity : Integer getSubtotal() 1..* Sale isComplete : Boolean time : DateTime becomeComplete() makeLineItem() makePayment() getTtotal() public class Sale { ... private List lineItems = new ArrayList(); } A collection class is necessary to maintain attribute visibility to all the SalesLineItems. lineItems Fig. 20.5 Fig. 20.5 What collection class has been added to the design and why?
  • 7. Exception handling Exception handling  Why is it wise to consider large-scale Why is it wise to consider large-scale exception handling strategies during exception handling strategies during design modeling? design modeling?  In UML, exceptions can be inserted as In UML, exceptions can be inserted as property strings of messages property strings of messages
  • 8. Why implement from least-coupled Why implement from least-coupled to most-coupled? to most-coupled? SalesLineItem quantity : Integer getSubtotal() ProductCatalog ... getProductDesc(...) ProductDescription description : Text price : Money itemID : ItemID ... Store address : Address name : Text addSale(...) Payment amount : Money ... 1..* 1..* Register ... endSale() enterItem(...) makeNewSale() makePayment(...) Sale isComplete : Boolean time : DateTime becomeComplete() makeLineItem(...) makePayment(...) getTotal() ... 1 1 1 1 1 1 * 1 2 3 4 5 6 7 Fig. 20.7 Fig. 20.7