Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation...

19

Click here to load reader

description

3 T. H. Kolbe – Geoinformation Technology: lecture 2 Department of Geoinformation Science WS 2006/07 OO: Example #1 for generalization, specialization  „staff_member“ is a more general concept as „non_ research_associate“, „research_associate“ or „professor“  „staff_member“ is the superclass  „non_ research_associate“, „research_associate“, and „professor“ are subclasses staff_member research_associateprofessornon_ research_associate

Transcript of Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation...

Page 1: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

Department of Geoinformation Science

Technische Universität Berlin

WS 2006/07

Geoinformation Technology: lecture 2 (b)

Object Modeling

Prof. Dr. Thomas H. Kolbe

Institute for Geodesy and Geoinformation ScienceTechnische Universität Berlin

Credits: This material is mostly an english translation of the course module no. 2 (‘Geoobjekte und ihre Modellierung‘) of the open e-content platform www.geoinformation.net.

Page 2: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/072 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Generalization Specialization

Abstraction principle for the hierarchical structuring of a model

a specialized class concretises a more general class by adding specific properties;

the general class is called superclass, the specialized class subclass;

one superclass can have different subclasses

also: one subclass can have different superclasses (alsocalled parent classes)

general class

specialized class

generalization specialization

Page 3: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/073 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

OO: Example #1 for generalization, specialization

„staff_member“ is a more general concept as „non_ research_associate“, „research_associate“ or „professor“

„staff_member“ is the superclass

„non_ research_associate“, „research_associate“, and „professor“ are subclasses

staff_member

research_associate professornon_ research_associate

Page 4: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/074 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

OO: Example #2 for generalization, specialization

geometrical figure

circle rectangle triangle

„geometrical figure“ is a more general concept than „triangle“, „circle“ or „rectangle“

Page 5: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/075 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Taxonomy

generalization and specialization describe a taxonomical (i.e. systematic) relationship between general and specific concepts

Example: Taxonomy of flies with two wings (from biology)

Diptera – Flies (with two wings)

Brachycera - flies

Nematocera - mosquito

Orthorrhapha

Cyclorrhapha

Aschiza

Schizophora

Acalyptratae

Calyptratae

Page 6: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/076 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Aggregation vs. Generalization

What is the difference between an aggregation and a generalization?

aggregation and generalization build hierarchies, but : aggregation relates objects generalization relates classes Please note the systematic difference between following

relationships University – Faculty (aggregation of objects) Rectangle – Figure (generalization of the same object)

Page 7: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/077 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Inheritance and specialization (I)

A superclass represents a concept.

A subclass specializes this concept, such that that it

explicitly adopts the attributes of the superclass Inheritance of properties

explicitly adopts or overrides methods of the superclass Inheritance of the behavior

defines new attributes

defines new methods

Page 8: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/078 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Example #1 for Inheritance

student- name

- first name

- registration number

- subject

- address

- date of birth

- registration-date

- Bachelor

- Master

staff member- name

- first name

- personnel number

- institute

- address

- date of birth

- bank account no.

- salary

Page 9: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/079 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Example #1 for Inheritance

student- registration number

- subject

- registration-date

- . . .

staff member- personnel number

- bank account no.

- salary

- . . .

person- name- first name- address- date of birth

Page 10: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0710 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Example #2: Overriding

geometrical figure

circle rectangle triangle

-center: Point -visible: Boolean

+display ( )+delete ( )+move ( )

-a: number-b: number-c: number

+display ( )+delete ( )

-a: number-b: number

+display ( )+delete ( )

-radius: number

+display ( )+delete ( )

Page 11: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0711 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Inheritance and specialization (II)

subclasses differ systematically wrt. each other

attributes and methods of a class represent a self-contained concept

the specialized class is fully compatible to the general class

attributes and methods of the superclass do not have to be repeated in the specification of the subclass(es)

geometrical figure

circle rectangle triangle

-center: Point -visible: Boolean

+display( )+delete( )+move( )

-a: number-b: number-c: number

+display ( )+delete ( )

-a: number-b: number

+display ( )+delete ( )

-radius : number

+display( )+delete( )

Page 12: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0712 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Object-orientation: Polymorphism

congeneric (similar) methods, that are to be executed on objects of different classes, can be named with the same identifier

when calling such a method, the (most) object-specific one is activated in each case

advantage of the polymorphism: specific objects can be handled in a general way

triangles, circles, and rectangles can be treated as geometrical figures

geometrical figure

circle rectangle triangle

-center: Point -visible: Boolean

+display ( )+delete ( )+move ( )

-a: number-b: number-c: number

+display( )+delete( )

-a: number-b: number

+display ( )+delete ( )

-radius : number

+display ( )+delete ( )

Page 13: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0713 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2 with spatial reference

Page 14: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0714 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2: state - district - municipality - parcel

state district

municipalityproperty

1..* -name: string -inhabitants: number -area: number

+getname( ): name+getinhabitants( ):number+getarea( ): number

-name: string -inhabitants: number -area: number

+getname( ): string+getinhabitants( ):number+getarea( ): number

-owner: Person -area: number

+getowner( ): Person+getarea( ): number

-name: string -inhabitants: number -area: number

+getname( ): string+getinhabitants( ):number+getarea( ): number

Declare the attributes Declare the methods Name the relationships

Declare the multiplicities

1..* 1..*

Page 15: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0715 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2: property - parcel - polygon

Can this subdivision of space can be extended further than "property"?

at first:

transition from the legal object "property" to the geometrical object "polygon"

property parcel polygon1 . . n

geometry

Page 16: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0716 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2: Topological relationships of polygons

face

nodeedge

bounds

bounds

Page 17: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0717 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2: polygon – edge – node - point

polygon edge

point node

1..2 3 . . *

2 . . *

1 12

bounds

bounds

geometry

Declare the multiplicitys and names Name the relationships

Page 18: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0718 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Example #2: Class ‘point‘

point- latitude: degree - longitude: degree - X: number- Y: number- projection: text - registration: text=“GPS“ - registration-date: date

+ getlatitude( ) : degree + getlongitude( ) : degree + setlatitude(lat: degree) + setlongitude(lon: degree) + getX( ) : number+ getY( ) : number+ . . .

Page 19: Department of Geoinformation Science Technische Universitt Berlin WS 2006/07 Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas.

WS 2006/0719 T. H. Kolbe – Geoinformation Technology: lecture 2

Department of Geoinformation Science

Data Modelling Literature

Balzert, Heide: Lehrbuch der Objektmodellierung. Akademischer Verlag, 1999

Oestereich, Bernd: Objektorientierte Softwareentwicklung: Analyse und Design mit der Unified Modeling Language. 4. Auflage - Oldenbourg, München Wien, 1998

(english titles will be added soon)