1 Tony Busker [email protected] Object Oriented Software Development 1.

39
1 Tony Busker [email protected] Object Oriented Software Development 1

Transcript of 1 Tony Busker [email protected] Object Oriented Software Development 1.

Page 1: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

1

Tony Busker

[email protected]

Object Oriented Software Development 1

Page 2: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

2

Ervaring: 25 jaar ervaring in (technische) software ontwikkeling in de grafische industrie (productieautomatisering, beveiliging, publishing, ...)

Rollen: architect, senior system ontwerper, coach, consultant, projectleider, ...

Ervaring

Page 3: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

3

Agenda

The capsizing of the warship Vasa

Object-Oriented topics

Objects and Classes

Concept Mapping

The Golden Hammer

Page 4: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

4

The ‘Vasa’ disaster (1) - bouw

The armament of 64 guns of 24 pounds made the Vasa the most

powerful ship of her time

In 1625, the Swedish King Gustavus ordered the Dutch shipwright Hendrick Hybertsz to build a large warship. The Vasa, a 64-gun warship was built in Stockholm and launched in 1628. The dimensions of the ship were 47,7 × 11,2 × 4,8 m.

Page 5: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

5

The ‘Vasa’ disaster (2) - capsizing

The Vasa is infamous, however, because it sank on

its maiden voyage without ever leaving the harbor

The Vasa fired his salute...

Page 6: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

6

The Vasa was recovered almost completely intact 333 years later.

The Vasa (3) - recovery

Page 7: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

7

The ‘Vasa’ disaster (4) restoration

After 30 years of restoration, the entire ship is now on display in

Stockholm.

Examples of the extravagant decoration of the Vasa

Page 8: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

8

The ‘Vasa’ disaster (5) lessons learned

No documented user requirements

Difficulties in dealing with changing requirements

Don’t know how to say ‘no’ to a customer

Inadequate testing procedure

Too much attention for details

Unexpected longer lifecycle of the product

A model of the Vasa

Page 9: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

9

Why is software difficult to handle?

Difficult and complex to construct

Impossible for the individual developer to comprehend all the subtleties of its design

Future users and customers have a hard time fully accurately specifying system requirements

Difficult to manage ‘drifting’ requirements

Page 10: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

10

The illusion of simplicity

Problemdomain

Solutiondomain

Page 11: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

11

Large software systems generally exceeds the human intellectual capacity

Complexity

Traditional and ad hoc software designmethodologies do not minimize complexity

We are forced to consider more disciplined ways to master complexity

Page 12: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

12

Object Orientation is a technology that enables us to implement good software

practices

Data Hiding Modelling

Major characteristics of Object Technology

From Chaos to Classes

Page 13: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

13

Object-oriented topics

Complexity Information hiding Hierarchy Decomposition What is a class? What is an object ?

Page 14: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

14

Why is software often complex?

Complexity of the problem domain, and therefore, to manage the system requirements

Difficulty of managing the development process

The flexibility that is possible through software

The problems associated with the characterizing the behaviour of discrete systems

Page 15: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

15

How to deal with complexity (1)

First step in attacking unrestrained complexity

Discover the relevant abstractions in the problem domain

Page 16: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

16

Information Hiding principle

Encapsulate details by providing barriers among different abstractions

Page 17: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

17

How to deal with complexity (2)

Second step in attacking unrestrained complexity

Discover the important hierarchies in the problem domain

Page 18: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

18

‘Part Of’ Hierarchy

Most complex systems can be decomposed into a hierarchy of parts

aircraft

engine wing tail

compressor combustor turbine

blade shaft

Page 19: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

19

‘Is a’ Hierarchy

Most systems can also be decomposed into a series of hierarchies that emphasize the relationships between internal system components

engine

jet propeller rocket

ramjet turbofan

Pratt & Whitney General Electric

Page 20: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

20

How to deal with complexity (3)

Third step in attacking unrestrained complexity

Decomposition into a collection of objects that cooperate to achieve some desired functionality

Page 21: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

21

Procedural decomposition

Breaking down the problem into a large number of communicating procedures

Rapid increase of complexity

P1

P3

P2

P4

P5P6

D1D2

P7

Page 22: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

22

Object-Oriented decomposition

Breaking down the problem into a number of objects that communicate through well-defined interfaces

Slow increase of complexity

O1

O3O4

O2

Page 23: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

23

Formal Definition of An Object

An object has state, behavior and identity; the structure and behavior of similar objects are defined in their common class

Formal Definition of An Object

An object has state, behavior and identity; the structure and behavior of similar objects are defined in their common class

Objects are tangible, unique entities that exhibit some well-defined behavior

What is an object ?

Page 24: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

24

What is a class?

A class represents a set of objects that share a common structure and a common behavior

Page 25: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

25

The problem domain

The solution domain

Where are the objects coming from?

Page 26: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

26

Concept Maps

Software engineers

Domain expertsFuture users

Simple & effective medium toexpress ideas and share concepts

ManagersSystem Architects

Page 27: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

27

Simple and attractive means of finding the key concepts andthe relationships between them.

Verification of requirements

Understanding the domain

Finding candidate (sub)components & classes, and the relationships between them

Relations between key concepts

Page 28: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

28

What is a concept?

A concept is an idea or notion we have of the problem domainA concept is an idea or notion we have of the problem domain

Each concept has a label

The concept ‘car’ is a label which is usedto represent an object which has four wheels, an engine and a steering wheel.

Page 29: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

29

Different kind of concepts

Concreet

ongrijpbaar

Event Rol

autoproject

database update lezer

Page 30: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

30

Meaningful relationships

A proposition consists of two or moreconcepts which are linked togetherA proposition consists of two or moreconcepts which are linked together

‘A reader is interested in a journal’

‘A division consists of departments’

‘The project has a project leader’

‘A car is a vehicle’

Page 31: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

31

Concepts and Links

Simple concepts and links:

reader

journal

is interested in

carproject

has a

projectleader

vehicle

is a

Concepts correspond to nounsLinks correspond to verbsConcepts correspond to nounsLinks correspond to verbs

Page 32: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

32

projects

ICT

systemdesigner

professionals

Vitatron DA+

have

such as

works for

such as

development team

realized by

is part of

supports

takes part in

consists of

Invoking several concepts

Page 33: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

33

A concept map is like a roadmap.It shows some of the routes that connectconcepts in order to give a meaningfulrepresentation of the domain

A concept map is like a roadmap.It shows some of the routes that connectconcepts in order to give a meaningfulrepresentation of the domain

Gives focus on the essence of a problem

Helps in validation of requirements

Prevents ‘analysis paralysis’

Common ground for understanding among stakeholders

Domain representation

Page 34: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

35

Levels of AbstractionHint 1: Create a glossary, especially

covering ambiguous terms

Hint 2: Choosing good names for links and concepts right from the start is very important!

Hint 3: Use different colors or variable thickness of ovals to indicate the level of abstraction

Hint 4: For ease of survey, use ‘nested’ concept maps for complex problem domains

Concept hierarchy

Supporting concepts

Specific concepts

Key concepts

Page 35: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

36

Front-end to OO Development

Three types of links : projection links (‘get’, ‘display’, ‘move’) abstraction links (‘is a’, ‘can be’, ‘such as’) partitioning links (‘consists of’, ‘has’, ‘is part of’)

Concepts are (potential) classes or componentsLinks describes the relationship between them

Page 36: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

37

The Basis of the Object Model

Concept map

Concepts

Projection links

Abstraction links

Partitioning links

Object model

Components, Objects, Events

Object Operations

Inheritance Relationships

Aggregation Relationships

Page 37: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

44

Anti-Patterns: Golden Hammer

The Golden Hammer anti-pattern (also known as ‘Head-in-the-sand’) occurs when a developer uses favorite software concepts or tools obsessively.

When your only tool is a hammer, everything else is a nail!

Page 38: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

45

Anti-Patterns: Golden Hammer

The Golden Hammer may result in the misapplication of a favored tool or concept.

Anecdotal evidence: ‘Our database is our architecture’

Page 39: 1 Tony Busker a.l.j.busker@hro.nl Object Oriented Software Development 1.

46

Anti-Patterns: Golden Hammer

A common variation of Golden Hammer occurs when designers learn a single design methodology or a few design patterns and apply them excessively to all phases of software analysis, design and implementation.

Expand your horizon!