hands on puremvc

53
Hands-On Flash Platform Development using Thursday, April 29, 2010

Upload: diomampo

Post on 01-Nov-2014

2.196 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Hands on puremvc

Hands-On Flash Platform Development using

Thursday April 29 2010

About Me

bull Steven Diomampo 24

bull Sr Multimedia Developer JWT

bull Flash Platform Enthusiast

bull First community presentation

bull Twitter diomampo

bull Blog wwwStevenDiomampocom

Thursday April 29 2010

Before We Start

bull Any word in bold italics should be in the provided handout under Keywords amp Definitions

bull Donrsquot worry about reading the code snippets contained in the slides I will jump to the IDE for a detailed view of it

bull After each section I will pause for any questions but feel free to chime in at anytime

Thursday April 29 2010

Agendabull Overview of Frameworks amp MVC

bull Introduction to PureMVC

bull The Facade

bull Notifications

bull Model Proxies amp VOrsquos

bull View Mediators amp UI

bull Controller amp Commands

bull Helpful Tips

bull Writing our first application

Thursday April 29 2010

Assumptions

bull Basic OOP experience preferably using ActionScript 3

bull Basic knowledge or want to learn about Frameworks

bull Basic knowledge or want to learn about MVC

Thursday April 29 2010

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 2: Hands on puremvc

About Me

bull Steven Diomampo 24

bull Sr Multimedia Developer JWT

bull Flash Platform Enthusiast

bull First community presentation

bull Twitter diomampo

bull Blog wwwStevenDiomampocom

Thursday April 29 2010

Before We Start

bull Any word in bold italics should be in the provided handout under Keywords amp Definitions

bull Donrsquot worry about reading the code snippets contained in the slides I will jump to the IDE for a detailed view of it

bull After each section I will pause for any questions but feel free to chime in at anytime

Thursday April 29 2010

Agendabull Overview of Frameworks amp MVC

bull Introduction to PureMVC

bull The Facade

bull Notifications

bull Model Proxies amp VOrsquos

bull View Mediators amp UI

bull Controller amp Commands

bull Helpful Tips

bull Writing our first application

Thursday April 29 2010

Assumptions

bull Basic OOP experience preferably using ActionScript 3

bull Basic knowledge or want to learn about Frameworks

bull Basic knowledge or want to learn about MVC

Thursday April 29 2010

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 3: Hands on puremvc

Before We Start

bull Any word in bold italics should be in the provided handout under Keywords amp Definitions

bull Donrsquot worry about reading the code snippets contained in the slides I will jump to the IDE for a detailed view of it

bull After each section I will pause for any questions but feel free to chime in at anytime

Thursday April 29 2010

Agendabull Overview of Frameworks amp MVC

bull Introduction to PureMVC

bull The Facade

bull Notifications

bull Model Proxies amp VOrsquos

bull View Mediators amp UI

bull Controller amp Commands

bull Helpful Tips

bull Writing our first application

Thursday April 29 2010

Assumptions

bull Basic OOP experience preferably using ActionScript 3

bull Basic knowledge or want to learn about Frameworks

bull Basic knowledge or want to learn about MVC

Thursday April 29 2010

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 4: Hands on puremvc

Agendabull Overview of Frameworks amp MVC

bull Introduction to PureMVC

bull The Facade

bull Notifications

bull Model Proxies amp VOrsquos

bull View Mediators amp UI

bull Controller amp Commands

bull Helpful Tips

bull Writing our first application

Thursday April 29 2010

Assumptions

bull Basic OOP experience preferably using ActionScript 3

bull Basic knowledge or want to learn about Frameworks

bull Basic knowledge or want to learn about MVC

Thursday April 29 2010

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 5: Hands on puremvc

Assumptions

bull Basic OOP experience preferably using ActionScript 3

bull Basic knowledge or want to learn about Frameworks

bull Basic knowledge or want to learn about MVC

Thursday April 29 2010

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 6: Hands on puremvc

Overview of Frameworks and MVC

Thursday April 29 2010

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 7: Hands on puremvc

Framework Examples

FlexUnit

Cairngorm

Thursday April 29 2010

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 8: Hands on puremvc

MVC-based Frameworks

Cairngorm

Thursday April 29 2010

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 9: Hands on puremvc

MVC is not a Framework

bull MVC is an architecture (in Flash it is considered a micro-architecture)

bull A Framework is a general foundation for which you can easily extend

bull Although many Frameworks are based on MVC Frameworks are not MVC

Thursday April 29 2010

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 10: Hands on puremvc

General Benefits

bull Proven solutions

bull Speeds up development

bull Helps with collaborative code

bull Formalized approach to something

bull Community driven knowledge base

Thursday April 29 2010

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 11: Hands on puremvc

MVC Frameworks are not the answer to everything

bull Additional overhead

bull Might be overkill for a small project but the principles of separation can still be applied

bull Your code does not magically become clean by using a Framework

Thursday April 29 2010

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 12: Hands on puremvc

Checklist

bull What is the shelf life of the project

bull Will I ever make updates to it (Feature requests bug fixes etc)

bull Will anyone else ever work on this

bull Do I like to write documentation

Thursday April 29 2010

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 13: Hands on puremvc

Questions

Thursday April 29 2010

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 14: Hands on puremvc

Real world projects

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 15: Hands on puremvc

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 16: Hands on puremvc

Concept

Requirements Mockup

Build Application

1

23

4

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 17: Hands on puremvc

Concept

Requirements Mockup

Build Application

Thursday April 29 2010

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 18: Hands on puremvc

Concept

Requirements Mockup

Build Application

CHANGE REQUEST

CHANGE REQUEST

CHANGE REQUEST

BUG FIXBUG FIX

BUG FIX

Thursday April 29 2010

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 19: Hands on puremvc

Common Approaches

Thursday April 29 2010

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 20: Hands on puremvc

The Spaghetti Approach

Thursday April 29 2010

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 21: Hands on puremvc

Show the code

Thursday April 29 2010

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 22: Hands on puremvc

Whatrsquos wrong with that

bull Does not adhere to the Single Responsibility Principle

bull Code reusability is little to none

bull The code can become unmanageable

Thursday April 29 2010

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 23: Hands on puremvc

The Roll Your Own Approach

Thursday April 29 2010

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 24: Hands on puremvc

Whatrsquos wrong with that

bull Donrsquot reinvent the wheel

bull Ongoing support is limited

bull Heavier workload (Documentation and Testing)

bull But doesnrsquot it offer job security

Thursday April 29 2010

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 25: Hands on puremvc

An Alternative Approach

Thursday April 29 2010

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 26: Hands on puremvc

About

bull Created by Cliff Hall

bull Open source (Creative Commons 30 Attribution US License)

bull Language agnostic (support for over 10 programming languages)

bull Two Versions Standard and MultiCore

Thursday April 29 2010

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 27: Hands on puremvc

Goals

bull The PureMVC framework has a very narrow main goal to help you separate your applicationrsquos coding concerns into three discrete tiers Model View and Controller

Thursday April 29 2010

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 28: Hands on puremvc

Why I use it

bull Itrsquos free

bull Excellent documentation

bull Widely accepted and adopted

bull Team collaboration

bull Learning curve for a new language is reduced

Thursday April 29 2010

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 29: Hands on puremvc

Thursday April 29 2010

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 30: Hands on puremvc

Framework Actors

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 31: Hands on puremvc

Core Actors and the Facade

Thursday April 29 2010

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 32: Hands on puremvc

Core Actors and the Facade

Thursday April 29 2010

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 33: Hands on puremvc

The Developerrsquos Responsibility

Thursday April 29 2010

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 34: Hands on puremvc

Reusability

bull View Components and Value Objects should not contain any references to the Framework

bull This offers the ability to reuse these objects in other projects

Thursday April 29 2010

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 35: Hands on puremvc

Communicationbull Use Notifications to communicate among Actors (Publish

Subscribe)

bull Dispatch Events from a View Component

bull Mediators sendrecieve Notifications and listen for Events to be dispatch from a View Component

bull Proxies send BUT CANNOT receive Notifications

bull Commands sendreceive Notifications

To publish a Notification you will do this sendNotification(notificationNameString bodyObject=null typeString=null)

Thursday April 29 2010

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 36: Hands on puremvc

Questions

Thursday April 29 2010

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 37: Hands on puremvc

Letrsquos get started

Thursday April 29 2010

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 38: Hands on puremvc

The Facadebull Singleton representative for the Model View and

Controller

bull Gatekeeper to PureMVC that initializes the Framework

bull Offers methods for registering retrieving and removing Actors

bull Accessible by all Framework Actors

Overview Package Structure

Usage

bull Create a single subclass of Facade usually named ApplicationFacadeas which extends Facade and implements IFacade

bull Create a getInstance() method to use this class as a Singleton

bull Define your Notification names as static constants

bull Override the initializeController() method and register your Commands

bull Create a startup() method

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 39: Hands on puremvc

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 40: Hands on puremvc

Questions

Thursday April 29 2010

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 41: Hands on puremvc

Model Tierbull Model

bull Singleton that holds references to Proxies

bull You will never interact directly with this

bull Proxies

bull Data storage retrieval and manipulation

bull Exposes an API for other Actors to use

bull Can send Notifications but cannot receive

bull Value Object

bull Dumb object that holds simple properties

Overview

Package Structure

bull Create subclasses of Proxy (extend Proxy and implement IProxy)[Note Do not extend flashutilsProxy]

bull Create your own VOrsquos to be used throughout the application

bull Register your Proxies using the registerProxy() method in the ApplicationFacade

bull Set or load the data (VOrsquos Array etc) for the Proxy

Usage

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 42: Hands on puremvc

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 43: Hands on puremvc

Questions

Thursday April 29 2010

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 44: Hands on puremvc

View TierOverview

Package Structure

Usage

bull Create subclasses of Mediator (extend Mediator and implement IMediator)

bull Pass in a reference to the Component you would like to Mediate and addEventListeners to it

bull Override listNotificationInterests() to define which Notifications your Mediator will receive

bull Override handleNotification() to perform actions based on each Notification

bull View

bull Singleton that holds references to Mediators

bull You will never interact directly with this

bull Mediators

bull Send and receive Notifications

bull Holds a reference to a Component which allows listeners to be added and methods to be called

bull Components

bull Should remain outside the scope of the Framework

bull Provide a well-defined API for a Mediator to act upon

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 45: Hands on puremvc

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 46: Hands on puremvc

Questions

Thursday April 29 2010

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 47: Hands on puremvc

Controller Tier

bull Controller

bull Singleton that holds references to Commands via Notification names

bull You will never interact directly with this

bull Commands

bull Stateless classes to be triggered by a Notification

bull Handle business logic or complex system actions

Overview Package Structure

Usage

bull Create subclasses of Command (extend SimpleCommand or MacroCommand and implement ICommand)

bull Override execute() within your Commands to perform logic such as bootstrapping or manipulating a Proxy

bull Register your Commands using the registerCommand() method within the Facade

bull Trigger your Commands via a Notification

Thursday April 29 2010

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 48: Hands on puremvc

Show the code

Thursday April 29 2010

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 49: Hands on puremvc

Questions

Thursday April 29 2010

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 50: Hands on puremvc

Quick Tips

bull Generic object implementation meaning lots of type casting

bull Does not rely on the native Flash event system (ie Notifications)

bull Expect a bit of boilerplate code

Thursday April 29 2010

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 51: Hands on puremvc

Now What

bull SimpleCommand VS MacroCommand

bull Modules

bull Design Patterns

bull Dynamic Mediators and Deferred Instantiation

Thursday April 29 2010

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 52: Hands on puremvc

Mahalo

Thursday April 29 2010

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010

Page 53: Hands on puremvc

bull httpwwwpuremvcorg

bull httpwwwadobecomnewslettersedgedecember2008articlesarticle6indexhtmltrackingid=EFBLD

bull httpwwwslidesharenetjwilkersamuel-asher-rivello-puremvc-hands-on-part-1

bull httpwwwasserttruecomarticles20071017silvafug-application-frameworks-presentation

bull httpwwwcodeprojectcomKBarchitectureWhatIsAFrameworkaspx

Resources

Thursday April 29 2010