SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
DCI
- How to get ahead in software architecture
About me
Andreas Söderlund
Independent consultant in northern Sweden.
Worked on larger web systems and applications for 10-15 years, specializing in
system integration and architecture.
● E-commerce
● Banking
● Large-scale social platforms.
Haxe projects
Haxigniter, ufront, erazor, unject, umock, Haxedci, HaxeContracts
FORTRAN - IBM Mathematical Formula Translating System
COBOL - COmmon Business-Oriented Language
The roots of programming
"Formula translating", "Business-oriented"
Mapping from one language to another
"An explanation of someone's thought
process about how something works in
the real world."
Mental Models
"Lift the receiver and call the person you
want to reach by turning the circular
wheel."
Object terminology (receiver, wheel)
- with a function (call a person)
- based on a form (the phone).
"I need a container to get the wasp out."
Form & Function
The form enables the function
Mental Model Matching
When the mental model matches, the objects you control becomes an
extension of your mind.
It feels like you are directly manipulating the system.
Mental Model Matching...?
When the mental model mismatches, you lose control.
The programmers mental model mismatched the users.
Note: All unit tests passed in the software above!
The System
Objects with form... ...that can have different types of function
Mental models: Thought processes about the behavior of the above
Maybe all this can be called a system.
And the form of the system, its architecture?
"A set of interacting components forming an integrated whole"
Making a digital ordering
system for restaurants.
Designing a System
There must be a register with name and
birthdate of all employees.
Use when:
- Serving food
- Cooking food
- Customer pays bill
- Manager pays salary
class Employee
{
public var name : String;
public var birth : Date;
}
class Waiter extends Employee
{
}
class Chef extends Employee
{
}
class Manager extends Employee
{
}
class Employee
{
public var name : String;
public var birth : Date;
}
class Waiter extends Employee
{
}
class Chef extends Employee
{
}
class Manager extends Employee
{
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The mental model of serving guests at
a Restaurant:
Designing a System
Part I
Inheritance
The Manager can also be a Chef and Waiter, if
the restaurant is small.
class Employee
{
public var name : String;
public var birth : Date;
public function serveFood() {}
public function cookFood() {}
public function bringBill() {}
}
class Waiter extends Employee
{
}
class Chef extends Employee
{
}
class Manager extends Employee
{
public function paySalaries() {}
}
I refuse to
deal with
customers!
I'm a great
waiter, but I
can't cook!
Part I.5: Multiple
Inheritance
The Manager can also be a Chef and Waiter, if
the restaurant is small.
class Employee
{
public var name : String;
public var birth : Date;
}
class Waiter extends Employee
{
public function serveFood() {}
public function bringBill() {}
}
class Chef extends Employee
{
public function cookFood() {}
}
class Manager extends Employee
{
public function paySalaries() {}
}
class ChefManager extends Chef extends Manager
{
}
class WaiterManager extends Waiter extends Manager
{
}
Not all Managers are both Chefs and Waiters of
course!
...what if even more employee types are
added?
...and how to instantiate this hierarchy?
Part II
Interfaces
class Employee
{
public var name : String;
public var birth : Date;
}
interface IChef
{
function cookFood() : Food;
}
interface IWait
{
function serveFood(f : Food) : Void;
function bringBill() : Money;
}
interface IManage
{
function paySalaries() : Void;
}
class Chef extends Employee implements IChef
{
public function cookFood() {}
}
class Waiter extends Employee implements IWait
{
public function serveFood(f : Food) {}
public function bringBill() {}
}
class Manager extends Employee implements IManage
{
public function paySalaries() {}
}
class ChefManager extends Manager implements IChef
{
public function cookFood() {}
}
class WaiterManager extends Manager ...
...
This is a beautiful architecture:
This code doesn’t have a beautiful form and
architecture.
Part II
Interfaces
class Employee
{
public var name : String;
public var birth : Date;
}
interface IChef
{
function cookFood() : Food;
}
interface IWait
{
function serveFood(f : Food) : Void;
function bringBill() : Money;
}
interface IManage
{
function paySalaries() : Void;
}
class Chef extends Employee implements IChef
{
public function cookFood() {}
}
class Waiter extends Employee implements IWait
{
public function serveFood(f : Food) {}
public function bringBill() {}
}
class Manager extends Employee implements IManage
{
public function paySalaries() {}
}
class ChefManager extends Manager implements IChef
{
public function cookFood() {}
}
class WaiterManager extends Manager ...
...
The code looks more like this:
Part II
Interfaces
The system form is not a representation of
the user mental model anymore (maybe
somewhere deep within), it's more and more
about engineering.
Want some Design Patterns with that?
- Abstract Factory
- Adapter
- Command
- Decorator
- Flyweight
- Memento
- Strategy
- Visitor
- ...
class Employee
{
public var name : String;
public var birth : Date;
}
interface IChef
{
function cookFood() : Food;
}
interface IWait
{
function serveFood(f : Food) : Void;
function bringBill() : Money;
}
interface IManage
{
function paySalaries() : Void;
}
class Chef extends Employee implements IChef
{
public function cookFood() {}
}
class Waiter extends Employee implements IWait
{
public function serveFood(f : Food) {}
public function bringBill() {}
}
class Manager extends Employee implements IManage
{
public function paySalaries() {}
}
class ChefManager extends Manager implements IChef
{
public function cookFood() {}
}
class WaiterManager extends Manager ...
...
Part II
Interfaces
class Employee
{
public var name : String;
public var birth : Date;
}
interface IChef
{
function cookFood() : Food;
}
interface IWait
{
function serveFood(f : Food) : Void;
function bringBill() : Money;
}
interface IManage
{
function paySalaries() : Void;
}
class Chef extends Employee implements IChef
{
public function cookFood() {}
}
class Waiter extends Employee implements IWait
{
public function serveFood(f : Food) {}
public function bringBill() {}
}
class Manager extends Employee implements IManage
{
public function paySalaries() {}
}
class ChefManager extends Manager implements IChef
{
public function cookFood() {}
}
class WaiterManager extends Manager ...
...
Want some Patterns with that?
- Abstract Factory
- Adapter
- Command
- Decorator
- Flyweight
- Lock
- Memento
- Strategy
- Visitor
- ...
Design patterns can be useful as implementation, but not as a user mental model and architecture.
However, there are patterns that are used to align a user mental model with the computer, like MVC.
This is an "indoor session initializer" because
there is a session that counts the number of bla
bla… (Nerd forcing mental model onto user)
Part III
Services
class Employee
{
public var name : String;
public var birth : Date;
}
interface IChefService
{
function cookFood(Employee e) : Food;
}
class ChefService implements IChefService
{
public Food cookFood(Employee e) { … }
}
// The program
static function main()
{
var chefService = Services.Get(IChefService);
var chef = Employee.Get(2);
chefService.cookFood(chef);
}
Object model mismatch. We move from “who
does what” to “what happens”. Too imperative
and all-knowing.
Information is abstracted away through
interfaces.
Part IV
DCI
Data, Context, Interaction
Inventors of DCI
Trygve Reenskaug
Inventor of MVC
Wrote CAD-software in the 60’s
Professor Emeritus, Oslo
James “Cope” Coplien
Author of several influential C++ books
Created most cited patent in software history
Chair CS 2003-2004, Brussels
Patterns, Scrum, Agile, Lean...
class Employee
{
public var name : String;
public var birth : Date;
}
● Chef - Cook food
● Waiter - Serve food, bring the bill
● Manager - Pay salary
Data
Function
class Employee
{
public var name : String;
public var birth : Date;
}
Data
Function
public function cookFood()
public function serveFood()
public function bringBill()
public function paySalaries()
Waiter
Waiter
Manager
Chef
If an Employee object
could attach the
cookFood() method...
then it could be a
Chef!
We cannot do it in classes (we tried in part I-
III), so it seems like it must be a more
dynamic operation.
class Employee
{
public var name : String;
public var birth : Date;
}
Data
Function
public function cookFood()
public function serveFood()
public function bringBill()
public function paySalaries()
Waiter
Waiter
Manager
Chef
Employee
object
public function
cookFood()
This Employee object can now play the Role of a Chef!
class Employee
{
public var name : String;
public var birth : Date;
}
Data Function
public function cookFood()
public function serveFood()
public function bringBill()
public function paySalaries()
Waiter
Waiter
Manager
Chef
Employee
object
public function
cookFood()
Now
a Chef
... a little later in
the program...
Same
Employee
object
public function cookFood()
{}
Later
a Manager
public function
paySalaries()
A Role is only relevant in a specific Context.
Roles and Contexts
A Mental Model can be represented as a Context!
Chef.cookFood()
vs.
Chef.cookFood()
Part IV
DCI
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
Part IV
DCI
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
Remember from part I-III:
The methods cannot go in the data
class, they should be attached by some
means.
Where to put the methods, the
functionality?
Part IV
DCI
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
@role var waiter = {}
@role var guests = {}
@role var chef = {}
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
Guests ChefWaiter
guestsArriving()
selectFrom(menu)
takeOrder(order)
cook(order)
serve(food)
Part IV
DCI
"The waiter walks up to the guests and shows them the menu. He takes the order and passes it on
to the chef. The chef cooks the food, which is brought out to the guests by the waiter.
Part IV
DCI
The current “OO” way of
creating object communication:
Passing messages between
objects wherever and whenever
it is needed.
- Too chaotic
- No separation of data and behavior
- Can only see one object at a time
- Reasoning about system behavior
and functionality is very hard.
- Prevents object communication
- Creates a complex all-knowing
algorithm
- Basically a step back to Pascal
and Fortran.
Procedural thinking,
implemented as the
Mediator pattern.
- State and behavior is distributed
among the objects
- Creates a network of
collaborating objects
- We can reason about system
behavior at runtime!
DCI: A middle road,
distributed logic
under full control,
encapsulated in a
Context
Guests ChefWaiter
guestsArriving()
selectFrom(menu)
takeOrder(order)
cook(order)
serve(food)
Part IV
DCI
"The waiter walks up to the guests and shows them the menu. He takes the order and passes it on
to the chef. The chef cooks the food, which is brought out to the guests by the waiter.
Runtime
interaction!
Part IV
DCI
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
@role var waiter = {}
@role var guests = {}
@role var chef = {}
public function new(employeeWaiter,
employeeChef,
guestList)
{
this.waiter = employeeWaiter;
this.chef = employeeChef;
this.guests = guestList;
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
// System operation (Event)
public function guestsArriving()
{
waiter.guestsArriving();
}
}
Part IV
DCI
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
@role var waiter =
{
function guestsArriving() : Void
{
var menu = “1: Roast beef. 2: ...”;
guests.selectFrom(menu);
}
}
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
Part IV
DCI
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
@role var waiter =
{
function guestsArriving() : Void
{
var menu = “1: Roast beef. 2: ...”;
guests.selectFrom(menu);
}
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:@role var guests =
{
function selectFrom(menu) : Void
{
Sys.println(menu);
order = Sys.stdin().readLine();
waiter.takeOrder(order);
}
}
}
Part IV
DCI
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
@role var waiter =
{
function guestsArriving() : Void
{
var menu = “1: Roast beef. 2: ...”;
guests.selectFrom(menu);
}
function takeOrder(order) : Void
{
Sys.println("Thank you.");
chef.cook(order);
}
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
@role var guests =
{
function selectFrom(menu) : Void
{
Sys.println(menu);
var order = Sys.stdin().readLine();
waiter.takeOrder(order);
}
}
}
Part IV
DCI
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
// Context (Mental Model)
class ServeGuests implements haxedci.Context
{
public function new(...)
{
this.waiter = employeeWaiter;
this.guests = listGuests;
this.chef = employeeChef;
}
"The waiter walks up to the guests and
shows them the menu. He takes the
order and passes it on to the chef. The
chef cooks the food, which is brought
out to the guests by the waiter.
After the meal the waiter brings the bill
to the guests, and collects the
payment."
The Context (Mental Model) of serving
guests at a Restaurant:
// System operation (Event)
public function guestsArriving()
{
waiter.guestsArriving();
}
// System operation (Event)
public function guestsPaying()
{
waiter.bringBill();
}
}
If "self" in the role doesn't reference
the object itself, it's not DCI.
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
// Role
@role var waiter =
{
// RoleInterface
var roleInterface : {
var name : String;
}
// RoleMethods
function guestsArriving() : Void
{
Sys.println(self.name);
context.guests.selectFrom(menu);
}
...
}
Part IV
DCI
A DCI Role has a RoleInterface and
RoleMethods. The Role is private to its
Context.
The execution model for DCI is
different, adding new keywords: role
and context.
Object identity MUST be preserved!
(not equality, identity!)
The Employee Data (Form)
matches the RoleInterface, so
it can play the waiter Role.
Form matches the
RoleInterface for the
Role “container” in
the Context
“Remove Insect”
So what is DCI?
// Data (Form)
class Employee
{
public var name : String;
public var birth : Date;
}
// Context (Mental model/Use case/Algorithm)
class ServeGuests implements haxedci.Context
{
@role var waiter =
{
// RoleInterface (Compatible Form)
var roleInterface : {
var name : String;
}
// RoleMethods (Function)
function guestsArriving() : Void
{
var menu = new List<String>();
// Interaction (System behavior)
guests.selectFrom(menu);
}
}
// System operation (Events)
public function guestsArriving() : Void
{
waiter.guestsArriving();
}
}
A method of reflecting user mental
models in code.
A way of separating what the system IS
(Data, slowly changing) from what it DOES
(Function, quickly changing).
Allows reasoning about the correctness
of system functionality, not just
class/method functionality. We can
observe exactly what happens at
runtime. No Polymorphism.
Behavior is put back within the
boundaries of a human mental model,
not spread across classes, services,
patterns...
So what is DCI?
class Employee
{
public var name : String;
public var birth : Date;
}
class ServeGuests implements haxedci.Context
{
@role var waiter =
{
var roleInterface : {
var name : String;
}
function guestsArriving() : Void
{
var menu = new List<String>();
guests.selectFrom(menu);
}
}
public function guestsArriving() : Void
{
waiter.guestsArriving();
}
}
A method of reflecting user mental
models in code.
A way of separating what the system IS
(Data, slowly changing) from what it DOES
(Function, quickly changing).
Allows reasoning about the correctness
of system functionality, not just
class/method functionality. We can
observe exactly what happens at
runtime. No Polymorphism.
Behavior is put back within the
boundaries of a human mental model,
not spread across classes, services,
patterns...
Questions?
DCI Headquarters:
http://fulloo.info
Google “haxedci”
Thank you!
andreas@ivento.se
github.com/ciscoheat
google “haxedci”

Weitere ähnliche Inhalte

Andere mochten auch

Data Center Interconnects: An Overview
Data Center Interconnects: An OverviewData Center Interconnects: An Overview
Data Center Interconnects: An OverviewXO Communications
 
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...Comarch
 
Container as a Service with Docker
Container as a Service with DockerContainer as a Service with Docker
Container as a Service with DockerPatrick Chanezon
 
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...Indonesia Network Operators Group
 
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...Pôle Systematic Paris-Region
 
Serverless computing and Function-as-a-Service (FaaS)
Serverless computing and Function-as-a-Service (FaaS)Serverless computing and Function-as-a-Service (FaaS)
Serverless computing and Function-as-a-Service (FaaS)Moritz Strube
 
Data Center Network Trends - Lin Nease
Data Center Network Trends - Lin NeaseData Center Network Trends - Lin Nease
Data Center Network Trends - Lin NeaseHPDutchWorld
 
How will virtual networks, controlled by software, impact OSS systems?
How will virtual networks, controlled by software, impact OSS systems?How will virtual networks, controlled by software, impact OSS systems?
How will virtual networks, controlled by software, impact OSS systems?Comarch
 
Data center interconnect seamlessly through SDN
Data center interconnect seamlessly through SDNData center interconnect seamlessly through SDN
Data center interconnect seamlessly through SDNFelecia Fierro
 
Function as a Service: IT forum expo 2017
Function as a Service: IT forum expo 2017Function as a Service: IT forum expo 2017
Function as a Service: IT forum expo 2017Igor Rosa Macedo
 
DCI - the architecture from the future
DCI - the architecture from the futureDCI - the architecture from the future
DCI - the architecture from the futureAndrzej Krzywda
 
Managing change in the data center network
Managing change in the data center networkManaging change in the data center network
Managing change in the data center networkInterop
 
Nexus 7000 Series Innovations: M3 Module, DCI, Scale
Nexus 7000 Series Innovations: M3 Module, DCI, ScaleNexus 7000 Series Innovations: M3 Module, DCI, Scale
Nexus 7000 Series Innovations: M3 Module, DCI, ScaleTony Antony
 
A Look Inside Google’s Data Center Networks
A Look Inside Google’s Data Center NetworksA Look Inside Google’s Data Center Networks
A Look Inside Google’s Data Center NetworksRyousei Takano
 
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity Services
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity ServicesSummit 16: Open-O Mini-Summit - Orchestrating Network Connectivity Services
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity ServicesOPNFV
 

Andere mochten auch (16)

Data Center Interconnects: An Overview
Data Center Interconnects: An OverviewData Center Interconnects: An Overview
Data Center Interconnects: An Overview
 
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...
How to adopt SDN/NFV Technology into the BSS & OSS stack and shorten the time...
 
Container as a Service with Docker
Container as a Service with DockerContainer as a Service with Docker
Container as a Service with Docker
 
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...
06 - IDNOG04 - Dion Leung (Coriant) - Emerging Trends & Real Deployments for ...
 
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...
PyParis2017 / Function-as-a-service - a pythonic perspective on severless com...
 
Serverless computing and Function-as-a-Service (FaaS)
Serverless computing and Function-as-a-Service (FaaS)Serverless computing and Function-as-a-Service (FaaS)
Serverless computing and Function-as-a-Service (FaaS)
 
Data Center Network Trends - Lin Nease
Data Center Network Trends - Lin NeaseData Center Network Trends - Lin Nease
Data Center Network Trends - Lin Nease
 
How will virtual networks, controlled by software, impact OSS systems?
How will virtual networks, controlled by software, impact OSS systems?How will virtual networks, controlled by software, impact OSS systems?
How will virtual networks, controlled by software, impact OSS systems?
 
Data center interconnect seamlessly through SDN
Data center interconnect seamlessly through SDNData center interconnect seamlessly through SDN
Data center interconnect seamlessly through SDN
 
Function as a Service: IT forum expo 2017
Function as a Service: IT forum expo 2017Function as a Service: IT forum expo 2017
Function as a Service: IT forum expo 2017
 
DCI - the architecture from the future
DCI - the architecture from the futureDCI - the architecture from the future
DCI - the architecture from the future
 
Managing change in the data center network
Managing change in the data center networkManaging change in the data center network
Managing change in the data center network
 
Nexus 7000 Series Innovations: M3 Module, DCI, Scale
Nexus 7000 Series Innovations: M3 Module, DCI, ScaleNexus 7000 Series Innovations: M3 Module, DCI, Scale
Nexus 7000 Series Innovations: M3 Module, DCI, Scale
 
Data center network reference architecture with hpe flex fabric
Data center network reference architecture with hpe flex fabricData center network reference architecture with hpe flex fabric
Data center network reference architecture with hpe flex fabric
 
A Look Inside Google’s Data Center Networks
A Look Inside Google’s Data Center NetworksA Look Inside Google’s Data Center Networks
A Look Inside Google’s Data Center Networks
 
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity Services
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity ServicesSummit 16: Open-O Mini-Summit - Orchestrating Network Connectivity Services
Summit 16: Open-O Mini-Summit - Orchestrating Network Connectivity Services
 

Ähnlich wie Haxe dci-presentation by Andreas SÖDERLUND

Reviewing OOP Design patterns
Reviewing OOP Design patternsReviewing OOP Design patterns
Reviewing OOP Design patternsOlivier Bacs
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design patternAhmad Alkhous
 
OOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsOOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsChris Tankersley
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09Daniel Bryant
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin GeneratorJohn Cleveley
 
Pragmatic Functional Refactoring with Java 8
Pragmatic Functional Refactoring with Java 8Pragmatic Functional Refactoring with Java 8
Pragmatic Functional Refactoring with Java 8Codemotion
 
The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)Scott Wlaschin
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnetrainynovember12
 
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows AzureDeveloping Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows AzureRainer Stropek
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionDzmitry Ivashutsin
 
Android DataBinding (ViewModel, UI Modularization and Testing)
Android DataBinding (ViewModel, UI Modularization and Testing)Android DataBinding (ViewModel, UI Modularization and Testing)
Android DataBinding (ViewModel, UI Modularization and Testing)Yongjun Kim
 
computerscience-170129081612.pdf
computerscience-170129081612.pdfcomputerscience-170129081612.pdf
computerscience-170129081612.pdfKiranKumari204016
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...Ben Teese
 

Ähnlich wie Haxe dci-presentation by Andreas SÖDERLUND (20)

Jsf intro
Jsf introJsf intro
Jsf intro
 
Reviewing OOP Design patterns
Reviewing OOP Design patternsReviewing OOP Design patterns
Reviewing OOP Design patterns
 
JAX 08 - Agile RCP
JAX 08 - Agile RCPJAX 08 - Agile RCP
JAX 08 - Agile RCP
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design pattern
 
OOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsOOP Is More Than Cars and Dogs
OOP Is More Than Cars and Dogs
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
Pragmatic Functional Refactoring with Java 8
Pragmatic Functional Refactoring with Java 8Pragmatic Functional Refactoring with Java 8
Pragmatic Functional Refactoring with Java 8
 
The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)
 
Rcp by example
Rcp by exampleRcp by example
Rcp by example
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnet
 
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows AzureDeveloping Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
Developing Android and iOS Apps With C#, .NET, Xamarin, Mono, and Windows Azure
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
Gwt and Xtend
Gwt and XtendGwt and Xtend
Gwt and Xtend
 
Itjsf13
Itjsf13Itjsf13
Itjsf13
 
Itjsf13
Itjsf13Itjsf13
Itjsf13
 
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency Injection
 
Android DataBinding (ViewModel, UI Modularization and Testing)
Android DataBinding (ViewModel, UI Modularization and Testing)Android DataBinding (ViewModel, UI Modularization and Testing)
Android DataBinding (ViewModel, UI Modularization and Testing)
 
computerscience-170129081612.pdf
computerscience-170129081612.pdfcomputerscience-170129081612.pdf
computerscience-170129081612.pdf
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
 

Mehr von Grégory PARODI (9)

Template slide for SILEX
Template slide for SILEXTemplate slide for SILEX
Template slide for SILEX
 
Rio
RioRio
Rio
 
san fransisco
san fransiscosan fransisco
san fransisco
 
Vietnam
VietnamVietnam
Vietnam
 
miss
missmiss
miss
 
Lion
LionLion
Lion
 
Leopard
LeopardLeopard
Leopard
 
Bigpics 1
Bigpics 1Bigpics 1
Bigpics 1
 
thaillande
thaillandethaillande
thaillande
 

Kürzlich hochgeladen

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...nirzagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...tanu pandey
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceEscorts Call Girls
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋nirzagarg
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 

Kürzlich hochgeladen (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 

Haxe dci-presentation by Andreas SÖDERLUND

  • 1. DCI - How to get ahead in software architecture
  • 2. About me Andreas Söderlund Independent consultant in northern Sweden. Worked on larger web systems and applications for 10-15 years, specializing in system integration and architecture. ● E-commerce ● Banking ● Large-scale social platforms. Haxe projects Haxigniter, ufront, erazor, unject, umock, Haxedci, HaxeContracts
  • 3. FORTRAN - IBM Mathematical Formula Translating System COBOL - COmmon Business-Oriented Language The roots of programming "Formula translating", "Business-oriented" Mapping from one language to another
  • 4. "An explanation of someone's thought process about how something works in the real world." Mental Models "Lift the receiver and call the person you want to reach by turning the circular wheel." Object terminology (receiver, wheel) - with a function (call a person) - based on a form (the phone).
  • 5. "I need a container to get the wasp out." Form & Function The form enables the function
  • 6. Mental Model Matching When the mental model matches, the objects you control becomes an extension of your mind. It feels like you are directly manipulating the system.
  • 7. Mental Model Matching...? When the mental model mismatches, you lose control. The programmers mental model mismatched the users. Note: All unit tests passed in the software above!
  • 8. The System Objects with form... ...that can have different types of function Mental models: Thought processes about the behavior of the above Maybe all this can be called a system. And the form of the system, its architecture? "A set of interacting components forming an integrated whole"
  • 9. Making a digital ordering system for restaurants. Designing a System There must be a register with name and birthdate of all employees. Use when: - Serving food - Cooking food - Customer pays bill - Manager pays salary class Employee { public var name : String; public var birth : Date; } class Waiter extends Employee { } class Chef extends Employee { } class Manager extends Employee { }
  • 10. class Employee { public var name : String; public var birth : Date; } class Waiter extends Employee { } class Chef extends Employee { } class Manager extends Employee { } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The mental model of serving guests at a Restaurant: Designing a System
  • 11. Part I Inheritance The Manager can also be a Chef and Waiter, if the restaurant is small. class Employee { public var name : String; public var birth : Date; public function serveFood() {} public function cookFood() {} public function bringBill() {} } class Waiter extends Employee { } class Chef extends Employee { } class Manager extends Employee { public function paySalaries() {} } I refuse to deal with customers! I'm a great waiter, but I can't cook!
  • 12. Part I.5: Multiple Inheritance The Manager can also be a Chef and Waiter, if the restaurant is small. class Employee { public var name : String; public var birth : Date; } class Waiter extends Employee { public function serveFood() {} public function bringBill() {} } class Chef extends Employee { public function cookFood() {} } class Manager extends Employee { public function paySalaries() {} } class ChefManager extends Chef extends Manager { } class WaiterManager extends Waiter extends Manager { } Not all Managers are both Chefs and Waiters of course! ...what if even more employee types are added? ...and how to instantiate this hierarchy?
  • 13. Part II Interfaces class Employee { public var name : String; public var birth : Date; } interface IChef { function cookFood() : Food; } interface IWait { function serveFood(f : Food) : Void; function bringBill() : Money; } interface IManage { function paySalaries() : Void; } class Chef extends Employee implements IChef { public function cookFood() {} } class Waiter extends Employee implements IWait { public function serveFood(f : Food) {} public function bringBill() {} } class Manager extends Employee implements IManage { public function paySalaries() {} } class ChefManager extends Manager implements IChef { public function cookFood() {} } class WaiterManager extends Manager ... ... This is a beautiful architecture: This code doesn’t have a beautiful form and architecture.
  • 14. Part II Interfaces class Employee { public var name : String; public var birth : Date; } interface IChef { function cookFood() : Food; } interface IWait { function serveFood(f : Food) : Void; function bringBill() : Money; } interface IManage { function paySalaries() : Void; } class Chef extends Employee implements IChef { public function cookFood() {} } class Waiter extends Employee implements IWait { public function serveFood(f : Food) {} public function bringBill() {} } class Manager extends Employee implements IManage { public function paySalaries() {} } class ChefManager extends Manager implements IChef { public function cookFood() {} } class WaiterManager extends Manager ... ... The code looks more like this:
  • 15. Part II Interfaces The system form is not a representation of the user mental model anymore (maybe somewhere deep within), it's more and more about engineering. Want some Design Patterns with that? - Abstract Factory - Adapter - Command - Decorator - Flyweight - Memento - Strategy - Visitor - ... class Employee { public var name : String; public var birth : Date; } interface IChef { function cookFood() : Food; } interface IWait { function serveFood(f : Food) : Void; function bringBill() : Money; } interface IManage { function paySalaries() : Void; } class Chef extends Employee implements IChef { public function cookFood() {} } class Waiter extends Employee implements IWait { public function serveFood(f : Food) {} public function bringBill() {} } class Manager extends Employee implements IManage { public function paySalaries() {} } class ChefManager extends Manager implements IChef { public function cookFood() {} } class WaiterManager extends Manager ... ...
  • 16. Part II Interfaces class Employee { public var name : String; public var birth : Date; } interface IChef { function cookFood() : Food; } interface IWait { function serveFood(f : Food) : Void; function bringBill() : Money; } interface IManage { function paySalaries() : Void; } class Chef extends Employee implements IChef { public function cookFood() {} } class Waiter extends Employee implements IWait { public function serveFood(f : Food) {} public function bringBill() {} } class Manager extends Employee implements IManage { public function paySalaries() {} } class ChefManager extends Manager implements IChef { public function cookFood() {} } class WaiterManager extends Manager ... ... Want some Patterns with that? - Abstract Factory - Adapter - Command - Decorator - Flyweight - Lock - Memento - Strategy - Visitor - ... Design patterns can be useful as implementation, but not as a user mental model and architecture. However, there are patterns that are used to align a user mental model with the computer, like MVC. This is an "indoor session initializer" because there is a session that counts the number of bla bla… (Nerd forcing mental model onto user)
  • 17. Part III Services class Employee { public var name : String; public var birth : Date; } interface IChefService { function cookFood(Employee e) : Food; } class ChefService implements IChefService { public Food cookFood(Employee e) { … } } // The program static function main() { var chefService = Services.Get(IChefService); var chef = Employee.Get(2); chefService.cookFood(chef); } Object model mismatch. We move from “who does what” to “what happens”. Too imperative and all-knowing. Information is abstracted away through interfaces.
  • 19. Inventors of DCI Trygve Reenskaug Inventor of MVC Wrote CAD-software in the 60’s Professor Emeritus, Oslo James “Cope” Coplien Author of several influential C++ books Created most cited patent in software history Chair CS 2003-2004, Brussels Patterns, Scrum, Agile, Lean...
  • 20. class Employee { public var name : String; public var birth : Date; } ● Chef - Cook food ● Waiter - Serve food, bring the bill ● Manager - Pay salary Data Function
  • 21. class Employee { public var name : String; public var birth : Date; } Data Function public function cookFood() public function serveFood() public function bringBill() public function paySalaries() Waiter Waiter Manager Chef If an Employee object could attach the cookFood() method... then it could be a Chef! We cannot do it in classes (we tried in part I- III), so it seems like it must be a more dynamic operation.
  • 22. class Employee { public var name : String; public var birth : Date; } Data Function public function cookFood() public function serveFood() public function bringBill() public function paySalaries() Waiter Waiter Manager Chef Employee object public function cookFood() This Employee object can now play the Role of a Chef!
  • 23. class Employee { public var name : String; public var birth : Date; } Data Function public function cookFood() public function serveFood() public function bringBill() public function paySalaries() Waiter Waiter Manager Chef Employee object public function cookFood() Now a Chef ... a little later in the program... Same Employee object public function cookFood() {} Later a Manager public function paySalaries()
  • 24. A Role is only relevant in a specific Context. Roles and Contexts A Mental Model can be represented as a Context! Chef.cookFood() vs. Chef.cookFood()
  • 25. Part IV DCI // Data (Form) class Employee { public var name : String; public var birth : Date; } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant:
  • 26. Part IV DCI // Data (Form) class Employee { public var name : String; public var birth : Date; } Remember from part I-III: The methods cannot go in the data class, they should be attached by some means. Where to put the methods, the functionality?
  • 27. Part IV DCI // Data (Form) class Employee { public var name : String; public var birth : Date; } // Context (Mental Model) class ServeGuests implements haxedci.Context { @role var waiter = {} @role var guests = {} @role var chef = {} } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant:
  • 28. Guests ChefWaiter guestsArriving() selectFrom(menu) takeOrder(order) cook(order) serve(food) Part IV DCI "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter.
  • 29. Part IV DCI The current “OO” way of creating object communication: Passing messages between objects wherever and whenever it is needed. - Too chaotic - No separation of data and behavior - Can only see one object at a time - Reasoning about system behavior and functionality is very hard. - Prevents object communication - Creates a complex all-knowing algorithm - Basically a step back to Pascal and Fortran. Procedural thinking, implemented as the Mediator pattern. - State and behavior is distributed among the objects - Creates a network of collaborating objects - We can reason about system behavior at runtime! DCI: A middle road, distributed logic under full control, encapsulated in a Context
  • 30. Guests ChefWaiter guestsArriving() selectFrom(menu) takeOrder(order) cook(order) serve(food) Part IV DCI "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. Runtime interaction!
  • 31. Part IV DCI // Data (Form) class Employee { public var name : String; public var birth : Date; } // Context (Mental Model) class ServeGuests implements haxedci.Context { @role var waiter = {} @role var guests = {} @role var chef = {} public function new(employeeWaiter, employeeChef, guestList) { this.waiter = employeeWaiter; this.chef = employeeChef; this.guests = guestList; } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant: // System operation (Event) public function guestsArriving() { waiter.guestsArriving(); } }
  • 32. Part IV DCI // Context (Mental Model) class ServeGuests implements haxedci.Context { @role var waiter = { function guestsArriving() : Void { var menu = “1: Roast beef. 2: ...”; guests.selectFrom(menu); } } } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant:
  • 33. Part IV DCI // Context (Mental Model) class ServeGuests implements haxedci.Context { @role var waiter = { function guestsArriving() : Void { var menu = “1: Roast beef. 2: ...”; guests.selectFrom(menu); } } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant:@role var guests = { function selectFrom(menu) : Void { Sys.println(menu); order = Sys.stdin().readLine(); waiter.takeOrder(order); } } }
  • 34. Part IV DCI // Context (Mental Model) class ServeGuests implements haxedci.Context { @role var waiter = { function guestsArriving() : Void { var menu = “1: Roast beef. 2: ...”; guests.selectFrom(menu); } function takeOrder(order) : Void { Sys.println("Thank you."); chef.cook(order); } } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant: @role var guests = { function selectFrom(menu) : Void { Sys.println(menu); var order = Sys.stdin().readLine(); waiter.takeOrder(order); } } }
  • 35. Part IV DCI // Data (Form) class Employee { public var name : String; public var birth : Date; } // Context (Mental Model) class ServeGuests implements haxedci.Context { public function new(...) { this.waiter = employeeWaiter; this.guests = listGuests; this.chef = employeeChef; } "The waiter walks up to the guests and shows them the menu. He takes the order and passes it on to the chef. The chef cooks the food, which is brought out to the guests by the waiter. After the meal the waiter brings the bill to the guests, and collects the payment." The Context (Mental Model) of serving guests at a Restaurant: // System operation (Event) public function guestsArriving() { waiter.guestsArriving(); } // System operation (Event) public function guestsPaying() { waiter.bringBill(); } }
  • 36. If "self" in the role doesn't reference the object itself, it's not DCI. // Data (Form) class Employee { public var name : String; public var birth : Date; } // Role @role var waiter = { // RoleInterface var roleInterface : { var name : String; } // RoleMethods function guestsArriving() : Void { Sys.println(self.name); context.guests.selectFrom(menu); } ... } Part IV DCI A DCI Role has a RoleInterface and RoleMethods. The Role is private to its Context. The execution model for DCI is different, adding new keywords: role and context. Object identity MUST be preserved! (not equality, identity!) The Employee Data (Form) matches the RoleInterface, so it can play the waiter Role. Form matches the RoleInterface for the Role “container” in the Context “Remove Insect”
  • 37. So what is DCI? // Data (Form) class Employee { public var name : String; public var birth : Date; } // Context (Mental model/Use case/Algorithm) class ServeGuests implements haxedci.Context { @role var waiter = { // RoleInterface (Compatible Form) var roleInterface : { var name : String; } // RoleMethods (Function) function guestsArriving() : Void { var menu = new List<String>(); // Interaction (System behavior) guests.selectFrom(menu); } } // System operation (Events) public function guestsArriving() : Void { waiter.guestsArriving(); } } A method of reflecting user mental models in code. A way of separating what the system IS (Data, slowly changing) from what it DOES (Function, quickly changing). Allows reasoning about the correctness of system functionality, not just class/method functionality. We can observe exactly what happens at runtime. No Polymorphism. Behavior is put back within the boundaries of a human mental model, not spread across classes, services, patterns...
  • 38. So what is DCI? class Employee { public var name : String; public var birth : Date; } class ServeGuests implements haxedci.Context { @role var waiter = { var roleInterface : { var name : String; } function guestsArriving() : Void { var menu = new List<String>(); guests.selectFrom(menu); } } public function guestsArriving() : Void { waiter.guestsArriving(); } } A method of reflecting user mental models in code. A way of separating what the system IS (Data, slowly changing) from what it DOES (Function, quickly changing). Allows reasoning about the correctness of system functionality, not just class/method functionality. We can observe exactly what happens at runtime. No Polymorphism. Behavior is put back within the boundaries of a human mental model, not spread across classes, services, patterns...