relation type theory foundations & applications. overview introduction type theory object type...
TRANSCRIPT
![Page 1: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/1.jpg)
Relation Type Theory
Foundations & Applications
![Page 2: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/2.jpg)
Overview
• Introduction• Type Theory• Object Type Theory– Critique of Object Type Theory– Patches for Object Type Theory
• Relation Type Theory– Applications• With Object Type Theory (Co-existence)• Without Object Type Theory (Standalone)
![Page 3: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/3.jpg)
Introduction
• Methodology of Science• Contradictory Manifestos• Programming Paradigm Proliferation
![Page 4: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/4.jpg)
Methodology of Science
![Page 5: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/5.jpg)
Contradictory Manifestos
![Page 6: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/6.jpg)
Programming Paradigm Proliferation
• Declarative– Functional– Logic– Constraint
• Imperative– Procedural– Object Oriented (and Subject Oriented)– Aspect Oriented– …
• But they are all based on Object Type Theory!
![Page 7: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/7.jpg)
Type Theory
• What is a type?• Why do we need types?• What kind of types?• How are things bound to types?• How do types relate to each other?
![Page 8: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/8.jpg)
What is a Type? (wiktionary)• Type
– A grouping based on shared characteristics; a class. – […]– (computing theory) A tag attached to variables and values used
in determining what values may be assigned to what variables.
• Class– A group, collection, category or set sharing characteristics or
attributes. [..] Often used to imply membership of a large class.– […]– (computing) A set of objects possibly differing in state but not
behavior.
![Page 9: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/9.jpg)
What is a Type?
• A type is – a grouping – of things – based on some kind of commonality.
![Page 10: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/10.jpg)
Why do we need Types?
• To define behavior for the– Creation– Destruction– Mutation– Assignment (special kind of Mutation)of the things we are grouping.
• It is all about SHARED BEHAVIOR!
![Page 11: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/11.jpg)
What kinds of types?
• Differentiate on the things that get grouped– things can be objects– things can be relations
• This gives us two kinds of types– Object Types– Relation Types
![Page 12: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/12.jpg)
How are things bound to types?
• Objects are a priori bound to types– objects are bound to one type– objects remain bound to this same type
• Relations are a posteriori bound to Types– relations are bound to a type based on rules– relations can be rebound if relations/rules change
![Page 13: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/13.jpg)
How do types relate to each other?
• Two kinds of type inheritance– Derivation by Extension
(OO Languages , XML Schema)– Derivation by Restriction
(Relational Model, XML Schema)
![Page 14: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/14.jpg)
Kinds of Type Theory
• There are 2 kinds of Type Theory– Object Type Theory– Relation Type Theory
![Page 15: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/15.jpg)
Object Type Theory
• No consensus, at least 2 competing camps– Object Oriented Model (OODBS Manifesto)– Relational Model (Third Manifesto)
• But from a Type Theory perspective, they are actually not that different!
![Page 16: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/16.jpg)
Object Oriented Model (OODBS Manifesto)
• Defines mandatory and optional features that an OO Database System must support
• Most important are– Complex Objects– Object Identity
![Page 17: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/17.jpg)
Complex Objects
![Page 18: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/18.jpg)
Object Identity
![Page 19: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/19.jpg)
Relational Model(Third Manifesto)
![Page 20: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/20.jpg)
Relation-Valued Attributes
• The value of an attribute can be any type– So it can also be a Relation Type
• Closure of Relation Composition– Relations can contain other Relations (Relation-
Valued attributes) or scalar values.
![Page 21: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/21.jpg)
Relational Algebra and Assignment
• Relations are immutable• Relation variables are mutable
• So all operations on relations are set based
![Page 22: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/22.jpg)
Critique of Object Type Theory
• Object Types determine behavior– But relations actually determine behavior!
• Relations have different meaning– Relations are either set based or object based
• Type binding is too static• Relations are second (or third) rate citizens– Objects are ‘owners’ of relation endpoints
![Page 23: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/23.jpg)
Object Types determine behavior
• But relations actually determine behavior!
![Page 24: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/24.jpg)
Relations have different meaning
• Relations are either set based or object based
![Page 25: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/25.jpg)
Type binding is too static
![Page 26: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/26.jpg)
Relations are second rate citizens
![Page 27: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/27.jpg)
Patches for Object Type Theory
• Design by Contract• State Machines (Finite Automata)• Aspect Oriented Programming• Subject Oriented Programming
![Page 28: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/28.jpg)
Design By Contract
• Class invariants using Pre- and Post conditions
![Page 29: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/29.jpg)
State Machines
![Page 30: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/30.jpg)
Aspect Oriented Programming
![Page 31: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/31.jpg)
Subject Oriented Programming
![Page 32: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/32.jpg)
Relation Type Theory• A Relation Type– is a type– that is a priori– statically bound– to a relation
• A Relations Type (Is this necessary?)– is a type – that is a posteriori – dynamically bound – to relations – based on rules about those relations– and that defines behavior for those relations
![Page 33: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/33.jpg)
Applications
• Applications of Relations Type Theory– With Object Type Theory (Co-existence)• Relation Oriented Method Overloading• Multiple Type Declarations• 3rd Generation Object Oriented Programming (OOP)
– Without Object Type Theory (Standalone)• Relation Oriented Programming (ROP)
![Page 34: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/34.jpg)
Relation Oriented Method Overloading
• Same signature, Different behavior
![Page 35: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/35.jpg)
RO Method Overloading - Advantages
• Extra level of polymorphism• More robust (contrary to Contract Based)
![Page 36: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/36.jpg)
Multiple Type Declarations
• Definition• Advantages• Example• Implementation
![Page 37: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/37.jpg)
Muldecs - Definition• A Multiple Type Declaration (muldec) is the
specification of a variables types– the objects assigned to the variable should implement
all types (usually interfaces)
• Muldecs can be supported at– The platform level (JVM, CLR, C++ linker …)– The language level (Java, C#, C++, …)– The framework level (Allors, …)
• Muldecs can be overloaded
![Page 38: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/38.jpg)
Muldecs - Advantages
• Reduces the gap between statically and dynamically typed languages
• Less casting • Higher level of modularization– Looser coupling is possible
• Better evolution– More additive
• Especially suited for 3rd generation OOP
![Page 39: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/39.jpg)
Muldecs - Example
![Page 40: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/40.jpg)
Muldecs – Implementation in Allors
![Page 41: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/41.jpg)
Muldecs - Notations
• C derivatives– type1 type2 … variable– methodName( type1 type2 … argument)
• Uml
![Page 42: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/42.jpg)
3rd Generation Object Oriented Programming (OOP)
• Can be seen as a evolution from– 1st Generation OOP (Inheritance)– 2nd Generation OOP (Delegation)
• Builds upon– Relation Oriented Method Overloading– Multiple Type Declaration
![Page 43: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/43.jpg)
1st Generation OOP
![Page 44: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/44.jpg)
2nd Generation OOP
![Page 45: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/45.jpg)
3rd Generation OO
![Page 46: Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649eec5503460f94bfd9e1/html5/thumbnails/46.jpg)
Relation Oriented Programming