two system architectures mvc and dca n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Two System Architectures: MVC and DCA PowerPoint Presentation
Download Presentation
Two System Architectures: MVC and DCA

Loading in 2 Seconds...

play fullscreen
1 / 47

Two System Architectures: MVC and DCA - PowerPoint PPT Presentation


  • 82 Views
  • Uploaded on

Two System Architectures: MVC and DCA. Spinoff from the BabyUML project for Readable Programs. Trygve Reenskaug Department of Informatics University of Oslo. trygver@ifi.uio.no http://www.ifi.uio.no/~trygver. an Activity Network Planning example. My Problem. Project resources. User

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Two System Architectures: MVC and DCA' - finna


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
two system architectures mvc and dca
Two System Architectures:MVC and DCA

Spinoff from

the BabyUML project

for Readable Programs

Trygve Reenskaug

Department of Informatics

University of Oslo

trygver@ifi.uio.no

http://www.ifi.uio.no/~trygver

MVC & DCA - ROOTS 2006

my problem
My Problem

Project

resources

User

tools

Project

activities

actA

actC

actB

actB

actD

Class

Class

Class

Undisciplined communication →Spaghetti

Class + superclasses + methods →Noodles

MVC & DCA - ROOTS 2006

babyuml goal readable programs
BabyUML Goal:Readable Programs

The price of reliability is the pursuit of the utmost simplicity

(C.A.R. Hoare, 1980 Turing Award lecture)

MVC & DCA - ROOTS 2006

the babycomponent an object encapsulating other objects
The BabyComponent =an object encapsulating other objects

resource

«Component»

resource

«Component»

tool

«Component»

tool

«Component»

network

«Component»

network

«Component»

MVC & DCA - ROOTS 2006

baby components universe of discourse
Baby ComponentsUniverse of Discourse

«component» babydemo

demoData

tool

«Interface»

DemoDataIntf

resource

«Interface»

Observer

«Interface»

ResourceIntf

network

«Interface»

NetworkIntf

«Class»

ActivityDescr

MVC & DCA - ROOTS 2006

baby components divide and conquer the tool
Baby ComponentsDivide and Conquer: the tool

demoData

tool

«Interface»

DemoDataIntf

resource

«component» babydemo

«Interface»

Observer

«Interface»

ResourceIntf

network

«Interface»

NetworkIntf

«Class»

ActivityDescr

MVC & DCA - ROOTS 2006

model view controller bridge gap mental model computer
Model – View - Controllerbridge gapMental Model – Computer

mental model

computer model

Model

User

MVC & DCA - ROOTS 2006

model view controller multiple views on same model
Model – View - ControllerMultiple Views on same Model

1

View

*

*

mental model

computer model

Model

User

Run Demo

MVC & DCA - ROOTS 2006

model view controller tool controller views
Model – View - ControllerTool = Controller + Views

Controller

*

1

*

*

View

Tool

mental model

computer model

Model

User

Run Demo

MVC & DCA - ROOTS 2006

example babydemo tool class structure
Example: babydemo.toolClass structure

java.applet.Applet

java.awt.Panel

Java.awt.Component

Controller

ButtonsView

DependencyView

GanttView

ResourceView

java.awt.Button

ActivityView

MVC & DCA - ROOTS 2006

example babydemo tool visual hierarchy associations
Example: babydemo.tool visual hierarchy (associations)

ActivityView

Controller

1

1

1

1

1

ButtonsView

DependencyView

GanttView

ResourceView

1

1

1

1

*

*

java.awt.Button

MVC & DCA - ROOTS 2006

example babydemo tool mvc collaboration structure
Example: babydemo.toolMVC collaboration structure

Tool

controller,

observed, observer

model.

observed

view, observer: ButtonsView

view, observer: DependencyView

view, observer: GanttView

view, observer: ResourceView

button: java.awt.Button

view, observer: ActivityView

MVC & DCA - ROOTS 2006

the anatomy of babydemo tool
The Anatomy ofbabyDemo.tool

controller : Controller

view :DependencyView

view

:ActivityView

heim.ifi.uio.no/~trygver/2006/roots-2006/babyExample4.html

MVC & DCA - ROOTS 2006

mvc synchronized selection
MVCSynchronized Selection

controller

observer*

a view

update()

selectedObject

present

User

pointAndClickMouse

actionPerformed()

selectionEvent()

notifyObserver()

MVC & DCA - ROOTS 2006

mvc tool component
MVCtool component

+IDE

MVC & DCA - ROOTS 2006

baby components the network divide and conquer
Baby Components: the networkDivide and Conquer

demoData

tool

«Interface»

DemoDataIntf

resource

«component» babydemo

«Interface»

Observer

«Interface»

ResourceIntf

network

«Interface»

NetworkIntf

«Class»

ActivityDescr

MVC & DCA - ROOTS 2006

the simple component indisciplined internals
The Simple Componentindisciplined internals

actD

actA

actC

actB

receive message

façademethod

façademethod

MVC & DCA - ROOTS 2006

the declarative component member objects in micro database
The Declarative ComponentMember Objects in micro database

babyBase interface

void newActivity(String actName , …)

void addDependency(String predNam , String succNam)

Set<ActivityIntf> allActivities()

Activity activityNamed(String actNam)

Set<ActivityIntf> predecessorsOf(String actName)

Set<ActivityIntf> successorsOf(String actName)

add

Dependency()

newActivity()

actA

actC

actB

actD

actC

actD

actA

actB

actC

actD

add

Dependency()

newActivity()

babyBase

with Member Objects

and Member structure

MVC & DCA - ROOTS 2006

dca separate the whole from the details
DCAseparate the whole from the Details

Component

looks outward

Outward-lookingmethods and fields

Member Object

Inward-lookingmethods and fields

Member Objects

look inward

MVC & DCA - ROOTS 2006

three simple operations
Three simple operations

MVC & DCA - ROOTS 2006

the dca component d ata c ommunication a lgorithm
The DCA ComponentData + Communication + Algorithm

receive message

a DCA Component

MaestroMethod

MaestroMethod

actA

actB

actC

actD

Communication

Algorithm

micro “database”

with Member Objects and structure

Data

?

MVC & DCA - ROOTS 2006

the dca component invisible babybase
The DCA Componentinvisible babyBase

babyBase interface

void newActivity(String actName , …)

void addDependency(String predNam , String succNam)

Set<ActivityIntf> allActivities()

privateActivity activityNamed(String actNam)

private Set<ActivityIntf> predecessorsOf(String actName)

private Set<ActivityIntf> successorsOf(String actName)

actA

actC

actB

actD

actC

actD

maestro

only

actA

actB

actC

actD

babyBase

only

add

Dependency()

newActivity()

babyBase

with Member Objects

and Member structure

MVC & DCA - ROOTS 2006

public activitydescr activitydescriptorfor string actname
public ActivityDescr activityDescriptorFor (String actName)

actA

actC

actB

actD

actC

actD

receive message

public class ActivityDescr {

public String name;

public Integer earlyStart, earlyFinish, duration, rank;

public Color color;

public Set<String> predecessors, successors;

another

Maestro Method

activityDescriptorFor(“actC”)

Which activity?

What are preds, succs??

public class ActivityImpl implements ActivityIntf {

MemberBase babyBase;

private String name;

private Integer earlyStart, duration, rank = 0;

private Color color = Color.gray;

actA

actB

actC

actD

babyBase

MVC & DCA - ROOTS 2006

algorithm activitydescriptorfor needs both predecessors and successors
algorithmactivityDescriptorFor()needs both predecessors and successors

DescrCollab

*

*

predecessors

activity

successors

roles

MVC & DCA - ROOTS 2006

public activitydescr activitydescriptorfor string actname1
public ActivityDescr activityDescriptorFor (String actName)

actD

actA

actC

actB

actA

actB

actC

actD

actA

actC

DescrCollab

Collaboration =

Communication

context

actB

actD

*

*

predecessors

activity

successors

actC

actD

Algorithm

Data

receive message

MaestroMethod

activityDescriptorFor(“actC”)

actA

actB

actC

actD

micro

“database”

MVC & DCA - ROOTS 2006

uml 2 1 collaboration
“9.3.3 CollaboratioA collaboration describes a structure of collaborating elements (roles), each performing a specialized function,

which collectively accomplish some desired functionality…

Thus, details, such as the identity or precise class of the actual participating instances are suppressed.”

UML 2.1: Collaboration

BabyUML

Collaboration

+

“9.3.4 CollaborationUse

A collaboration use represents the application of the pattern described by a collaboration to a specific situation

involving specific classes or instances playingthe roles of the collaboration.”

BabyUML

Query

MVC & DCA - ROOTS 2006

bind roles to member objects with queries
define successors (String actNam) as

select succ

from dependencies

where pred.name = actNam

Bind roles to Member Objects with queries

ActivityDescriptorCollab

DescrCollab

*

*

predecessors

predecessors

activity

activity

successors

successors

*

*

define query activity (String actNam) as

select act

from activities

where act.name = actNam

define predecessors (String actNam) as

select pred

from dependencies

where succ.name = actNam

MVC & DCA - ROOTS 2006

d c a d ata c ommunication a lgorithm
D C ADataCommunicationAlgorithm

MVC & DCA - ROOTS 2006

maestro method void frontload integer firstweek
define query frontActivities as

select act

from activities

where

act.earlyStart.isNil

and (

select succ

from dependencies

where

pred = act

and pred.earlyStart.notNil

) isEmpty

maestro methodvoid frontload (Integer firstWeek);

receive message

actD

acD

actD

actA

actA

actA

actC

actC

actC

actD

actD

actA

actA

actC

actC

actB

actB

actB

*

predecessors

frontloader

actB

actB

actA

actC

frontCollab

actB

actD

actC

actD

actB

actB

actD

actB

actA

actC

actC

another

Maestro Method

frontload ( )

frontload (1)

actA

actB

actC

actD

babyBase

MVC & DCA - ROOTS 2006

babybase frontcollab
protectedclass FrontCollab {

ActivityIntf frontloader;

Set<ActivityIntf> predecessors;

FrontCollab() {

// activity that is ready to do : not done and all predecessors done

frontloader = null;

predecessors = new HashSet<ActivityIntf> (0);

for (ActivityIntf act : activities) {

if (act.earlyStart() == null) {

Set<ActivityIntf> preds = predecessorsOf(act.name());

boolean predsDone = true;

for ( ActivityIntf pred : preds) {

if (pred.earlyStart() == null) {

predsDone = false;

break;

}

}

if (predsDone) {

frontloader = act;

predecessors = preds;

break;

} } } } }

babyBase.FrontCollab

MVC & DCA - ROOTS 2006

the dca component d ata c ommunication a lgorithm1
The DCA ComponentData + Communication + Algorithm

roleX

roleY

actA

actB

actC

actD

Data structure and objects

contained in micro ”database”

receive message

a DCA Component

  • Façade Method
  • creates Collaboration by binding Roles to Member Objectsthrough dynamic Queries.
  • triggers Communication as message interactionbetween Roles

FaçadeMethod

FaçadeMethod

actD

actB

actC

Algorithmsimplemented as Methodsin Member Objects

MVC & DCA - ROOTS 2006

summary and conclusion make it so simple that there are obviously no deficiencies
Reduce coupling by enforcing component encapsulation.

MVC to separate domain information and presentation

Model components hold domain information

Tool gives user direct access to information

Viewobjects let user see and edit

Controller object coordinates views

DCA to organize component internal Member Objects

Data: Member objects administred by BabyBase that ensured data integrity

Conceptual Schema; BabyBase defines universe of discourse.

External schemas: BabyBase creates collaborations for the external operations

(Internal schema is the Member Object classes).

Communication: Maestro methods in Component object triggers Member Object behavior

Algorithms: What’s left in the Member Objects.

Summary and Conclusion“make it so simple that there are obviously no deficiencies”
  • Reduce coupling by enforcing component encapsulation.
  • MVC to separate domain information and presentation
    • Model components hold domain information
    • Tool gives user direct access to information
      • View objects let user see and edit
      • Controller object coordinates views
  • DCA to organize component internal Member Objects
    • Data: Member objects administred by BabyBase that ensured data integrity
      • Conceptual Schema; BabyBase defines universe of discourse.
      • External schemas: BabyBase creates collaborations for the external operations
      • (Internal schema is the Member Object classes).
    • Communication: Maestro methods in Component object triggers Member Object behavior
    • Algorithms: What’s left in the Member Objects.

MVC & DCA - ROOTS 2006

the end
The End

Claim:

MVC and DCA make for

self-documenting code

More info athttp://heim.ifi.uio.no/~trygver

MVC & DCA - ROOTS 2006

more reading
http://www.ifi.uio.no/~trygvermailto: trygver ‘at’ ifi.uio.no

Trygve Reenskaug: The BabyUML discipline of programming (where A Program = Data + Communication + Algorithms). SoSym 5,1 (April 2006). DOI: 10.1007/s10270-006-0008-x.

Trygve Reenskaug: The BabyUML Discipline of Programming. ECMDA 2005 keynote. http://heim.ifi.uio.no/~trygver/2005/babyuml/ECMDA2005-keynote.ppt

Edsger Dijkstra: A Discipline of Programming, 1976

Charles Antony Richard Hoare: The Emperor's Old Clothes. 1980 Turing Award lecture. Comm.ACM 24, 2 (Feb. 1981)

[UML] Unified Modeling Language: Superstructure. Version 2.1. Object Management Group (OMG) document ptc/06-04-02. http://www.omg.org

Trygve Reenskaug: Empowering People with BabyUML: A sixth GenerationProgramming Language. Opening talk, ECOOP 2004, Oslo.http://heim.ifi.uio.no/~trygver/2004/ECOOP-04/EcoopHandout.pdf

Trygve Reenskaug: Original MVC notes from Xerox PARC:http://heim.ifi.uio.no/~trygver/1979/mvc-1/1979-05-MVC.pdfhttp://heim.ifi.uio.no/~trygver/1979/mvc-2/1979-12-MVC.pdf

Cattell, Barry: The Object Data Standard: ODMG 3.0. Academic Press,London, 2000. ISBN 1-55860-647-4

Erik Arisholm and Dag Sjøberg, A Controlled Experiment with Professionals to Evaluate the Effect of a Delegated versus Centralized Control Style on the Maintainability of Object-Oriented Software, Simula Research Laboratory Technical Report 2003-6http://www.simula.no/publication_one.php?publication_id=601

More reading ….

MVC & DCA - ROOTS 2006

zzzthe babydemo component universe of discourse
ZZZThebabydemo ComponentUniverse of Discourse

«component» babydemo

tool

demoData

resource

«Interface» DemoDataIntf

«Interface» ResourceIntf

network

«Interface» NetworkIntf

«Class»ActivityDescr

MVC & DCA - ROOTS 2006

divide and conquer the network component
Divide and ConquerthenetworkComponent

«Class»

DemoData

DemoDataIntf

«Class»

resource

ResourceIntf

«MVC-component»

tool

«Class»ActivityDescr

«DCA-component»

network

Applet

NetworkIntf

«component» babydemo

MVC & DCA - ROOTS 2006

babydemo networkintf
babydemo.NetworkIntf

+IDE

MVC & DCA - ROOTS 2006

public void newactivity string actname integer duration color color
public void newActivity(String actName , Integer duration, Color color);

actA

actB

actC

actD

receive message

newActivity()

MaestroMethod

babyBase

with Member Objects and structure

MVC & DCA - ROOTS 2006

public void adddependency string fromname string toname
public void addDependency(String fromName , String toName);

actA

actC

actB

actD

actC

actD

receive message

MaestroMethod

add

Dependency

actA

actB

actC

actD

babyBase

MVC & DCA - ROOTS 2006

babydemo networkintf1
babydemo.NetworkIntf

MVC & DCA - ROOTS 2006

babydemo networkintf2
babydemo.NetworkIntf

MVC & DCA - ROOTS 2006