A tour of the Microsoft “Oslo” Modeling...

41
Clemens Szyperski Principal Architect Microsoft Corporation JAOO Australia May 2009

Transcript of A tour of the Microsoft “Oslo” Modeling...

Page 1: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Clemens SzyperskiPrincipal Architect

Microsoft Corporation

JAOO AustraliaMay 2009

Page 2: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

The more low-level a composition approach, the more exposure to semantic fragility

Initial correctness

Expensive, one-off deployment and operations

Fragile versioning, lifecycle management

Moving up the concept stack

From code statements to functions

From functions to objects

From objects to components

From components to services

From services to model-driven systems

Page 3: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

A domain is a space of concepts, conventions, traditions, organizations

A model is a formalized description of(some of) a domain‟s concepts

Separate domains can be relatedby relating models – promise of integration

Model-driven is a disciplined formof data-driven

Page 4: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

COM (+)

.NET 1.0

Web Services

.NET 3.0

Windows

Model-driven Platform

midl.exe

[Transaction]

DECLARATIVECONTENT

TIME

[YourAttributeHere]

app.config

wsdl:definitions

xsd:schema

wf:StateMachine

wpf:ContentControl

console bit

Page 5: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

MODEL RUNTIMES

From models as informal descriptions

To model-assisted artifact generation

To model-driven systems (“runtimes”)

STUFF…

Page 6: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

“M”Modeling language

RepositoryModel store

Visual Studio “Quadrant”Modeling tool

Page 7: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

[Your Models]

Base Models

“M” Runtime

REPOSITORYSQL SERVER

[Your Models]

Base Models

“M” Runtime

REPOSITORYSQL SERVER

"Oslo" Architecture

RUNTIMES

[Your Runtime]

“Dublin”

ASP.NET

WF

WCF

SQL/EDM

Windows

Other ISV Runtimes

ADO .NET

Data Access Stacks,XML, Custom Formats, …

“QUADRANT”

Composition

Generic Viewers

Dataflow

EDITORFRAMEWORK

[Your Visual DSL] [Your Textual DSL]

Model-driven Parser

SQL Generation

Language Services

LANGUAGEFRAMEWORK

[Your Models]

Oslo Models

Catalog

REPOSITORYSQL SERVER

OTHER TOOLS

(VSTS, EXCEL, …)

XML,Custom Formats, …

Page 8: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:
Page 9: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

MODELS

TEXTUALDSLsVISUAL DSLs

RUNTIMES

repinst.exe

product SuperNotepadversion = "1.0"...

end product

Products {SuperNotepad{

Version = "1.0.0.0",...

Page 10: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

A Model is: Data

Textual and/or VisualDomain-Adequate Language

Many domains come with their own,Domain-Specific Language (DSL)

Constraints

Express validity of model instances (data)

Views

Project model instances to call out or gather properties of value for specific purposes

Page 11: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

A DSL is essentially a concept framework

Creating a new DSL is as good (or bad) ascreating a new framework

In many cases, larger domains/industries have already defined their own DSLs

Often based on UML / XMI or on XML / XSD

Another example: ISO EXPRESS (ISO 10303-11)

A unified approach to capturing and designing textual and visual DSLs is only part of the larger “Oslo” story

Enabling interoperation and agility across systems and domains

Page 12: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

ISO Express is a data modeling language

Pascal looks, standardized in early 90‟s

Used in ISO STEP standards that are widely applied in manufacturing and building industries

SCHEMA Family;ENTITY PersonABSTRACT SUPERTYPE OF (ONEOF (Male, Female));name: STRING;mother: OPTIONAL Female;father: OPTIONAL Male;

END_ENTITY;TYPE day_in_week_number =

INTEGER;WHERE WR1: (1 <= SELF) AND (SELF <= 7);

END_TYPE;

Page 13: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

ISO Express is a data modeling language

Standardized in early 90‟s

Used in ISO STEP standards that are widely applied in manufacturing and building industries

SCHEMA Family;

ENTITY PersonABSTRACT SUPERTYPE OF (ONEOF (Male, Female));name: STRING;mother: OPTIONAL Female;father: OPTIONAL Male;

END_ENTITY;

TYPE Day_in_Week_Number = INTEGER;WHERE WR1: (1 <= SELF) AND (SELF <= 7);

END_TYPE;

Page 14: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

DSL

"M"

Domain-specific grammars

(MGrammar sublanguage)

Abstract data model

(MGraph sublanguage)

Domain-specific data models

(MSchema sublanguage)

language GPSLanguage {

syntax Main = h:Integer ("," v:Integer)?

=> Point { X { h }, Y { v }};

}

type Point {X : Integer where X < 100;Y : Integer?;DistanceFromOrigin() { SQRT(X*X + Y*Y) }

}

Point { X { 100 }, Y { 200 } }

Point.m

Domain ModelDSLY

DomainY.mg

Domain Grammar

DSLXDomainX.m

Domain Model

DomainY.m

Domain Model

DomainX.mg

Domain Grammar

GPSLanguage.mg

Domain Grammar

Page 15: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

M.exeCompiler

MX.ExeLoader

Domain.mx

SQLServer

ModelA.m

LangB.m

ModelC.m

Page 16: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

M.exeCompiler

Domain.mx

SQLServer

ModelA.m

LangB.m

Data.b

MX.exeData Transform

ModelC.m

Page 17: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

MSchema – the part of the “M” language used for defining domain models

An MSchema domain model defines schema and query over structured data

Values, Constraints, and Views

Natural projection to SQL

Page 18: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

// hello_m.m // Comment

module MyModule { // Module

type Person { // Custom entity type

Id : Integer64 = AutoNumber(); // Auto-generated surrogate ID

Name : Text; // Field of intrinsic type

LuckyNumbers : Integer32*; // Field of collection type

Size : Size; // Field of custom type

} where identity Id; // Identity constraint

type Size {

Id : Integer64 = AutoNumber();

Height : Integer32 where value < 10; // Field with a constraint

Weight : Integer32 = 150; // Field with default

} where identity Id;

Stones(Weight : Decimal9) { Weight * 0.07 } // Computed value

Sizes : Size*; // Extent

People : Person* where item.Size in Sizes; // Extent + constraint

}

Page 19: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

The Oslo SDK provides:

“M” Authoring ToolsIntellipad, Visual Studio language services

“M” Compilation and Build toolsGenerate MX packages

Deployment tool for MX packagesTarget Repository or XML

Once they‟re in the database, it‟s just SQL

Page 20: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:
Page 21: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

MGraph is the part of the “M” language used for defining values

MSchema extent initializers and MGrammarproduction rules use MGraph

Instances can target the Repository or other stores/representations such as XML

module MyModule {

// Extent with values

Sizes : Size* { {Height = 6, Weight = 250} };

}

Page 22: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Repository features:

Schema versioning

Folder-level security

Deployment

Catalog

Auditing

Globalization/Localization

Builds on SQL Server features:

Replication, semi-connected clients, query, etc.

Page 23: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Optimized for storing and sharing models

Designed for extensibility

Allows for query, linkage, impact assessment across models

Supports common tasks such as versioning, access control

Extensible metadata - enables rich tooling

Page 24: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Includes end-to-end system / lifecycle models

Out of the box models

Design-time, run-time

„Natural‟ SQL Server database

Leverages database ecosystem:tools, reporting, BI, etc

Page 25: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Repository features are built on SQL Server

Repository install also turns on useful features, e.g. replication and mirroring

system catalog, Change Data Capture,

replication, SSIS, mirroring, security, etc.

SQL Server

Features

Repository catalog, secure views, auditing,

versioning, claims-based security, glob/loc, etc.

Repository

Features

Page 26: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Security

Claims-based fine-grained access control

Folder structure

Partitioning of data into hierarchical folders

Versioning

Design for sliding version windows

Globalization / Localization

Support for localization, built-in locales

Id Sequences

Auto-generation of identifiers

Page 27: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Security is claims-based

Identity becomes just one of several possible claims

Claims presented to authorize operations against resources

Repository tables keep track of claims, resources and operations

Triggers implemented on generated views to check claims

Views protect against direct access to tables

Page 28: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Domain-specific security containers

Use “folders” to partition data

Apps decide which data goes into what folder

Security checks happen on folder boundaries

Refer to Folder from your model

Folder ID must exist in the Repository.Item.Folders table

Page 29: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Data change synchronization

Between nodes using SQL Server Replication and Occasionally Connected Systems (OCS)

Import/Export using SQL Server Change Tracking, e.g. repository<->file system

Schema evolution

Extend M type and provide backwards compatibility for old clients w/ computed values

SQL Server Integration Services for data migration

Page 30: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

type Achievement {

Description : Text;

Score : Integer16;

Victory : Logical = false;

}

Achievements : Achievement*;

Page 31: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

type ColoredAchievement : Achievement {

Color : Text = "none";

}

ColoredAchievements : ColoredAchievement* where item.Color in

{ "none", "red", "green", "blue" };

// View for backwards compatibility

Achievements() : Achievement* { ColoredAchievements

}

Page 32: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

SQL Server has a catalog (sys tables)List of tables, views, functions, stored procedures, etc. and the relationships between them

Repository has its own catalogExtends SQL Server catalog

Adds information about modules, types, extents and computed values

Useful forRich export

Impact analysis

Enriched SQL data access code generation

Page 33: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

module Language.Catalog {

Modules : {

Id : Integer32 => AutoNumber;

Name : Text where value.Count <= 400;

}* where identity Id, unique Name;

ModuleTypes(moduleId : Integer32) {

Types where

value.Declaration.DefinedIn.Id == moduleId

}

}

Page 34: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

A “runtime” is just a program that reads models to drive its behavior

Thus “model-driven”

Reading models from the Repository is just querying data off of SQL Server

Can also build runtimes over models represented in XML or other format

You can program against the generated SQL with any data access technology

sqlcmd.exe, ADO.NET, LINQ to SQL, Entity Framework, Access, Excel, ODBC, OLEDB, …

Page 35: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

MGrammar is the part of the “M” language used for defining textual domain-specific languages (DSLs)

MGrammar DSLs define projections from Unicode text to structured data

Rule-based transformation

Grammar-driven text editor integration

Page 36: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

// hello_mg.mg // Comment

module MyModule { // Module

@{CaseInsensitive} // Lang. attribute

language Person { // Language

interleave Whitespace = " " | "\r" | "\n"; // Skipped

syntax Main = // Syntax + action

"person" name:String props:Property* "end person"=> People { Person { Name { name }, valuesof(props) } };

syntax Property =

"number" "=" n:Number => LuckyNumbers { { n } };

token Number = ("0".."9")+; // Token

token Word = ("A".."Z" | "a".."z" | "0".."9" | "_")+;

token String =

Word | a:'"' s:('""' | ^'"')+ b:'"' => s; // Token + action

}

}

Page 37: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:
Page 38: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

A generic data editor

Flexible, focused design surfaces

Default experiences over arbitrary data

Rich declarative customization

A set of Quadrant customizations for a domain is a “visual DSL”

Page 39: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:
Page 40: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

Use the bits

Community Technology Preview of “Oslo” SDK on Oslo Dev Centerhttp://msdn.com/oslo

Tell us what you think

[email protected]

Your blogs

Forum + bug reporting: http://msdn.com/oslo

Page 41: A tour of the Microsoft “Oslo” Modeling Platformgotocon.com/...2009/slides/...ATourOfTheMicrosoftOsloModelingPlat… · JAOO Australia, May 2009 Keywords: Oslo, M Created Date:

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.