Model Driven Engineering

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
CSI5112 Software Engineering Team: Andrei Anisenia Margi Fumtiwala.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
L4-1-S1 UML Overview © M.E. Fayad SJSU -- CmpE Software Architectures Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Institute For Software Integrated Systems Vanderbilt University Applications of Model Integrated Computing to The Synchronous Language Signal Ethan Jackson.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
ACM/JETT Workshop - August 4-5, 2005 UML Modeling using MagicDraw UML for Java Programmers.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
CSE 131 Computer Science 1 Module 1: (basics of Java)
CIS Computer Programming Logic
程建群 博士(Dr. Jason Cheng) 年03月
1 CSC204 – Programming I Lecture 2 Intro to OOP with Java.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Generic API Test tool By Moshe Sapir Almog Masika.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Session Three Review & Conditional Control Flow. Java File Hierarchy Projects Packages Classes Methods.
L6-S1 UML Overview 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College.
Design Jon Walker. More UML ● What is UML again?
SE-1010 Dr. Mark L. Hornick 1 Java Programming Basics.
SilkTest 2008 R2 SP1: Silk4J Introduction. ConfidentialCopyright © 2008 Borland Software Corporation. 2 What is Silk4J? Silk4J enables you to create functional.
1 Graph Coverage (5). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Unit Testing CSIS 3701: Advanced Object Oriented Programming.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
Ch- 8. Class Diagrams Class diagrams are the most common diagram found in modeling object- oriented systems. Class diagrams are important not only for.
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Identifying classes, Packages and drawing class Diagrams, Object Diagrams and composite structure diagrams Week 07 1.
Daniel Amyot, University of Ottawa Based on Powerpoint slides by Gunter Mussbacher (2009) with material from: Jo Atlee, Dan Berry (both University of Waterloo);
METAMODELING the core of MDE and modeling in general UML3-1 UML 1.class diagrams 2.object diagrams and constraints 3.metamodeling.
1 CEN 4020 Software Engineering PPT4: Requirement analysis.
Unified Modeling Language (UML)
OVERVIEW OF MDE AND IN CLASS EXAMPLES try your luck at modeling UML4-1 UML 1.class diagrams 2.object diagrams and constraints 3.metamodeling 4.examples.
MODEL REFACTORING Refactorings 1.model refactoring 2.object oriented refactorings Ref1-1.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Introducing IBM Rational Software Architect
Elaboration popo.
Object-Oriented programming for Beginners LEAPS Computing 2015
Chapter 0: Introduction
Paul Ammann & Jeff Offutt
UML Diagrams By Daniel Damaris Novarianto S..
Component and Deployment Diagrams
Content Programming Overview The JVM A brief look at Structure
ECE 353 Lab 3 Pipeline Simulator
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Object-Oriented Analysis and Design
Unified Modeling Language
Research topics: Mira Balaban
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
UML Diagrams Jung Woo.
MetaModeling the core of MDE and modeling in general UML
String Output ICS 111: Introduction to Computer Science I
Conditions and Ifs BIS1523 – Lecture 8.
How to Run a Java Program
Building Java Programs
Software Design CMSC 345, Version 1/11.
Paul Ammann & Jeff Offutt
Analysis models and design models
ECE 353 Lab 3 Pipeline Simulator
Introduction to AppInventor
EGR 2131 Unit 12 Synchronous Sequential Circuits
S.JOSEPHINE THERESA, DEPT OF CS, SJC, TRICHY-2
Software Architecture & Design
How to Run a Java Program
Presentation transcript:

Model Driven Engineering UML class diagrams object diagrams and constraints metamodeling examples MDE → finally! basics of Model Driven Engineering

MDE Is about automating the development of rote well-understood software everything that I talk about you have done or will do manually Generalizes standard Engineering practices engineering with a capital “E” where one creates a model or models of what needs to be built, and tools transform this model or models into an engineering artifact. Ex: Next generation space shuttle Software development becomes creating models and applying M2M and M2T transformations to generate source code. Instead you write models of programs, or if you are advanced you write model-to-model (M2M) or model-to-tool (M2T) or tool-to-model (T2M) transformations

Quick Sketch of MDE General idea is to have domain experts draw a diagram model of what they want Press a button and the model translated to a database Database is checked for constraint violations If no violations, transform to code or code shell that has to be filled in T2M M2T Violet or UML Drawing Tool Constraint Verification Let’s look at an example to make this concrete

An MDE Model Here is a finite state machine (FSM) model of my eating habits: In general, a model is a graph different nodes have different icons to represent different semantics edges possibly directed represent relationships different edges have different icons to represent different semantics

Everything is a Graph to MDE nothing special about FSMs Everything is a Graph to MDE nothing special about FSMs. hence the generality of MDE Message Sequence Charts Logic Circuit Diagram Data Flow Model Petri Net Network Architecture Flow Chart

All are Object Diagrams Everything is a Graph to MDE nothing special about FSMs. hence the generality of MDE Message Sequence Charts Logic Circuit Diagram Data Flow Model All are Object Diagrams Petri Net Network Architecture Flow Chart

MDE FSM Engineer has 2 Tasks To use a special tool to draw the desired FSM graph

MDE FSM Engineer has 2 Tasks To press a button not shown to generate code that implements the drawn graph Basic questions to ask: how does the FSM tool work internally? how is application source generated? FSM Application Engineer FSM tool FSM source code draws FSM presses button to generate

to answer these questions, we need to look a bit deeper Metamodels

Draw its UML Class Metamodel MDE Metamodel It is a specification of all legal graphs of a kind Show simplest UML class diag. that represents all FSM graphs as below? node = class edge = association or inheritance relationship Answer on next slide Draw its UML Class Metamodel

MDE Metamodel A schema for this diagram is: do Node schema first node# name type trans# startsAt endsAt of type Node# note: things like “1” and “*” are expressed by constraints. In this case, every transition MUST have non-empty StartsAt and EndsAt fields.

Populating Tables with Tuples Given the following FSM instance: Its tabular representation is: trans# startsat endsat t1 nstart nReady t2 nDrink t3 nEat t4 t5 t6 t7 t8 nFam t9 t10 nstop node# name type nstart start nReady Ready state nDrink Drink nEat Eat nFam Family… nstop stop

Recall Actions of Engineer Draw FSM and push button Press button arrow is a composition of 3 more primitive arrows a.k.a. steps presses button to generate FSM source code FSM tool draws FSM using Application Engineer parse graph into tables FSM model xform tables to code FSM source code validate constraints

From Relational Tables… Can generate code because FSM application domain is well-understood The essence of MDE! rote mapping Called a Model to Text (M2T) transformation

I previously used Velocity, which sucked, and now I’m using Running Bear a Model to Text tool

Model to Text Mapping Running Bear (RB) is a teeny-weeny Java package There are lots of “off-the-shelf” tools; I previously used Apache Velocity but RB is much better. Database tables in RB are database tuples or prolog facts Example: class diagrams with no methods or associations – translate them to Java code. What is the simplest metamodel of these instances? Answer on next slide

Example Metamodel and Instances What is the schema of this metamodel? do class schema first What are the tuples? do class table first class# name attribute# name type ofclass class# name c1 City c2 Account attribute# name type ofclass a1 String c1 a2 state a3 number Integer c2 a4 balance Double

Translation to Databases Relational tables: Relational database ≈ prolog fact file data.pl dbase(data,[class,attribute]). table(class,[cid,name]). class(c1,city). class(c2,account). table(attribute,[aid,name,type,ofclass]). attribute(a1,name,string,c1). attribute(a2,state,string,c1). attribute(a3,number,integer,c2). attribute(a4,balance,double,c2). class# name c1 City c2 Account green is schema black is data attribute# name type ofclass a1 String c1 a2 state a3 number Integer c2 a4 balance Double

All 6 RB Methods static void setOut(PrintStream out) // set file output, stdout is default static void l(String fmt, Object... args) { out.format(fmt + "\n", args); } static void l() { out.println(); } // print new blank line static void p(String fmt, Object... args) { out.format(fmt, args); } static void close() // close file output, reset to stdout marquee(String… args) // main processing

> java RBProgram <database> [output-file] Hello World! General calling sequence of an RB program: > java RBProgram <database> [output-file] > java helloworld ignore.db.pl supply dummy argument produces:

Example RB Program data.pl > java gen data.pl gen.java class city { string name; string state; } class account { integer number; double balance; data.java > java gen data.pl dbase(data,[class,attribute]). table(class,[cid,name]). class(c1,city). class(c2,account). table(attribute,[aid,name,type,cid]). attribute(a1,name,string,c1). attribute(a2,state,string,c1). attribute(a3,number,integer,c2). attribute(a4,balance,double,c2). data.pl gen.java gen.java

Example RB Program data.pl > java gen data.pl gen.java class city { string name; string state; } src/city.java class account { integer number; double balance; src/account.java > java gen data.pl dbase(data,[class,attribute]). table(class,[cid,name]). class(c1,city). class(c2,account). table(attribute,[aid,name,type,cid]). attribute(a1,name,string,c1). attribute(a2,state,string,c1). attribute(a3,number,integer,c2). attribute(a4,balance,double,c2). data.pl gen.java

Time for Perspective

In Programming Assignment P1 You translated Java bytecode files into an MDELite database Called a Tool-to-Model transformation – generally it is a Java program RB is a tool that translates a MDELite database into a text file; called a Model-to-Text (or Model-to-Tool) transformation T2M M2T

A Possible Programming Assignment Write the M2T transformation using the RB tool and Apache Velocity for comparison -- I’ll give you the FSM database to translate M2T mapping

Programming assignments P2 and P3 big picture for P2 and P3 Programming assignments P2 and P3

Your 2nd Programming Assignment Verify that a Violet UML class diagram is “correct”, meaning that it conforms to sensible constraints Violet was given to you Violett.ClassParser was given to you You wrote VPL.Conform Violett.ClassParser VPL.Conform Violet to draw a class diagram

Your 3RD Programming Assignment vpl2ypl ClassUnparser P3 ClassParser P2 .Conform P3 is next step in this chain – You translated a VPL database into a YPL database, and used an existing tool that converted a YPL database into a Yuml spec. This is a M2M (model-2-model) transformation Doing so, you wrote your first simple (MDE) application! public static void main(String… args) { MDL.VioletClassParser.main(args[0],args[1]); // produces new.vpl.pl VPL.Conform(args[1]); M2M.vpl2vpl(args[1], “new.ypl.pl”); Yuml.ClassUnParser(“new.ypl.pl”,”new.yuml.yuml”); } Approximate

Oops ! Not quite right What is missing? ClassParser vpl2ypl ClassUnparser P3 P2 Conform Conform What is missing? Ans: YPL.Conform ! Just as VPL databases have conformance rules, so too do YPL databases. These rules are very similar to that of VPL. Yuml.Conform already exists, so you could call it immediately after your vpl2ypl program finishes execution.

Big Picture of MDE All categories: domains of design artifacts and arrows are programs Conform ToYumlSpec ClassParser

Big Picture of MDE All categories: domains of design artifacts and arrows are programs MDE programs are traversals of arrows of a category Violet MM VPL Boolean yUML Specs Conform ClassParser ToYumlSpec Conform ClassParser ToYumlSpec

If I were to Give Another MDE Programming Assignment I’d have you integrate P1, P2, P3 or use RB to generate Java stubs genStub MDE is linking these domains together into an interoperable ecosystem introspect P4 prog1toVPL ClassParser vpl2ypl yumlspec Conform Conform

Recap FSM Application Engineer uses an FSM tool to draw a desired FSM The tool internally stores a model as a set of relational tables Database is validated Tool translates these tables into source code using RB Conform Application Engineer FSM tool relational tables draws FSM using stores FSM graph in RB script translates to code application source code Questions?

Refactorings Next Lecture Other transformations are used to build models and meta-models called: They are also a centerpiece for Java and OO program development Refactorings