• Keine Ergebnisse gefunden

Software Engineering for Engineers

N/A
N/A
Protected

Academic year: 2022

Aktie "Software Engineering for Engineers"

Copied!
21
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Software Engineering for Engineers

Lecture 1: UML Class Diagrams

(2)

Outline

•  What is UML and why do we use it?

•  UML Class Diagram

–  Associations –  Inheritance –  UML to Java

(3)

UML

Where are we?

Requirements Elicitation Requirements

Analysis System Design

Object Design Implementation

Testing

Techniques, Methods and Tools

(4)

What is UML?

•  UML (Unified Modeling Language)

–  Convergence of notations used in object-oriented methods

•  OMT (James Rumbaugh and colleagues)

•  Booch (Grady Booch)

•  OOSE (Ivar Jacobson)

•  Current version 2.1.2

–  Information at the UML portal http://www.uml.org/

•  Commercial CASE tools: Rational Rose (IBM), Together (Borland), Visual Architect (business processes, BCD)

•  Open Source CASE tools: ArgoUML, StarUML, Umbrello, Unicase

•  Commercial as well as Open Source: PoseidonUML (Gentleware)

(5)

We use Models to describe Software Systems

•  System model: Object model + functional model + dynamic model

•  Object model: What is the structure of the system?

–  UML Notation: Class diagrams

•  Functional model: What are the functions of the system?

–  UML Notation: Use case diagrams

•  Dynamic model: How does the system react to external events?

–  UML Notation: Sequence, State chart and Activity diagrams

(6)

Another view on UML Diagrams

(7)

Where are we now?

 What is UML and why do we use it?

•  UML Class Diagram

–  Associations –  Inheritance –  UML to Java

(8)

From an image to an Object Diagram

ClientA:Client

ClientB:Client

ServerA:Server ClientA

ClientB

ServerA

(9)

From an Object Diagram to a Class Diagram

ClientA:Client

ClientB:Client

ServerA:Server

Client * 1

Server

(10)

1-to-1 and 1-to-many Associations

Name: String

Country

Name: String

Capital

1-to-1 association

1 1

Polygon

draw()

x: Integer x: Integer

Point

1-to-many association

1 *

(11)

Many-to-many Associations

Stock Exchange

*

tickerSymbol

Company

*

•  A stock exchange lists many companies.

•  Each company is identified by a ticker symbol

(12)

Part-of Hierarchy (Aggregation)

Computer

Memory CPU

I/O Devices

Program Counter ALU

Cache

•  An aggregation is a special case of association denoting a “consists-of” hierarchy

•  The aggregate is the parent class, the components are the children classes

(13)

Composition

•  A solid diamond denotes composition: A strong form of aggregation where the life time of the component instances is controlled by the aggregate (“the whole controls/destroys the parts”)

Ticket Machine

Zone Button

3

(14)

Is-Kind-of Hierarchy (Taxonomy)

Cell

Pyramidal Cortical

White Red

Smooth Striate

Muscle Cell

Blood Cell

Nerve Cell

(15)

Inheritance

•  Inheritance is another special case of an association denoting a “kind-of”

hierarchy

•  Inheritance simplifies the analysis model by introducing a taxonomy

•  The children classes inherit the attributes and operations of the parent class.

Zone Button Cancel

Button

Button

(16)

Class diagram: Basic Notations

Zone Button Zone

Button

Button *

components

Class diagrams represent the structure of the system

Aggregation

Association End Name (Role) Multiplicity

Inheritance

Class

(17)

Code Generation from UML to Java I

Composite LeafSection

Component *

components

public class Component{ } public class Leaf extends

Component{ }

public class Composite extends Component{

private Collection<Component>

components;

}

(18)

Class diagram: Basic Notations

target: Target

Client

operation()

Target

operation()

Adapter

specificOperation()

AdaptedClass

adaptedObject

Delegation

Operation Attribute

Comment

Association

(19)

Code Generation from UML to Java II

target: Target

Client

operation()

Target

operation()

Adapter

specificOperation()

AdaptedClass

adaptedObject

Delegation

public abstract class Target{

public … operation(); }

public class Adapter extends Target { private AdaptedClass adaptedObject;

public … operation(){

adaptedObject.specificOperation();

}

(20)

Excursion: Packages

•  Packages help you to organize UML models to increase their readability

•  We can use the UML package mechanism to organize classes into subsystems

•  Any complex system can be decomposed into subsystems, where each subsystem is modeled as a package.

Bank Customer Account

(21)

USBHub USBDevice

USBNode *

Referenzen

ÄHNLICHE DOKUMENTE

Operations on software engineering databases then amount to graph operations, which can involve documents, versions, configurations, or an entire database..

Due to the sluggish behavior of the West-German labor market, large percentage changes in the underlying transition rates (represented by large percentage changes in the steady

complete set of test cases, guidelines for refactoring Output: clean code which passes the test Description: If not all tests have been covered, students go back to step

In this paper we discuss communication and knowledge sharing in software engineering and introduce an ap- proach to support social software engineering by microblogging.. This

Dynamic growth of data structures: The enterprise model in the example is gradu- ally extended, as more data is added and linked to existing data.. Corresponding sys- tems

Indeed, in the mountainous region of mainland Southeast Asia, expansion of the area under natural forests is probably not a realistic option except in areas protected by

Based on field visits to two UN missions, the UN Mission in South Sudan (UNMISS) and the UN Stabilization Mission in Haiti (MINUSTAH), the report then outlines a number

The starting distribution in the length classes of the matrix model is derived from average catch- 123 . per-unit effort data of the length-frequency distribution in gillnet