Created for ENMU Tutoring/Supplemental Instruction Huff Fall 2011 By Jessica Huff.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
-
Upload
baldwin-collins -
Category
Documents
-
view
212 -
download
0
description
Transcript of Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
UML Diagrams
Object Oriented Programming and Data AbstractionEarl HuffRowan 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.
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
UML Building Blocks
ThingsRelationshipsDiagrams
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.
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).
Relationships
Dependency
Association
Generalization
Realization
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
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.
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.
Class Notations
Access modifiers+ public- private# protected
Field syntax in UMLVisibility name of field : data type- year : int
Class Notations
Method syntax in UML:Visibility method name(parameter name : data type) : return type+ getInterest(balance:double,rate:double) : double
Class Notations
Example
Class Diagram Example
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.
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.
Utilities and Tools
StarUMLhttp://staruml.io/
ArgoUMLhttp://argouml.tigris.org/
NetBeans easyUML pluginhttp://plugins.netbeans.org/plugin/55435/easyuml