Mapping Designs to Code

Slides:



Advertisements
Similar presentations
And so to Code. Forward, Reverse, and Round-Trip Engineering Forward Engineering Reverse Engineering Round-Trip Engineering.
Advertisements

OOD - Principles Design Class Diagrams Chapter 10 pp ; ;
CS 340 UML Class Diagrams. A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction.
Sucha Smanchat  Steps in OOAD using UML  Use Case Diagram  Sequence Diagram / Communication Diagram  Class Diagram  State.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Dr. Kivanc DincerCS319 Week 11 - Nov.21,20051 Chapter 20 Mapping Designs to Code Objectives Map design artifacts to code in an object-oriented language.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
NJIT 1 Mapping Designs to Code Code example: Hemish Kapadia.
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
Object Oriented Analysis and Design Chapter 1 Applying UML and Patterns -Craig Larman.
Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.
Object-Oriented Analysis and Design
Object-Oriented Design. From Analysis to Design Analysis Artifacts –Essential use cases What are the problem domain processes? –Conceptual Model What.
Systems Analysis and Design in a Changing World, Fifth Edition
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Mapping Designs to Code Larman, Chapter 20 CSE432 Object Oriented Software Engineering.
Systems Analysis and Design in a Changing World, 6th Edition
Introduction to Java Class Diagrams. Classes class Account { … } Account.
1. 2 Object-Oriented Concept Class & Object Object-Oriented Characteristics How does it work? Relationships Between Classes Development Tools Advantage.
Chapter 6: Structured Vs. Object Oriented Analysis and Design.
Object-Oriented Analysis and Design An Introduction.
DOMAIN MODE: ASSOCIATIONS, MULTIPLICITY AND ATTRIBUTE-TEXT NOTATION SYS466.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Data Structures Using C++1 Chapter 1 -Software Engineering Principles -ADT and Classes.
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
Copyright © Craig Larman All Rights Reserved The Domain Model.
Domain Model—Part 3: Associations, Multiplicity and Attribute- Text Notation.
1 Today’s Objectives  Announcements Homework #2 is due next Monday, 26-Jun, at the beginning of class Midterm Exam is Monday, 26-Jun – over material in.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
CSE 1301 Lecture 5 Writing Classes Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
Domain Model—Part 2: Attributes.  A logical data value of an object  (Text, p. 158)  In a domain model, attributes and their data types should be simple,
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
Object-Oriented Analysis and Design ธนวัฒน์ แซ่ เอียบ.
Object Oriented Analysis and Design Chapter 1 Applying UML and Patterns -Craig Larman.
CSE 219 Computer Science III UML. UML Diagrams UML - Unified Modeling Language UML diagrams are used to design object-oriented software systems –represent.
TK2023 Object-Oriented Software Engineering CHAPTER 9 INTRODUCTION TO OBJECT DESIGN.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
 Class diagrams show the classes of the system, their interrelationships (including inheritance, aggregation, and association), and the operations and.
Chapter 16 UML Class Diagrams.
OO Methodology Elaboration Phase Iteration 1- Part 3.
OOD - Principles Design Class Diagrams
04 - OOD Intro.CSC4071 Software Design ‘Requirements’ defines –The goals the system needs to satisfy. ‘Specification’ defines –The externally-observable.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
DOMAIN MODEL—PART 2: ATTRIBUTES BTS430 Systems Analysis and Design using UML.
WELCOME TO OUR PRESENTATION UNIFIED MODELING LANGUAGE (UML)
11 Systems Analysis and Design in a Changing World, Fifth Edition.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department UML.
1 Chapter 13: Class Diagram Chapter 19 in Applying UML and Patterns Book.
Mapping Designs to Code. It specify how to map the design into object oriented language The UML artifacts created during the design work, the interaction.
UML Class Diagrams (more notation)
Design Class Diagrams
UML Interaction Diagrams
Chapter 16 UML Class Diagrams.
Chapter 6: Structured Vs. Object Oriented Analysis and Design.
Object Oriented Analysis and Design
The Basics of Class Diagrams for a single class
ניתוח מערכות מידע א' הרצאה 3
Object Oriented Analysis and Design
Chapter 11: Class Diagram
Data Structures and ADTs
Implementation Model: Mapping Designs to Code
Chapter 11: Class Diagram
Design Model: Creating Design Class Diagrams
Presentation transcript:

Mapping Designs to Code Chapter 20 Applying UML and Patterns -Craig Larman

Mapping Designs to Code Process: Write source code for Class and interface definitions Method definitions

Design Class Diagrams DCDs contain class or interface names, classes, method and simple attributes. These are sufficient for basic class definitions. Elaborate from associations to add reference attributes.

Reference Attributes An attribute that refers to another complex objects. Reference Attributes are suggested by associations and navigability in a class diagram. Example: A product specification reference on a Sales Line Item. So here we can use product spec as a complex reference attribute to sales line item class.

Role Names Each end of an association is a role. Reference Attributes are often suggested by role names. (use role names as the names of reference attributes).

Creating methods from Interaction Diagrams Interaction Diagrams are used to specify methods. They give most of the details for what the method does.

Containers and Collections Where an object must maintain visibility to a group of other objects, such as a group of Sales Line Items in a Sale, object-oriented languages often use an intermediate container or collection. These will be suggested by a multiplicity value greater than one on a class diagram.

Working Example: PM User model Project Manager communicates with the Manage Projects use case, or who uses the functionality of the system to manage projects.

PM: Use Case Diagram Manage Projects use case by detailing the functions a Project Manager expects of the system: add project, remove project, update project, assign resource, and un-assign resource.

PM: Class Diagram A project is composed of one or more activities, and an activity is part of a single project. Given a project, we can access its associated activities, and given an activity, we can access its associated project. The composition association, depicted as a filled diamond, indicates that the part (activity) cannot out-live the whole (project). An activity is composed of one or more tasks, and a task may be a part of a single activity. Given an activity, we can access its associated tasks, but given a task, we cannot access its associated activity. Navigability, depicted as an arrow, indicates the supported access path (from an activity to its tasks). Projects, activities, and tasks are all types of work effort, thus, they inherit the characteristics from the Work Effort class. Generalization (inheritance) is depicted using a hollow triangle pointing at the more general class. An activity contains one or more work products (documents, etc.), and a work product may be a part of one or more activities. The aggregation association, depicted as a hollow diamond, indicates that the part (work product) can out-live the whole (activity). A task is associated with one resource (person), and a single resource may be associated with up to five tasks; that is, a person may be assigned up to five tasks. A resource has multiple skills, and multiple resources may have the same skill. When a resource has a particular skill, we maintain the years of experience the resource has with the associated skill. A class, attached to the association by a dashed line, indicates an association class that maintains characteristics including attributes and operations for the association.

PM: Class to Code class WorkPackage; class Project; class Activity; class Task; class WorkProduct; class Resource; class Skill; class ResourceXSkill;

PM: Class to Code class WorkPackage { // Details omitted }; class Project : public WorkPackage { private: CollectionByVal<Activity> theActivity; }; class Activity : public WorkPackage { private: Project *theProject; CollectionByVal<Task> theTask; CollectionByRef<WorkProduct> theWorkProduct; };

PM: DCD Mapping The compartment below the name represents the attributes of the class (name, description, start date, and the number of projects), and the compartment below that represents the operations of the class (constructors, destructor, assessor-operations, load, and save). Notice how the constructors and destructor are identified using the stereotype keyword enclosed in double angle brackets (constructor or destructor), and how visibility is specified using a + symbol for public visibility: - symbol for private visibility, and # symbol for protected visibility. The visibility may also be indicated using a property string after the attribute or operation in curly braces. Also notice, how class-scope (static) attributes and operations are underlined.

PM: DCD Code Date getStartDate (void); class Project { private: char *Name; char *Descr; Date StartDate; static int NumberOfProjects; public: Project (char *Name); Project (void); ~Project (void); char *getName (void); void setName (char *theName); void setDescr (char *Descr); char *getDescr (void); void setStartDate (Date theStartDate); Date getStartDate (void); void addActivity (const Activity &theActivity); CollectionByRef<Activity> getAllAcitivities (void); static int getNumberOfProjects (void); void save (void); void load (char *Name); protected: bool hasActivities (void); }; int Project::NumberOfProjects = 0;

PM: Sequence Diagram

PM: Sequence to Main void main (void) { char *Name; char *Descr; Date StartDate; Project aProject; // provide project Name, descr, and startdate aProject.setName (Name); aProject.setDescr (Descr); aProject.setStartDate (StartDate); aProject.save (); }

Other References http://www.martinig.ch/mt/index.html http://www.sparxsystems.com.au/UML_Tutorial.htm http://archive.devx.com/free/mgznarch/vcdj/1999/jun99/uml1.asp