SlideShare a Scribd company logo
A Unified View of Modeling and Programming:
The Perspective from Executable UML
Presented at ISoLA 2016, Corfu, Greece
Ed Seidewitz
10 October 2016
Copyright © 2016 Ed Seidewitz
We can model that!We can model that!
What is a model?
A model is a set of statements in a modeling
language about some system under study or
domain.*
What is a program?
A program is a specification for a computation
to be a executed on a computer.
Models and Programs
* See Ed Seidewitz, “What Models Mean”, IEEE Software, September/October 2003 for more.
We can model that!We can model that!
A program is a model of the specified computation, abstracting away
from the details of how the computation is actually executed on a
computer.
A programming language is a modeling language for creating models
of execution.
All programs are models
Customer customer = customers.get(customerId);
if (customer != null) {
int totalBalance = 0;
for (Account account: customer.accounts) {
totalBalance += account.balance;
}
}
Customer customer = customers.get(customerId);
if (customer != null) {
int totalBalance = 0;
for (Account account: customer.accounts) {
totalBalance += account.balance;
}
}
Java
…and a value called
“totalBalance”…
…and a value called
“totalBalance”…
… that is iteratively computed
to be the sum of the
customer’s account balances.
… that is iteratively computed
to be the sum of the
customer’s account balances.
There is a customer identified
by “customerId”…
There is a customer identified
by “customerId”…
We can model that!
Programs can also be domain models
public class Bank {
private String bankId;
private Set<Customer> customers;
private Set<Account> accounts;
...
}
public class Bank {
private String bankId;
private Set<Customer> customers;
private Set<Account> accounts;
...
}
public class Customer {
private String customerId;
private Set<Account> accounts;
...
}
public class Customer {
private String customerId;
private Set<Account> accounts;
...
}
public class Account {
private String accountId;
private int balance = 0;
private Set<Customer> accountOwners;
...
}
public class Account {
private String accountId;
private int balance = 0;
private Set<Customer> accountOwners;
...
}
Classes are intended to reflect
domain concepts.
Classes are intended to reflect
domain concepts.
Fields reflect properties
of those concepts…
Fields reflect properties
of those concepts…
… or relationships
with other concepts.
… or relationships
with other concepts.
We can model that!
But make implementation commitments
public class Customer {
...
private Set<Account> accounts = new HashSet<Account>();
public void addAccount(Account account) {
if (account != null && !this.accounts.contains(account)) {
this.accounts.add(account);
account.addAccountOwner(this);
}
}
...
}
public class Customer {
...
private Set<Account> accounts = new HashSet<Account>();
public void addAccount(Account account) {
if (account != null && !this.accounts.contains(account)) {
this.accounts.add(account);
account.addAccountOwner(this);
}
}
...
} public class Bank {
...
private Map<String, Account> customers = new HashMap<String, Customer>();
public Integer totalAccountBalance(String customerId) {
Integer totalBalance = null;
Customer customer = this.customers.get(customerId);
if (customer != null) {
totalBalance = 0;
for (Account account: customer.accounts) {
totalBalance += account.balance;
}
}
return totalBalance;
}
...
}
public class Bank {
...
private Map<String, Account> customers = new HashMap<String, Customer>();
public Integer totalAccountBalance(String customerId) {
Integer totalBalance = null;
Customer customer = this.customers.get(customerId);
if (customer != null) {
totalBalance = 0;
for (Account account: customer.accounts) {
totalBalance += account.balance;
}
}
return totalBalance;
}
...
}
Pick implementation
classes for collections.
Pick implementation
classes for collections.
Deal with bidirectional
relationships.
Deal with bidirectional
relationships.
Choose representations for
efficient computation.
Choose representations for
efficient computation.
Decide on (generally sequential)
control structuring.
Decide on (generally sequential)
control structuring.
We can model that!We can model that!
UML began as a notation for models of programs.
But UML 2 has constructs that allow the specification of Turing-
complete computation models.
•Foundational UML (fUML) provides precise execution semantics.
•Action Language for fUML (Alf) provides a textual notation.
Executable UML models are programs
customer = Customer -> select c (c.customerId == customerId);
totalBalance = customer.accounts.balance -> reduce '+';
customer = Customer -> select c (c.customerId == customerId);
totalBalance = customer.accounts.balance -> reduce '+';
Alf
… and a value called “totalBalance”
that is sum of the customer’s
account balances.
… and a value called “totalBalance”
that is sum of the customer’s
account balances.
There is a customer identified
by “customerId”…
There is a customer identified
by “customerId”…
We can model that!
UML is common for domain modeling
public class Bank {
private String bankId;
private Set<Customer> customers;
private Set<Account> accounts;
...
}
public class Bank {
private String bankId;
private Set<Customer> customers;
private Set<Account> accounts;
...
}
public class Customer {
private String customerId;
private Set<Account> accounts;
...
}
public class Customer {
private String customerId;
private Set<Account> accounts;
...
}
public class Account {
private String accountId;
private int balance = 0;
private Set<Customer> accountOwners;
...
}
public class Account {
private String accountId;
private int balance = 0;
private Set<Customer> accountOwners;
...
}
The UML model directly
corresponds to the
program design…
The UML model directly
corresponds to the
program design…
…but abstracts away from
implementation details (like
collection classes).
…but abstracts away from
implementation details (like
collection classes).
It also shows some things
implicit in the program, like
association composition
and bidirectionality.
It also shows some things
implicit in the program, like
association composition
and bidirectionality.
We can model that!
But diagrams are just notation
class Bank {
public bankId: String;
public customers: compose Customer[*];
public accounts: compose Account[*];
}
class Bank {
public bankId: String;
public customers: compose Customer[*];
public accounts: compose Account[*];
}
assoc AccountOwnership {
public accountOwners: Customer[*];
public accounts: Account[*];
}
assoc AccountOwnership {
public accountOwners: Customer[*];
public accounts: Account[*];
} class Account {
public accountId: String;
public balance: Integer = 0;
}
class Account {
public accountId: String;
public balance: Integer = 0;
}
class Customer {
public customerId: String;
}
class Customer {
public customerId: String;
}
A UML class model has
semantics independent of its
mapping to any other language…
A UML class model has
semantics independent of its
mapping to any other language…
…which can be
notated textually as
well as graphically.
…which can be
notated textually as
well as graphically.
We can model that!
Computation can be modeled, too
class Bank {
public bankId: String;
public customers: compose Customer[*];
public accounts: compose Account[*];
public totalAccountBalance(in customerId: String): Integer[0..1] {
customer = this.customers -> select c (c.customerId == customerId);
return customer.accounts.balance -> reduce '+';
}
...
}
class Bank {
public bankId: String;
public customers: compose Customer[*];
public accounts: compose Account[*];
public totalAccountBalance(in customerId: String): Integer[0..1] {
customer = this.customers -> select c (c.customerId == customerId);
return customer.accounts.balance -> reduce '+';
}
...
} The underlying semantics are based
on data-flow, not an implicit von
Neumann architecture.
The underlying semantics are based
on data-flow, not an implicit von
Neumann architecture.
These actions are
inherently concurrent.
These actions are
inherently concurrent.
…with far fewer implementation
commitments.
…with far fewer implementation
commitments.
We can model that!
And declarative constraints, too
A UML constraint can
be specified using a
UML behavior.
A UML constraint can
be specified using a
UML behavior.
We can model that!
Allowing deductions to be made
Given the accounts of a
customer, the
totalBalance can be
derived.
Given the accounts of a
customer, the
totalBalance can be
derived.
Given the accountOwners of
an account, the owning bank
can be deduced (or
validated).
Given the accountOwners of
an account, the owning bank
can be deduced (or
validated).
We can model that!We can model that!
A combined modeling/programming language
should:
•Be designed to express both problem and
solution domain models, not just abstract
hardware computing paradigms
•Have formal semantics that allow reasoning
about models, with execution semantics for
behavioral models
•Have a textual notation for representing and
reasoning on all types of models, with graphical
notations allowing multiple views of the same
model
Combining modeling and programming
We can model that!We can model that!
• Models can be given precise semantics.
• Not all model semantics are execution
semantics.
– E.g., requirements models, architectural models,
business models…
• Some models have execution semantics, and
these are programs.
• Executable models in context of wider
modeling allows deductive or inductive
reasoning combined with execution and
testing
Why is this a good idea?

More Related Content

PPT
Models, Programs and Executable UML
PPTX
UML as a Programming Language
PPT
Programming in UML: Why and How
PPTX
Hands On With the Alf Action Language: Making Executable Modeling Even Easier
PPTX
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
PPTX
Leveraging Alf for SysML, Part 1: Better Simulation Modeling
PPTX
Chapter3: fundamental programming
PDF
AspectC++: Language Proposal and Prototype Implementation
Models, Programs and Executable UML
UML as a Programming Language
Programming in UML: Why and How
Hands On With the Alf Action Language: Making Executable Modeling Even Easier
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
Leveraging Alf for SysML, Part 1: Better Simulation Modeling
Chapter3: fundamental programming
AspectC++: Language Proposal and Prototype Implementation

What's hot (20)

PPT
C and C++ Industrial Training Jalandhar
PPTX
Angular workshop - Full Development Guide
PPTX
graphics programming in java
DOCX
C Programming
PPTX
London F-Sharp User Group : Don Syme on F# - 09/09/2010
PPT
Visual studio 2008
PPT
Applets - lev' 2
DOC
Project two c++ tutorial
PPTX
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
PPT
Basics of c++
PDF
Itsjustangular
PDF
02. functions & introduction to class
PDF
C++ book
PPTX
C++ language basic
PPT
OOP in C++
PPT
Glimpses of C++0x
PDF
C programming
PDF
Deep C
PDF
Data types in c++
C and C++ Industrial Training Jalandhar
Angular workshop - Full Development Guide
graphics programming in java
C Programming
London F-Sharp User Group : Don Syme on F# - 09/09/2010
Visual studio 2008
Applets - lev' 2
Project two c++ tutorial
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Basics of c++
Itsjustangular
02. functions & introduction to class
C++ book
C++ language basic
OOP in C++
Glimpses of C++0x
C programming
Deep C
Data types in c++
Ad

Similar to A Unified View of Modeling and Programming (20)

PPT
Object oriented programming in C++ programming language
PPT
Object oriented programming language in software engineering
PPT
Introduction to software engineering in data science.ppt
PPT
An Evolution of UML projects.and also what is project
PDF
Software Engineering :UML class diagrams
PPTX
Unit 1- OOAD ppt
PPT
uml.ppt
PPT
UML DIAGRAMS FOR IST SEMISTER OF BTECH STUDENTS
PPTX
introofUML.pptx
PPT
PPTX
Cs 1023 lec 10 uml (week 3)
PPT
Introduction to UML, class diagrams, sequence diagrams
PPT
M03_1_Structur alDiagrams.ppt
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPT
M03_1_StructuralDiagrams in unified modeling language
PPT
SDA ClassDiagram.ppt
PPTX
UNIT-2 OOM.pptxUNIT-2 OOM.pptxUNIT-2 OOM.pptx
PPT
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
Object oriented programming in C++ programming language
Object oriented programming language in software engineering
Introduction to software engineering in data science.ppt
An Evolution of UML projects.and also what is project
Software Engineering :UML class diagrams
Unit 1- OOAD ppt
uml.ppt
UML DIAGRAMS FOR IST SEMISTER OF BTECH STUDENTS
introofUML.pptx
Cs 1023 lec 10 uml (week 3)
Introduction to UML, class diagrams, sequence diagrams
M03_1_Structur alDiagrams.ppt
Chapter 2-Unified Modeling Languagee.ppt
Chapter 2-Unified Modeling Languagee.ppt
M03_1_StructuralDiagrams in unified modeling language
SDA ClassDiagram.ppt
UNIT-2 OOM.pptxUNIT-2 OOM.pptxUNIT-2 OOM.pptx
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
Ad

More from Ed Seidewitz (20)

PPTX
SysML v2 - What's the big deal, anyway?
PPTX
Introduction to the OMG Systems Modeling Language (SysML), Version 2
PPTX
Leveraging Alf for SysML, Part 2: More Effective Trade Study Modeling
PPTX
The Very Model of a Modern Metamodeler
PPTX
SysML v2 and the Next Generation of Modeling Languages
PPTX
SysML v2 and MBSE: The next ten years
PPTX
Precise Semantics Standards at OMG: Executing on the Vision
PPTX
Model Driven Architecture without Automation
PPTX
Using Alf with Cameo Simulation Toolkit - Part 2: Modeling
PPTX
Using Alf with Cameo Simulation Toolkit - Part 1: Basics
PPT
Programming in UML: An Introduction to fUML 1.3 and Alf 1.1
PPSX
UML: This Time We Mean It!
PPTX
Executable UML Roadmap (as of September 2014)
PPTX
Essence: A Common Ground for Flexible Methods
PPTX
UML: Once More with Meaning
PPSX
Succeeding with Agile in the Federal Government: A Coach's Perspective
PPTX
UML 2.5: Specification Simplification
PPSX
Programming in UML: An Introduction to fUML and Alf
PPT
Architecting Your Enterprise
PPT
Executable UML and SysML Workshop
SysML v2 - What's the big deal, anyway?
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Leveraging Alf for SysML, Part 2: More Effective Trade Study Modeling
The Very Model of a Modern Metamodeler
SysML v2 and the Next Generation of Modeling Languages
SysML v2 and MBSE: The next ten years
Precise Semantics Standards at OMG: Executing on the Vision
Model Driven Architecture without Automation
Using Alf with Cameo Simulation Toolkit - Part 2: Modeling
Using Alf with Cameo Simulation Toolkit - Part 1: Basics
Programming in UML: An Introduction to fUML 1.3 and Alf 1.1
UML: This Time We Mean It!
Executable UML Roadmap (as of September 2014)
Essence: A Common Ground for Flexible Methods
UML: Once More with Meaning
Succeeding with Agile in the Federal Government: A Coach's Perspective
UML 2.5: Specification Simplification
Programming in UML: An Introduction to fUML and Alf
Architecting Your Enterprise
Executable UML and SysML Workshop

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Cloud computing and distributed systems.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Machine Learning_overview_presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
Assigned Numbers - 2025 - Bluetooth® Document
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
Machine Learning_overview_presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

A Unified View of Modeling and Programming

  • 1. A Unified View of Modeling and Programming: The Perspective from Executable UML Presented at ISoLA 2016, Corfu, Greece Ed Seidewitz 10 October 2016 Copyright © 2016 Ed Seidewitz
  • 2. We can model that!We can model that! What is a model? A model is a set of statements in a modeling language about some system under study or domain.* What is a program? A program is a specification for a computation to be a executed on a computer. Models and Programs * See Ed Seidewitz, “What Models Mean”, IEEE Software, September/October 2003 for more.
  • 3. We can model that!We can model that! A program is a model of the specified computation, abstracting away from the details of how the computation is actually executed on a computer. A programming language is a modeling language for creating models of execution. All programs are models Customer customer = customers.get(customerId); if (customer != null) { int totalBalance = 0; for (Account account: customer.accounts) { totalBalance += account.balance; } } Customer customer = customers.get(customerId); if (customer != null) { int totalBalance = 0; for (Account account: customer.accounts) { totalBalance += account.balance; } } Java …and a value called “totalBalance”… …and a value called “totalBalance”… … that is iteratively computed to be the sum of the customer’s account balances. … that is iteratively computed to be the sum of the customer’s account balances. There is a customer identified by “customerId”… There is a customer identified by “customerId”…
  • 4. We can model that! Programs can also be domain models public class Bank { private String bankId; private Set<Customer> customers; private Set<Account> accounts; ... } public class Bank { private String bankId; private Set<Customer> customers; private Set<Account> accounts; ... } public class Customer { private String customerId; private Set<Account> accounts; ... } public class Customer { private String customerId; private Set<Account> accounts; ... } public class Account { private String accountId; private int balance = 0; private Set<Customer> accountOwners; ... } public class Account { private String accountId; private int balance = 0; private Set<Customer> accountOwners; ... } Classes are intended to reflect domain concepts. Classes are intended to reflect domain concepts. Fields reflect properties of those concepts… Fields reflect properties of those concepts… … or relationships with other concepts. … or relationships with other concepts.
  • 5. We can model that! But make implementation commitments public class Customer { ... private Set<Account> accounts = new HashSet<Account>(); public void addAccount(Account account) { if (account != null && !this.accounts.contains(account)) { this.accounts.add(account); account.addAccountOwner(this); } } ... } public class Customer { ... private Set<Account> accounts = new HashSet<Account>(); public void addAccount(Account account) { if (account != null && !this.accounts.contains(account)) { this.accounts.add(account); account.addAccountOwner(this); } } ... } public class Bank { ... private Map<String, Account> customers = new HashMap<String, Customer>(); public Integer totalAccountBalance(String customerId) { Integer totalBalance = null; Customer customer = this.customers.get(customerId); if (customer != null) { totalBalance = 0; for (Account account: customer.accounts) { totalBalance += account.balance; } } return totalBalance; } ... } public class Bank { ... private Map<String, Account> customers = new HashMap<String, Customer>(); public Integer totalAccountBalance(String customerId) { Integer totalBalance = null; Customer customer = this.customers.get(customerId); if (customer != null) { totalBalance = 0; for (Account account: customer.accounts) { totalBalance += account.balance; } } return totalBalance; } ... } Pick implementation classes for collections. Pick implementation classes for collections. Deal with bidirectional relationships. Deal with bidirectional relationships. Choose representations for efficient computation. Choose representations for efficient computation. Decide on (generally sequential) control structuring. Decide on (generally sequential) control structuring.
  • 6. We can model that!We can model that! UML began as a notation for models of programs. But UML 2 has constructs that allow the specification of Turing- complete computation models. •Foundational UML (fUML) provides precise execution semantics. •Action Language for fUML (Alf) provides a textual notation. Executable UML models are programs customer = Customer -> select c (c.customerId == customerId); totalBalance = customer.accounts.balance -> reduce '+'; customer = Customer -> select c (c.customerId == customerId); totalBalance = customer.accounts.balance -> reduce '+'; Alf … and a value called “totalBalance” that is sum of the customer’s account balances. … and a value called “totalBalance” that is sum of the customer’s account balances. There is a customer identified by “customerId”… There is a customer identified by “customerId”…
  • 7. We can model that! UML is common for domain modeling public class Bank { private String bankId; private Set<Customer> customers; private Set<Account> accounts; ... } public class Bank { private String bankId; private Set<Customer> customers; private Set<Account> accounts; ... } public class Customer { private String customerId; private Set<Account> accounts; ... } public class Customer { private String customerId; private Set<Account> accounts; ... } public class Account { private String accountId; private int balance = 0; private Set<Customer> accountOwners; ... } public class Account { private String accountId; private int balance = 0; private Set<Customer> accountOwners; ... } The UML model directly corresponds to the program design… The UML model directly corresponds to the program design… …but abstracts away from implementation details (like collection classes). …but abstracts away from implementation details (like collection classes). It also shows some things implicit in the program, like association composition and bidirectionality. It also shows some things implicit in the program, like association composition and bidirectionality.
  • 8. We can model that! But diagrams are just notation class Bank { public bankId: String; public customers: compose Customer[*]; public accounts: compose Account[*]; } class Bank { public bankId: String; public customers: compose Customer[*]; public accounts: compose Account[*]; } assoc AccountOwnership { public accountOwners: Customer[*]; public accounts: Account[*]; } assoc AccountOwnership { public accountOwners: Customer[*]; public accounts: Account[*]; } class Account { public accountId: String; public balance: Integer = 0; } class Account { public accountId: String; public balance: Integer = 0; } class Customer { public customerId: String; } class Customer { public customerId: String; } A UML class model has semantics independent of its mapping to any other language… A UML class model has semantics independent of its mapping to any other language… …which can be notated textually as well as graphically. …which can be notated textually as well as graphically.
  • 9. We can model that! Computation can be modeled, too class Bank { public bankId: String; public customers: compose Customer[*]; public accounts: compose Account[*]; public totalAccountBalance(in customerId: String): Integer[0..1] { customer = this.customers -> select c (c.customerId == customerId); return customer.accounts.balance -> reduce '+'; } ... } class Bank { public bankId: String; public customers: compose Customer[*]; public accounts: compose Account[*]; public totalAccountBalance(in customerId: String): Integer[0..1] { customer = this.customers -> select c (c.customerId == customerId); return customer.accounts.balance -> reduce '+'; } ... } The underlying semantics are based on data-flow, not an implicit von Neumann architecture. The underlying semantics are based on data-flow, not an implicit von Neumann architecture. These actions are inherently concurrent. These actions are inherently concurrent. …with far fewer implementation commitments. …with far fewer implementation commitments.
  • 10. We can model that! And declarative constraints, too A UML constraint can be specified using a UML behavior. A UML constraint can be specified using a UML behavior.
  • 11. We can model that! Allowing deductions to be made Given the accounts of a customer, the totalBalance can be derived. Given the accounts of a customer, the totalBalance can be derived. Given the accountOwners of an account, the owning bank can be deduced (or validated). Given the accountOwners of an account, the owning bank can be deduced (or validated).
  • 12. We can model that!We can model that! A combined modeling/programming language should: •Be designed to express both problem and solution domain models, not just abstract hardware computing paradigms •Have formal semantics that allow reasoning about models, with execution semantics for behavioral models •Have a textual notation for representing and reasoning on all types of models, with graphical notations allowing multiple views of the same model Combining modeling and programming
  • 13. We can model that!We can model that! • Models can be given precise semantics. • Not all model semantics are execution semantics. – E.g., requirements models, architectural models, business models… • Some models have execution semantics, and these are programs. • Executable models in context of wider modeling allows deductive or inductive reasoning combined with execution and testing Why is this a good idea?