Technische Universitt Berlin Department of Geoinformation Science Geoinformation

Technische Universität Berlin Department of Geoinformation Science Geoinformation Technology: lecture 2 (b) Object Modeling Prof. Dr. Thomas H. Kolbe Institute for Geodesy and Geoinformation Science Technische 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. WS 2006/07

Object-orientation: Generalization Specialization Department of Geoinformation Science 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 general class generalization specialized class also: one subclass can have different superclasses (also called parent classes) 2 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

OO: Example #1 for generalization, specialization Department of Geoinformation Science staff_member non_ research_associate professor „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 3 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

OO: Example #2 for generalization, specialization Department of Geoinformation Science geometrical figure triangle 4 circle rectangle „geometrical figure“ is a more general concept than „triangle“, „circle“ or „rectangle“ T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Taxonomy Department of Geoinformation Science generalization and specialization describe a taxonomical (i. e. systematic) relationship between general and specific concepts Example: Taxonomy of flies with two wings (from biology) Orthorrhapha Brachycera - flies Cyclorrhapha Diptera – Flies (with two wings) Aschiza Nematocera - mosquito Schizophora Acalyptratae Calyptratae 5 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Aggregation vs. Generalization Department of Geoinformation Science 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) 6 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Inheritance and specialization (I) Department of Geoinformation Science A superclass represents a concept. A subclass specializes this concept, such 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 7 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Example #1 for Inheritance Department of Geoinformation Science student staff member - name - first name - registration number - personnel number - subject - institute - address - date of birth - registration-date - bank account no. - Bachelor - salary - Master 8 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Example #1 for Inheritance Department of Geoinformation Science person - name - first name - address - date of birth student 9 staff member - registration number - personnel number - subject - bank account no. - registration-date - salary -. . . T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Object-orientation: Example #2: Overriding Department of Geoinformation Science geometrical figure -center: Point -visible: Boolean +display ( ) +delete ( ) +move ( ) triangle -a: number -b: number -c: number +display ( ) +delete ( ) 10 circle -radius: number +display ( ) +delete ( ) T. H. Kolbe – Geoinformation Technology: lecture 2 rectangle -a: number -b: number +display ( ) +delete ( ) WS 2006/07

Object-orientation: Inheritance and specialization (II) Department of Geoinformation Science subclasses differ systematically wrt. each other attributes and methods of a class represent a selfcontained concept the specialized class is fully compatible to the general class 11 attributes and methods of the superclass do not have to be repeated in the specification of the subclass(es) geometrical figure -center: Point -visible: Boolean +display( ) +delete( ) +move( ) triangle -a: number -b: number -c: number +display ( ) +delete ( ) T. H. Kolbe – Geoinformation Technology: lecture 2 circle -radius : number +display( ) +delete( ) rectangle -a: number -b: number +display ( ) +delete ( ) WS 2006/07

Object-orientation: Polymorphism Department of Geoinformation Science 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) objectspecific one is activated in each case advantage of the polymorphism: specific objects can be handled in a general way triangles, circles, and geometrical figure -center: Point -visible: Boolean +display ( ) +delete ( ) +move ( ) triangle -a: number -b: number -c: number +display( ) +delete( ) circle -radius : number +display ( ) +delete ( ) rectangle -a: number -b: number +display ( ) +delete ( ) rectangles can be treated as geometrical figures 12 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Example #2 with spatial reference Department of Geoinformation Science 13 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Example #2: state - district - municipality - parcel Department of Geoinformation Science state district -name: string -inhabitants: number -area: number 1. . * +getname( ): string +getinhabitants( ): number +getarea( ): number -name: string -inhabitants: number -area: number +getname( ): name +getinhabitants( ): number +getarea( ): number Declare Name Declare thethe relationships multiplicities methods attributes property -owner: Person -area: number +getowner( ): Person +getarea( ): number 14 municipality 1. . * -name: string -inhabitants: number -area: number 1. . * +getname( ): string +getinhabitants( ): number +getarea( ): number T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Example #2: property - parcel - polygon Department of Geoinformation Science 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 15 1. . n parcel T. H. Kolbe – Geoinformation Technology: lecture 2 geometry polygon WS 2006/07

Example #2: Topological relationships of polygons Department of Geoinformation Science node bounds edge bounds face 16 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Example #2: polygon – edge – node - point Department of Geoinformation Science polygon 1. . 2 3. . * bounds 2. . * Declare. Name the multiplicitys and names the relationships 1 point 17 geometry T. H. Kolbe – Geoinformation Technology: lecture 2 edge bounds 1 2 node WS 2006/07

Example #2: Class ‘point‘ Department of Geoinformation Science 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) + get. X( ) : number + get. Y( ) : number +. . . 18 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07

Data Modelling Literature Department of Geoinformation Science 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) 19 T. H. Kolbe – Geoinformation Technology: lecture 2 WS 2006/07
- Slides: 19