[robotlegs]




for Actionscript 3
Me




     Joel Hooks
       Robotlegs Enthusiast

     on the web
       www.joelhooks.com
     @jhooks
     email
     joelhooks@gmail.com
Who Started Robotlegs?




                 Shaun Smith
                Robotlegs Inventor


                     find him
         shaun.boyblack.co.za
                   @darscan
Not to mention...




                Till Schneidereit
                    SwiftSuspenders Maestro


                          find him
    http://www.tillschneidereit.de/
                  @tschneidereit
Contributors	




                      Robert Penner @robPenner

                     Jonnie Hallman @DestroyToday

                        Sean Hess @seanhess

                      Craig Wickesser @codecraig


          and so many others have contributed to the community
                 through support, ideas, and examples...
What’s in it for me?




                       the pitch
What’s in it for me?




                          do you need a

     a pure Actionscript 3 micro-architecture
                       for flash, flex and air?
What’s in it for me?




              are you using a framework but feel sad about...
What’s in it for me?




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

                               casting
What’s in it for me?




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

                             casting
                            Singletons
What’s in it for me?




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

                            casting
                          Singletons
                        service locators
What’s in it for me?




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

                          casting
                        Singletons
                      service locators
                   display list event bus
What’s in it for me?




                   do you want a better mechanism for...
What’s in it for me?




                   do you want a better mechanism for...

              wiring your objects together
What’s in it for me?




                   do you want a better mechanism for...

              wiring your objects together
               managing dependencies
What’s in it for me?




                   do you want a better mechanism for...

              wiring your objects together
               managing dependencies
                   managing events
What’s in it for me?




                   do you want a better mechanism for...

              wiring your objects together
               managing dependencies
                   managing events
                    structured MVC
Robotlegs is...




     a pure Actionscript 3 micro-architecture
Robotlegs is...




     a pure Actionscript 3 micro-architecture
              robotlegs has no Flex framework dependencies.
Robotlegs is...




                  flash, flex, and air
Robotlegs is...




     a mechanism for wiring objects together
Robotlegs is...




     a mechanism for wiring objects together
                  focused solely on this limited scope
Robotlegs is...




     a mechanism for wiring objects together
                    focused solely on this limited scope
              by providing kickass tools to get your job done
Why Robotlegs?




                  lightweight
                 ~1100 lines of code...
Why Robotlegs?




        automated dependency injection
Why Robotlegs?




        automated dependency injection
                     [Inject]
Why Robotlegs?




                               :ʼ(



                 fight carpel tunnel
Why Robotlegs?




                 remove framework pain
Why Robotlegs?




        MVC+S reference implementation
Why Robotlegs?




        MVC+S reference implementation
                 a little prescription goes a long way...
Why Robotlegs?




        MVC+S reference implementation
                 a little prescription goes a long way...
                                  but...
Why Robotlegs?




            whatever you need it to be
Why Robotlegs?




            whatever you need it to be
         highly extensible to support YOUR workflow and style
Why Robotlegs?




             whatever you need it to be
        highly extensible to support YOUR workflow and style
     MVCS provides documentation and common ground for teams...
Why Robotlegs?




                 modular support
Why Robotlegs?




                 peer reviewed
Why Robotlegs?




     objects communicate via native events
Why Robotlegs?




     objects communicate via native events
             custom events with strongly typed properties
Why Robotlegs?




     objects communicate via native events
             custom events with strongly typed properties
                  or maybe you prefer AS3-Signals?
Why Robotlegs?




                 well documented
Why Robotlegs?




                     fully unit tested
                 because your project is important.
Why Robotlegs?




                        stable
                 strict semantic versioning
                     http://semver.org/
Why Robotlegs?




                 welcoming community
                         hi!
Why Robotlegs?




                 knowledge.robotlegs.org




                  Community supported through Tender
What Robotlegs isn’t...
What Robotlegs isn’t...
Where to Start?




         MVC+S reference implementation
Robotlegs MVCS Implementation
Robotlegs in Action




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




                      GalleryView Component
Robotlegs in Action




                      GallerySearch Component
Robotlegs in Action




                      GalleryLabel Component
Context




          Context initializes the framework
Context
Context




          Context provides an event bus
Context Event Dispatcher Routes Events
Context




          not limited to a single Context
Context




          not limited to a single Context
            multiple Contexts for modular development
Context




          not limited to a single Context
            multiple Contexts for modular development
                     thereʼs a utility for that...
Actor




        Actor is the base class for
        Model and Service classes
Models and Services Extend Actor
Actor




        eventDispatcher is injected
                into Actor
Actor




    Actor provides a dispatch(event) method
Actor




        Actor is for your convenience
Model




        Models extend Actor
Model




        Models provide an API for data
Model
Model




        Models sit between application data
                 and other actors
Model




             Models should not
        listen for framework events
Model




        Models dispatch framework events
Models Dispatch Events
Service




          Services extend Actor
Service




 Services communicate with the outside world
   and provides an API to external services
Service
Service




          Services can parse results
            from external services
Service




              Services can parse results
                from external services
          foreign data should be converted at the first opportunity
Service
Service




          Services do not store data
Service




          Services do not store data
               data is stored on a Model
Service




               Services do not
          receive framework events
Service




          Services dispatch framework events
Services Dispatch Events
View




          the View is represented by your
       view components and their Mediators
View




 Mediators provide API for view components
View




 Mediators provide API for view components
              to keep the framework out
Mediators Access View Component APIs
View
View




  Mediators listen for view component events
Mediators Listen to View Components
View




       Mediators listen for framework events
Mediators Listen for Events
View




       Mediators dispatch framework events
Mediators Dispatch Events
View




       view components are not coupled to
                their Mediators
View




       view components are not coupled to
                their Mediators
                or any other framework class
View




       view components are not coupled to
                their Mediators
                or any other framework class
                           period.
View




       Mediators are coupled to their
            view components
View




             Mediators can access
       Service and Model classes directly
View




             Mediators can access
       Service and Model classes directly
           but this will couple the Mediator to the Actor
Accessing Models and Services from Mediators




                         (tread carefully)
Controller




        represented by the Command class
Controller




      Commands are executed in response
            to framework events
Controllers Executed by Events
Controller




             Commands are stateless
Controller




             Commands are stateless
                  they execute and die
Controller




             Commands are stateless
                    they execute and die
               performing a single unit of work
Controller
Controller




             Commands perform work on
             Service and Model classes
Controller




             Commands perform work on
             Service and Model classes
                  and occasionally Mediators
Controller Performs Work
Controller
Controller




         Commands receive data from the
            events that trigger them
Controller
Controller




     Commands dispatch framework events
Controller Dispatches Events
Controller




 Commands do not receive framework events
Controller




 Commands do not receive framework events
             outside of the event that triggers them
Controller




 Commands do not receive framework events
             outside of the event that triggers them
                 which is available for injection
Typical Flow of Events in Robotlegs
User Performs an Action (button click)
View Component Dispatches Event to Mediator
Mediator Dispatches Event that Triggers
Command calls a Method on a Service
Service Makes External call and Parses Data
Service Updates the Model (directly or via
Model Dispatches Event that Mediator Responds
Mediator Updates View with Current Data
Robotlegs MVCS
Collaborative Development



                 github makes it easy!




                       github.com/robotlegs
Collaborative Development




    comments, criticism, and ideas welcome
Collaborative Development




                   fork the framework
Collaborative Development




            create examples and utilities
Collaborative Development




      create an alternative implementation
www.robotlegs.org
  download the framework
best practices documentation
      project on github
 FAQ and Knowledge Base
        live examples
Questions?

Robotlegs AS3 from Flash and the City 2010

Editor's Notes

  • #29 boiler plate code is teh sux.
  • #43 Frameworks are mission critical. They should be stable and well tested. Period.
  • #51 This was the first example I ever created with Robotlegs. Originally it was a Parsley example, but in the middle of the series I found Robotlegs and didn’t look back.