135
[ robotlegs ] for Actionscript 3

Robotlegs AS3 from Flash and the City 2010

Embed Size (px)

DESCRIPTION

Slides from presentation on the Robotlegs AS3 Micro-Architecture at Flash and the City 2010 in New York

Citation preview

Page 1: Robotlegs AS3 from Flash and the City 2010

[robotlegs]

for Actionscript 3

Page 3: Robotlegs AS3 from Flash and the City 2010

Who Started Robotlegs?

Shaun SmithRobotlegs Inventor

find himshaun.boyblack.co.za

@darscan

Page 4: Robotlegs AS3 from Flash and the City 2010

Not to mention...

Till SchneidereitSwiftSuspenders Maestro

find himhttp://www.tillschneidereit.de/

@tschneidereit

Page 5: Robotlegs AS3 from Flash and the City 2010

Contributors

Robert Penner @robPenner

Sean Hess @seanhess

Jonnie Hallman @DestroyToday

Craig Wickesser @codecraig

and so many others have contributed to the communitythrough support, ideas, and examples...

Page 6: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

the pitch

Page 7: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

a pure Actionscript 3 micro-architecturefor flash, flex and air?

do you need a

Page 8: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

are you using a framework but feel sad about...

Page 9: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

castingare you using a framework but feel sad about...

Page 10: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

castingare you using a framework but feel sad about...

Singletons

Page 11: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

castingare you using a framework but feel sad about...

Singletonsservice locators

Page 12: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

castingare you using a framework but feel sad about...

Singletonsservice locators

display list event bus

Page 13: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

do you want a better mechanism for...

Page 14: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

wiring your objects togetherdo you want a better mechanism for...

Page 15: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

wiring your objects togetherdo you want a better mechanism for...

managing dependencies

Page 16: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

wiring your objects togetherdo you want a better mechanism for...

managing dependenciesmanaging events

Page 17: Robotlegs AS3 from Flash and the City 2010

What’s in it for me?

wiring your objects togetherdo you want a better mechanism for...

managing dependenciesmanaging eventsstructured MVC

Page 18: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

a pure Actionscript 3 micro-architecture

Page 19: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

a pure Actionscript 3 micro-architecturerobotlegs has no Flex framework dependencies.

Page 20: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

flash, flex, and air

Page 21: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

a mechanism for wiring objects together

Page 22: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

a mechanism for wiring objects togetherfocused solely on this limited scope

Page 23: Robotlegs AS3 from Flash and the City 2010

Robotlegs is...

a mechanism for wiring objects togetherfocused solely on this limited scope

by providing kickass tools to get your job done

Page 24: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

lightweight~1100 lines of code...

Page 25: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

automated dependency injection

Page 26: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

automated dependency injection[Inject]

Page 27: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

fight carpel tunnel

:ʼ(

Page 28: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

remove framework pain

Page 29: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

MVC+S reference implementation

Page 30: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

MVC+S reference implementationa little prescription goes a long way...

Page 31: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

MVC+S reference implementationa little prescription goes a long way...

but...

Page 32: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

whatever you need it to be

Page 33: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

whatever you need it to behighly extensible to support YOUR workflow and style

Page 34: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

whatever you need it to behighly extensible to support YOUR workflow and style

MVCS provides documentation and common ground for teams...

Page 35: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

modular support

Page 36: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

peer reviewed

Page 37: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

objects communicate via native events

Page 38: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

objects communicate via native eventscustom events with strongly typed properties

Page 39: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

objects communicate via native eventscustom events with strongly typed properties

or maybe you prefer AS3-Signals?

Page 40: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

well documented

Page 41: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

fully unit testedbecause your project is important.

Page 42: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

stablestrict semantic versioning

http://semver.org/

Page 43: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

welcoming communityhi!

Page 44: Robotlegs AS3 from Flash and the City 2010

Why Robotlegs?

knowledge.robotlegs.org

Community supported through Tender

Page 45: Robotlegs AS3 from Flash and the City 2010

What Robotlegs isn’t...

Page 46: Robotlegs AS3 from Flash and the City 2010

What Robotlegs isn’t...

Page 47: Robotlegs AS3 from Flash and the City 2010

Where to Start?

MVC+S reference implementation

Page 48: Robotlegs AS3 from Flash and the City 2010

Robotlegs MVCS Implementation

Page 49: Robotlegs AS3 from Flash and the City 2010

Robotlegs in Action

Flickr Image Gallery Demo**part of the Robotlegs Demo Bundle available here: http://github.com/robotlegs/robotlegs-demos-Bundle

Page 50: Robotlegs AS3 from Flash and the City 2010

Robotlegs in Action

GalleryView Component

Page 51: Robotlegs AS3 from Flash and the City 2010

Robotlegs in Action

GallerySearch Component

Page 52: Robotlegs AS3 from Flash and the City 2010

Robotlegs in Action

GalleryLabel Component

Page 53: Robotlegs AS3 from Flash and the City 2010

Context

Context initializes the framework

Page 54: Robotlegs AS3 from Flash and the City 2010

Context

Page 55: Robotlegs AS3 from Flash and the City 2010

Context

Context provides an event bus

Page 56: Robotlegs AS3 from Flash and the City 2010

Context Event Dispatcher Routes Events

Page 57: Robotlegs AS3 from Flash and the City 2010

Context

not limited to a single Context

Page 58: Robotlegs AS3 from Flash and the City 2010

Context

not limited to a single Contextmultiple Contexts for modular development

Page 59: Robotlegs AS3 from Flash and the City 2010

Context

not limited to a single Contextmultiple Contexts for modular development

thereʼs a utility for that...

Page 60: Robotlegs AS3 from Flash and the City 2010

Actor

Actor is the base class for Model and Service classes

Page 61: Robotlegs AS3 from Flash and the City 2010

Models and Services Extend Actor

Page 62: Robotlegs AS3 from Flash and the City 2010

Actor

eventDispatcher is injectedinto Actor

Page 63: Robotlegs AS3 from Flash and the City 2010

Actor

Actor provides a dispatch(event) method

Page 64: Robotlegs AS3 from Flash and the City 2010

Actor

Actor is for your convenience

Page 65: Robotlegs AS3 from Flash and the City 2010

Model

Models extend Actor

Page 66: Robotlegs AS3 from Flash and the City 2010

Model

Models provide an API for data

Page 67: Robotlegs AS3 from Flash and the City 2010

Model

Page 68: Robotlegs AS3 from Flash and the City 2010

Model

Models sit between application data and other actors

Page 69: Robotlegs AS3 from Flash and the City 2010

Model

Models should not listen for framework events

Page 70: Robotlegs AS3 from Flash and the City 2010

Model

Models dispatch framework events

Page 71: Robotlegs AS3 from Flash and the City 2010

Models Dispatch Events

Page 72: Robotlegs AS3 from Flash and the City 2010

Service

Services extend Actor

Page 73: Robotlegs AS3 from Flash and the City 2010

Service

Services communicate with the outside worldand provides an API to external services

Page 74: Robotlegs AS3 from Flash and the City 2010

Service

Page 75: Robotlegs AS3 from Flash and the City 2010

Service

Services can parse results from external services

Page 76: Robotlegs AS3 from Flash and the City 2010

Service

Services can parse results from external services

foreign data should be converted at the first opportunity

Page 77: Robotlegs AS3 from Flash and the City 2010

Service

Page 78: Robotlegs AS3 from Flash and the City 2010

Service

Services do not store data

Page 79: Robotlegs AS3 from Flash and the City 2010

Service

Services do not store datadata is stored on a Model

Page 80: Robotlegs AS3 from Flash and the City 2010

Service

Services do not receive framework events

Page 81: Robotlegs AS3 from Flash and the City 2010

Service

Services dispatch framework events

Page 82: Robotlegs AS3 from Flash and the City 2010

Services Dispatch Events

Page 83: Robotlegs AS3 from Flash and the City 2010

View

the View is represented by your view components and their Mediators

Page 84: Robotlegs AS3 from Flash and the City 2010

View

Mediators provide API for view components

Page 85: Robotlegs AS3 from Flash and the City 2010

View

Mediators provide API for view componentsto keep the framework out

Page 86: Robotlegs AS3 from Flash and the City 2010

Mediators Access View Component APIs

Page 87: Robotlegs AS3 from Flash and the City 2010

View

Page 88: Robotlegs AS3 from Flash and the City 2010

View

Mediators listen for view component events

Page 89: Robotlegs AS3 from Flash and the City 2010

Mediators Listen to View Components

Page 90: Robotlegs AS3 from Flash and the City 2010

View

Mediators listen for framework events

Page 91: Robotlegs AS3 from Flash and the City 2010

Mediators Listen for Events

Page 92: Robotlegs AS3 from Flash and the City 2010

View

Mediators dispatch framework events

Page 93: Robotlegs AS3 from Flash and the City 2010

Mediators Dispatch Events

Page 94: Robotlegs AS3 from Flash and the City 2010

View

view components are not coupled to their Mediators

Page 95: Robotlegs AS3 from Flash and the City 2010

View

view components are not coupled to their Mediators

or any other framework class

Page 96: Robotlegs AS3 from Flash and the City 2010

View

view components are not coupled to their Mediators

or any other framework classperiod.

Page 97: Robotlegs AS3 from Flash and the City 2010

View

Mediators are coupled to their view components

Page 98: Robotlegs AS3 from Flash and the City 2010

View

Mediators can access Service and Model classes directly

Page 99: Robotlegs AS3 from Flash and the City 2010

View

Mediators can access Service and Model classes directly

but this will couple the Mediator to the Actor

Page 100: Robotlegs AS3 from Flash and the City 2010

Accessing Models and Services from Mediators

(tread carefully)

Page 101: Robotlegs AS3 from Flash and the City 2010

Controller

represented by the Command class

Page 102: Robotlegs AS3 from Flash and the City 2010

Controller

Commands are executed in response to framework events

Page 103: Robotlegs AS3 from Flash and the City 2010

Controllers Executed by Events

Page 104: Robotlegs AS3 from Flash and the City 2010

Controller

Commands are stateless

Page 105: Robotlegs AS3 from Flash and the City 2010

Controller

Commands are statelessthey execute and die

Page 106: Robotlegs AS3 from Flash and the City 2010

Controller

Commands are statelessthey execute and die

performing a single unit of work

Page 107: Robotlegs AS3 from Flash and the City 2010

Controller

Page 108: Robotlegs AS3 from Flash and the City 2010

Controller

Commands perform work on Service and Model classes

Page 109: Robotlegs AS3 from Flash and the City 2010

Controller

Commands perform work on Service and Model classes

and occasionally Mediators

Page 110: Robotlegs AS3 from Flash and the City 2010

Controller Performs Work

Page 111: Robotlegs AS3 from Flash and the City 2010

Controller

Page 112: Robotlegs AS3 from Flash and the City 2010

Controller

Commands receive data from the events that trigger them

Page 113: Robotlegs AS3 from Flash and the City 2010

Controller

Page 114: Robotlegs AS3 from Flash and the City 2010

Controller

Commands dispatch framework events

Page 115: Robotlegs AS3 from Flash and the City 2010

Controller Dispatches Events

Page 116: Robotlegs AS3 from Flash and the City 2010

Controller

Commands do not receive framework events

Page 117: Robotlegs AS3 from Flash and the City 2010

Controller

Commands do not receive framework eventsoutside of the event that triggers them

Page 118: Robotlegs AS3 from Flash and the City 2010

Controller

Commands do not receive framework eventsoutside of the event that triggers them

which is available for injection

Page 119: Robotlegs AS3 from Flash and the City 2010

Typical Flow of Events in Robotlegs

Page 120: Robotlegs AS3 from Flash and the City 2010

User Performs an Action (button click)

Page 121: Robotlegs AS3 from Flash and the City 2010

View Component Dispatches Event to Mediator

Page 122: Robotlegs AS3 from Flash and the City 2010

Mediator Dispatches Event that Triggers

Page 123: Robotlegs AS3 from Flash and the City 2010

Command calls a Method on a Service

Page 124: Robotlegs AS3 from Flash and the City 2010

Service Makes External call and Parses Data

Page 125: Robotlegs AS3 from Flash and the City 2010

Service Updates the Model (directly or via

Page 126: Robotlegs AS3 from Flash and the City 2010

Model Dispatches Event that Mediator Responds

Page 127: Robotlegs AS3 from Flash and the City 2010

Mediator Updates View with Current Data

Page 128: Robotlegs AS3 from Flash and the City 2010

Robotlegs MVCS

Page 129: Robotlegs AS3 from Flash and the City 2010

Collaborative Development

github.com/robotlegs

github makes it easy!

Page 130: Robotlegs AS3 from Flash and the City 2010

Collaborative Development

comments, criticism, and ideas welcome

Page 131: Robotlegs AS3 from Flash and the City 2010

Collaborative Development

fork the framework

Page 132: Robotlegs AS3 from Flash and the City 2010

Collaborative Development

create examples and utilities

Page 133: Robotlegs AS3 from Flash and the City 2010

Collaborative Development

create an alternative implementation

Page 134: Robotlegs AS3 from Flash and the City 2010

www.robotlegs.orgdownload the framework

best practices documentationproject on github

FAQ and Knowledge Baselive examples

Page 135: Robotlegs AS3 from Flash and the City 2010

Questions?