Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object.

Similar presentations


Presentation on theme: "Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object."— Presentation transcript:

1 Relation Type Theory Foundations & Applications

2 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)

3 Introduction Methodology of Science Contradictory Manifestos Programming Paradigm Proliferation

4 Methodology of Science Epistemology or theory of knowledge is the branch of philosophy that studies the nature, methods, limitations, and validity of knowledge and belief. (source: wikipedia) The methodology of Science is the study of the epistemology of scientific theories

5 Contradictory Manifestos The Object-Oriented Database System Manifesto http://www.cs.cmu.edu/People/clame n/OODBMS/Manifesto/htManifesto/M anifesto.html http://www.cs.cmu.edu/People/clame n/OODBMS/Manifesto/htManifesto/M anifesto.html Databases, Types and the Relational Model - The Third Manifesto http://www.thethirdmanifesto.com/

6 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!

7 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?

8 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.

9 What is a Type? A type is – a grouping – of things – based on some kind of commonality.

10 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!

11 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

12 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

13 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)

14 Kinds of Type Theory There are 2 kinds of Type Theory – Object Type Theory – Relation Type Theory

15 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!

16 Object Oriented Model (OODBS Manifesto) Defines mandatory and optional features that an OO Database System must support Most important are – Complex Objects – Object Identity

17 Complex Objects Complex objects are built from simpler ones by applying constructors to them. The simplest objects are […] atomic types. There are various complex object constructors: tuples, sets, bags, lists, and arrays are examples. The minimal set of constructors that the system should have are set, list and tuple. (source: OODBS Manifesto) Closure of Object Composition – Objects composed of ‘simpler’ or ‘simplest’ objects are themselves objects.

18 Object Identity Object identity has long existed in programming languages. The concept is more recent in databases […] an object has an existence which is independent of its value. Thus two notions of object equivalence exist – two objects can be identical ([..]same object) – they can be equal ([..] same value). This has two implications: – object sharing – object updates. […] identity-based models are the norm in imperative programming languages [..] But the concept is quite new in pure relational systems, where relations are value-based. (source: OODBS Manifesto)

19 Relational Model (Third Manifesto) The Relational Model (RM) was originally defined by Codd and refined by C.J. Date en H. Darwen in “The Third Manifesto” Some Prescriptions – Scalar values and variables are typed – Heading and Tuple/Attribute Value – Relation value – Relation variable – Relational Algebra and Assignment Some Proscriptions are – No duplicate tuples and No Nulls – Relvars are not domains* – No Object Ids* (source: Third Manifesto)

20 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.

21 Relational Algebra and Assignment Relations are immutable Relation variables are mutable So all operations on relations are set based

22 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

23 Object Types determine behavior But relations actually determine behavior!

24 Relations have different meaning Relations are either set based or object based

25 Type binding is too static

26 Relations are second rate citizens

27 Patches for Object Type Theory Design by Contract State Machines (Finite Automata) Aspect Oriented Programming Subject Oriented Programming

28 Design By Contract Class invariants using Pre- and Post conditions

29 State Machines

30 Aspect Oriented Programming

31 Subject Oriented Programming

32 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

33 Applications Applications of Relations Type Theory – With Object Type Theory (Co-existence) Relation Oriented Method Overloading Multiple Type Declarations 3 rd Generation Object Oriented Programming (OOP) – Without Object Type Theory (Standalone) Relation Oriented Programming (ROP)

34 Relation Oriented Method Overloading Same signature, Different behavior

35 RO Method Overloading - Advantages Extra level of polymorphism More robust (contrary to Contract Based)

36 Multiple Type Declarations Definition Advantages Example Implementation

37 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

38 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 3 rd generation OOP

39 Muldecs - Example

40 Muldecs – Implementation in Allors

41 Muldecs - Notations C derivatives – type1 type2 … variable – methodName( type1 type2 … argument) Uml

42 3 rd Generation Object Oriented Programming (OOP) Can be seen as a evolution from – 1 st Generation OOP (Inheritance) – 2 nd Generation OOP (Delegation) Builds upon – Relation Oriented Method Overloading – Multiple Type Declaration

43 1 st Generation OOP

44 2 nd Generation OOP

45 3 rd Generation OO

46 Relation Oriented Programming


Download ppt "Relation Type Theory Foundations & Applications. Overview Introduction Type Theory Object Type Theory – Critique of Object Type Theory – Patches for Object."

Similar presentations


Ads by Google