Download presentation
Presentation is loading. Please wait.
1
Mapping Designs to Code
Chapter 20 Mapping Designs to Code Beware of bugs in the above code. I have only proved it correct, not tried it. Donald Knuth CS6359 Fall 2011 John Cole
2
Implementation Model This is the actual program: source code, database definitions, JSP, ASP, etc. Code is not part of OOAD, it is the goal Modern tools permit much design while programming. CS6359 Fall 2011 John Cole
3
Creativity and Change “Mere coders…”
Your design is a necessary first step, but design models and class diagrams are incomplete Your understanding of the domain generated during the process provide the basis for writing code (How does this apply to the DB project?) CS6359 Fall 2011 John Cole
4
Classes from Design Class Diagrams
Some UML tools will generate the basic class structure from your class diagrams You can easily derive your class in Java, C#, etc from a class diagram CS6359 Fall 2011 John Cole
5
SalesLineItem Example
CS6359 Fall 2011 John Cole
6
Methods from Interaction Diagrams
CS6359 Fall 2011 John Cole
7
Methods from Interaction Diagrams
CS6359 Fall 2011 John Cole
8
Collection Classes in Code
One-to-many relationships may require collections. The text shows: private List lineItems = new ArrayList(); This is probably better: private ArrayList<LineItem> lineItems = new ArrayList<LineItem>(); CS6359 Fall 2011 John Cole
9
Exception and Error Handling
This is too often ignored in the design Consider large-scale strategy Communication failure “hard” errors Consider case-by-case strategy What if the record we “know” is there is not found What if there is bad data In UML, errors can be property strings of messages CS6359 Fall 2011 John Cole
10
Order of Implementation
From least-coupled to most-coupled (why?) CS6359 Fall 2011 John Cole
11
Order of Implementation
CS6359 Fall 2011 John Cole
12
Test-Driven Development
Create your unit tests before you write the code Test boundary conditions CS6359 Fall 2011 John Cole
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.