object oriented programming and data abstraction earl huff rowan university

17
UML Diagrams Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Upload: baldwin-collins

Post on 20-Jan-2018

212 views

Category:

Documents


0 download

DESCRIPTION

A conceptual model is a model which is made up of concepts and their relationships. The first step before drawing a UML diagram. Helps to understand the entities in the real world and how they interact with one another Three major elements of a conceptual model Building blocks Rules for connecting the building blocks Common mechanisms

TRANSCRIPT

Page 1: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

UML Diagrams

Object Oriented Programming and Data AbstractionEarl HuffRowan University

Page 2: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

What is UML?

Stands for Unified Modeling LanguageA standard language for specifying, constructing, and documenting artifacts of software systems.Not a programming language like Java or C++.A general purpose visual modeling language.Can be used to model software and non-software systems.

Page 3: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Conceptual Model of UML

A conceptual model is a model which is made up of concepts and their relationships.

The first step before drawing a UML diagram.Helps to understand the entities in the real world and how they interact with one another

Three major elements of a conceptual modelBuilding blocksRules for connecting the building blocksCommon mechanisms

Page 4: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

UML Building Blocks

ThingsRelationshipsDiagrams

Page 5: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Things

Things can beStructural

Static part of the model. Represent physical and conceptual elements.

BehavioralDynamic part of the model.Examples: interaction, state machines

GroupMechanism to group elements together.

AnnotationalCapture remarks, descriptions, and comments.

Page 6: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

RelationshipsRelationship shows how elements are associated with each other.Four kinds:

Dependency – change in one element affects the other one.Association – a set of links connecting elements in a model. Describes how many objects are taking part in the relationshipGeneralization – connects a specialized element with a generalized element. Describes inheritance relationship.Realization – two elements are connected in which one element describes some responsibility which is not implemented and the other one implements them (i.e. interfaces).

Page 7: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Relationships

Dependency

Association

Generalization

Realization

Page 8: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

DiagramsThe visual output.All the elements and relationships are used to make a complete UML diagram.Diagram types

Class diagramObject diagramUse case diagramSequence diagramCollaboration diagramActivity diagramStatechart diagramDeployment diagramComponent diagram

Page 9: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Diagrams

The most common diagram used in UML.Consists of classes, interfaces, associations, and collaboration.Only diagram that can be directly mapped with object oriented languages.Represents a static view of an application.Represent object oriented view of a system.Used as part of Object-Oriented analysis and design.

Page 10: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Notations

A typical class diagram is composed of three required sections (optional 4th section)

Top section – contains the name of the class.Second section – shows the attributes of the class.Third section – describes the methods of the class.Fourth section – show any additional components.

Page 11: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Notations

Access modifiers+ public- private# protected

Field syntax in UMLVisibility name of field : data type- year : int

Page 12: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Notations

Method syntax in UML:Visibility method name(parameter name : data type) : return type+ getInterest(balance:double,rate:double) : double

Page 13: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Notations

Example

Page 14: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Class Diagram Example

Page 15: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Object Oriented Analysis and Design

Analysis – investigating the objects.Design – collaboration of identified objects.Purpose

Identification of the objects in a system.Identify the relationshipsCreate a design which can be converted into executables using OO languages.

Page 16: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Object Oriented Analysis and DesignFind the classes

Obtain a written description of the problem domain.Identify all nouns or noun phrases (potential classes).Refine list to include only classes relevant to the problem.

Identify responsibilitiesThings a class is responsible for knowing.Things a class is responsible for doing.Refine list to include only classes relevant to the problem.

Page 17: Object Oriented Programming and Data Abstraction Earl Huff Rowan University

Utilities and Tools

StarUMLhttp://staruml.io/

ArgoUMLhttp://argouml.tigris.org/

NetBeans easyUML pluginhttp://plugins.netbeans.org/plugin/55435/easyuml