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

What's hot (20)

PPT
C and C++ Industrial Training Jalandhar
Dreamtech Labs
 
PPTX
Angular workshop - Full Development Guide
Nitin Giri
 
PPTX
graphics programming in java
Abinaya B
 
DOCX
C Programming
Rumman Ansari
 
PPTX
London F-Sharp User Group : Don Syme on F# - 09/09/2010
Skills Matter
 
PPT
Visual studio 2008
Luis Enrique
 
PPT
Applets - lev' 2
Rakesh T
 
DOC
Project two c++ tutorial
Babatunde Salaam
 
PPTX
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
NicheTech Com. Solutions Pvt. Ltd.
 
PPT
Basics of c++
Huba Akhtar
 
PDF
Itsjustangular
cagataycivici
 
PDF
02. functions & introduction to class
Haresh Jaiswal
 
PDF
C++ book
mailmerk
 
PPTX
C++ language basic
Waqar Younis
 
PPT
OOP in C++
ppd1961
 
PPT
Glimpses of C++0x
ppd1961
 
PDF
C programming
saniabhalla
 
PDF
Deep C
Olve Maudal
 
PDF
Data types in c++
RushikeshGaikwad28
 
C and C++ Industrial Training Jalandhar
Dreamtech Labs
 
Angular workshop - Full Development Guide
Nitin Giri
 
graphics programming in java
Abinaya B
 
C Programming
Rumman Ansari
 
London F-Sharp User Group : Don Syme on F# - 09/09/2010
Skills Matter
 
Visual studio 2008
Luis Enrique
 
Applets - lev' 2
Rakesh T
 
Project two c++ tutorial
Babatunde Salaam
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
NicheTech Com. Solutions Pvt. Ltd.
 
Basics of c++
Huba Akhtar
 
Itsjustangular
cagataycivici
 
02. functions & introduction to class
Haresh Jaiswal
 
C++ book
mailmerk
 
C++ language basic
Waqar Younis
 
OOP in C++
ppd1961
 
Glimpses of C++0x
ppd1961
 
C programming
saniabhalla
 
Deep C
Olve Maudal
 
Data types in c++
RushikeshGaikwad28
 

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

PPTX
Dependency injection - the right way
Thibaud Desodt
 
PDF
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Philip Schwarz
 
PPTX
Introduction to OO, Java and Eclipse/WebSphere
eLink Business Innovations
 
PPTX
Introduction to Domain driven design (LaravelBA #5)
guiwoda
 
ODP
The MirAL Story
Alan Griffiths
 
PPT
C++ basics
husnara mohammad
 
PPTX
WP7 HUB_Introducción a Silverlight
MICTT Palma
 
DOCX
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
sriram sarwan
 
DOCX
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
ruthannemcmullen
 
PPTX
Presentation on visual basic 6 (vb6)
pbarasia
 
PDF
Cbse computer science (c++) class 12 board project bank managment system
pranoy_seenu
 
PPT
c++basics.ppt
TatyaTope4
 
PPT
c++basics.ppt
EPORI
 
PPT
C++basics
JosephAlex21
 
PPT
C++basics
aamirsahito
 
PPT
c++basics.ppt
Infotech27
 
PPT
c++basiccs.ppt
RaghavendraMR5
 
PDF
Please distinguish between the .h and .cpp file, create a fully work.pdf
neerajsachdeva33
 
PPT
The Technical Debt of Programming Languages
Hernan Wilkinson
 
PPT
Avoiding to Reinvent the flat tire
Hernan Wilkinson
 
Dependency injection - the right way
Thibaud Desodt
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Philip Schwarz
 
Introduction to OO, Java and Eclipse/WebSphere
eLink Business Innovations
 
Introduction to Domain driven design (LaravelBA #5)
guiwoda
 
The MirAL Story
Alan Griffiths
 
C++ basics
husnara mohammad
 
WP7 HUB_Introducción a Silverlight
MICTT Palma
 
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
sriram sarwan
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
ruthannemcmullen
 
Presentation on visual basic 6 (vb6)
pbarasia
 
Cbse computer science (c++) class 12 board project bank managment system
pranoy_seenu
 
c++basics.ppt
TatyaTope4
 
c++basics.ppt
EPORI
 
C++basics
JosephAlex21
 
C++basics
aamirsahito
 
c++basics.ppt
Infotech27
 
c++basiccs.ppt
RaghavendraMR5
 
Please distinguish between the .h and .cpp file, create a fully work.pdf
neerajsachdeva33
 
The Technical Debt of Programming Languages
Hernan Wilkinson
 
Avoiding to Reinvent the flat tire
Hernan Wilkinson
 
Ad

More from Ed Seidewitz (20)

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

Recently uploaded (20)

PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 

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?