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

Post on 20-Jul-2020

0 views 0 download

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

Clemens SzyperskiPrincipal Architect

Microsoft Corporation

JAOO AustraliaMay 2009

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

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

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

MODEL RUNTIMES

From models as informal descriptions

To model-assisted artifact generation

To model-driven systems (“runtimes”)

STUFF…

“M”Modeling language

RepositoryModel store

Visual Studio “Quadrant”Modeling tool

[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, …

MODELS

TEXTUALDSLsVISUAL DSLs

RUNTIMES

repinst.exe

product SuperNotepadversion = "1.0"...

end product

Products {SuperNotepad{

Version = "1.0.0.0",...

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

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

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;

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;

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

M.exeCompiler

MX.ExeLoader

Domain.mx

SQLServer

ModelA.m

LangB.m

ModelC.m

M.exeCompiler

Domain.mx

SQLServer

ModelA.m

LangB.m

Data.b

MX.exeData Transform

ModelC.m

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

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

}

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

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} };

}

Repository features:

Schema versioning

Folder-level security

Deployment

Catalog

Auditing

Globalization/Localization

Builds on SQL Server features:

Replication, semi-connected clients, query, etc.

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

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

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

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

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

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

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

type Achievement {

Description : Text;

Score : Integer16;

Victory : Logical = false;

}

Achievements : Achievement*;

type ColoredAchievement : Achievement {

Color : Text = "none";

}

ColoredAchievements : ColoredAchievement* where item.Color in

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

// View for backwards compatibility

Achievements() : Achievement* { ColoredAchievements

}

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

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

}

}

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, …

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

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

}

}

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”

Use the bits

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

Tell us what you think

oslo@microsoft.com

Your blogs

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

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