SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
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”

Contenu connexe

En vedette

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
 

En vedette (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
 

Similaire à Get Ahead in Software Architecture with DCI

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
 

Similaire à Get Ahead in Software Architecture with DCI (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'...
 

Plus de 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
 

Dernier

AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 

Dernier (20)

AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 

Get Ahead in Software Architecture with DCI

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