NJIT 1 Mapping Designs to Code Code example: Hemish Kapadia.

Slides:



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

UML an overview.
Module 8 “Polymorphism and Inheritance”. Outline Understanding Inheritance Inheritance Diagrams Constructors in Derived Classes Type Compatibility Polymorphism.
Further abstraction techniques Abstract classes and interfaces 5.0.
Object Orientated Concepts. Overview  The world is objects  Defining an object  Not a function, it’s a method  Lets inherit want we can  Objects.
Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Mapping Designs to Code
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.
NJIT Use Case Model Operation Contracts Prepared By: Sumit Sharma.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
6/8/991 Analysis Tuesday 09/14/99 Revised: September 11, 2000 (APM)
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
NJIT 1 Domain Model Visualizing Concepts Chapter 9 Applying UML and Patterns Craig Larman.
UML Class Diagram: class Rectangle
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 10: Inheritance 1. Inheritance  Inheritance allows a software developer to derive a new class from an existing one  The existing class is called.
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.
Object Oriented Software Development
Systems Analysis and Design in a Changing World, Fifth Edition
CSE 331 Software Design & Implementation Hal Perkins Autumn 2012 Java Classes, Interfaces, and Types 1.
Mapping Designs to Code Larman, Chapter 20 CSE432 Object Oriented Software Engineering.
Chapter 18 Object Design Examples with GRASP. Objectives Design use case realizations –A use-case realization describes how a particular use case is realized.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
Systems Analysis and Design in a Changing World, 6th Edition
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
Systems Analysis and Design in a Changing World, 3rd Edition
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Simple Classes. ADTs A specification for a real world data item –defines types and valid ranges –defines valid operations on the data. Specification is.
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
Object Oriented Analysis and Design Class and Object Diagrams.
12 OBJECT-ORIENTED DESIGN CHAPTER
Object-Oriented Analysis and Design Week 11, 2009.
Chapter 16: UML Class Diagrams
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Side effects A side effect is anything that happens in a method other than computing and/or returning a value. Example: public class hello { public int.
Chapter 16 UML Class Diagrams.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
OO Methodology Elaboration Phase Iteration 1- Part 3.
OOD - Principles Design Class Diagrams
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
SourceAnatomy1 Java Source Anatomy Barb Ericson Georgia Institute of Technology July 2008.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Interfaces & Abstract Classes (For CS III AP) March 2014.
11 Systems Analysis and Design in a Changing World, Fifth Edition.
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.
Lecture 12 Inheritance.
Design Class Diagrams
Chapter 16 UML Class Diagrams.
Review: Two Programming Paradigms
Wrapper Classes ints, doubles, and chars are known as primitive types, or built-in types. There are no methods associated with these types of variables.
UML Class Diagram: class Rectangle
The Object Oriented Approach to Design
Object Oriented Analysis and Design
Slides by Steve Armstrong LeTourneau University Longview, TX
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
Advanced Java Programming
Chapter 11: Class Diagram
Outline Anatomy of a Class Encapsulation Anatomy of a Method
Implementation Model: Mapping Designs to Code
Chapter 11: Class Diagram
Design Model: Creating Design Class Diagrams
Presentation transcript:

NJIT 1 Mapping Designs to Code Code example: Hemish Kapadia

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

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

4 Reference Attributes Reference Attributes are suggested by associations and navigability in a class diagram. Note that reference attributes may be implied rather than explicit on a class diagram. You may have to ask “How is this association accomplished.” Example: A product specification reference on a Sales Line Item.

5 Role Names Each end of an association is a role. Reference Attributes are often suggested by role names. productSpec Described-by SalesLineItem productSpec Product Specification Description

6 Interaction Diagrams Interaction Diagrams and Operation Contracts are used to specify methods. They give most of the details for what the method does. It is usually best to have a Subject Matter Expert available to answer questions about implementation details.

7 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.

8 Constructors Ask how classes come into existence. Do you need methods in other classes to create them? Example: A sale can create sales line items, and will need a method to do so.

9 Coupling drives code Ideally, least-coupled classes will be created first and most coupled classes last. That way, you can describe the reference attributes as you go instead of going back to revise the class definitions later. Obviously, a class cannot have a major dependency on a class that will be implemented in a later iteration.

10 Working Example: PM

11 PM: Use Case Diagram

12 PM: Class Diagram

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

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

15 PM: DCD Mapping

16 PM: DCD Code 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 getAllAcitivities (void); static int getNumberOfProjects (void); void save (void); void load (char *Name); protected: bool hasActivities (void); }; int Project::NumberOfProjects = 0;

17 PM: Sequence Diagram

18 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 (); }

19 Text reference Note that sample Java code for the POS case study is given in the text on Pages 377 to 380 and for the Monopoly case study on pages 380 to 384. It is suggested that class members review that code and understand how the specification resulted in the code.

20 Other References orial.htm /jun99/uml1.asp