Lunch and learn as3_frameworks


Published on

A whirlwind introduction to PureMVC and Robotlegs, presented by Yuri Visser, TJ Gillis and Paul Ward from

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Lunch and learn as3_frameworks

  1. 1. & PureMVC sample project:  (svn) Robotlegs sample project: (SVN is lame. Here it is on github)
  2. 2. <ul><li>Uncle Ben Parker of Spider-Man fame once said,  &quot;With great power comes great responsibility.&quot; </li></ul><ul><li>We all want great power when developing software, but the question is: Can we accept the responsibility? </li></ul>
  3. 3. <ul><li>Or more specifically... </li></ul><ul><li>Should we use a framework for our Flash, Flex & AIR projects? </li></ul>
  4. 4. Outline... <ul><li>     1. Presentation Goals </li></ul><ul><li>     2. Framework - Why and when? </li></ul><ul><li>     3. Design Patterns rolled into Frameworks </li></ul><ul><li>     4. Frameworks out there </li></ul><ul><li>     5. PureMVC intro </li></ul><ul><li>     6. Robotlegs intro </li></ul>
  5. 5. 1.) Presentation Goals <ul><li>Skimming the surface... </li></ul><ul><li>     1. Introduction to two of the hottest AS3 frameworks </li></ul><ul><li>     2. A primer for getting started </li></ul><ul><li>     3. Pizza...hell yeah! </li></ul>
  6. 6. 2.) Framework - Why? <ul><ul><li>Simplified code (simple code is reliable code) </li></ul></ul><ul><ul><li>Reduce confusion over class roles and responsibilities - separation of concerns (discrete layers) </li></ul></ul><ul><ul><li>Promote scalability </li></ul></ul><ul><ul><li>Promotes re-usability (loosely coupled) </li></ul></ul><ul><ul><li>Speed up development process </li></ul></ul><ul><ul><li>Built on proven design patterns (OOP, Gang of Four[GoF]) </li></ul></ul>
  7. 7. ...Framework - When? <ul><ul><li>Collaborative / team development...personally I'd say if there's more than two developers on a team. </li></ul></ul><ul><ul><li>Project size and/or complexity...if your project is gonna get big and complex - lots of classes with lots of roles. </li></ul></ul><ul><ul><li>Uncertain need the flexibility to so that IF  your project grows, your codebase can accommodate. </li></ul></ul><ul><ul><li>You simply want to create a clean and well structured codebase. </li></ul></ul>
  8. 8. 3.) Design Patterns rolled into Frameworks <ul><li>Design Patterns are general reusable solution to a commonly occurring problem in software design. Object-oriented design patterns typically show relationships and interactions between classes or objects. </li></ul><ul><ul><li>Behavioral Patterns: </li></ul></ul><ul><ul><ul><li>Command Pattern </li></ul></ul></ul><ul><ul><ul><li>Observer Pattern </li></ul></ul></ul><ul><ul><ul><li>Template Method Pattern </li></ul></ul></ul><ul><ul><ul><li>State Pattern </li></ul></ul></ul><ul><ul><ul><li>Strategy Pattern </li></ul></ul></ul><ul><ul><li>Multiple Patterns: </li></ul></ul><ul><ul><ul><li>Model-View-Controller </li></ul></ul></ul><ul><ul><ul><li>Symmetric Proxy Pattern </li></ul></ul></ul><ul><ul><li>Creational Patterns: </li></ul></ul><ul><ul><ul><li>Factory Method Pattern </li></ul></ul></ul><ul><ul><ul><li>Singleton Pattern </li></ul></ul></ul><ul><ul><li>Structural Patterns: </li></ul></ul><ul><ul><ul><li>Decorator Pattern </li></ul></ul></ul><ul><ul><ul><li>Adapter Pattern </li></ul></ul></ul><ul><ul><ul><li>Composite Pattern </li></ul></ul></ul>
  9. 9. ...continued <ul><li>Today we'll inadvertently be looking at design patterns that address concerns related to high-level structures of applications being developed; Behavioral Design Patters rolled into a Framework = a collaborating set of design patterns. </li></ul><ul><li>Frameworks (a.k.a. micro-architectures)  are a special case of software libraries in that they are reusable abstractions of code wrapped in a well-defined Application programming interface (API). </li></ul>
  10. 10. 4.) Frameworks out there <ul><ul><li>PureMVC </li></ul></ul><ul><ul><li>Robotlegs </li></ul></ul><ul><ul><li>Mate (the drink, not your friend) </li></ul></ul><ul><ul><li>Swiz </li></ul></ul><ul><ul><li>Parsley </li></ul></ul><ul><ul><li>Cairngorm </li></ul></ul><ul><ul><li>FlexMVCS / MVCS </li></ul></ul><ul><ul><li>Spring Actionscript </li></ul></ul><ul><ul><li>... </li></ul></ul>
  11. 11. 4.) Meet the mothership...a.k.a. PureMVC
  12. 12. ...PureMVC strengths <ul><ul><li>Well established </li></ul></ul><ul><ul><li>Large and active community </li></ul></ul><ul><ul><li>Very very very well structured </li></ul></ul><ul><ul><li>Thus...Extremely well suited for team development </li></ul></ul><ul><ul><li>Once you know it...coding is super-fast </li></ul></ul><ul><ul><li>Small footprint </li></ul></ul><ul><ul><li>Support for multicore (multiple application cores)* </li></ul></ul><ul><ul><li>Language agnostic- Ports for: </li></ul></ul><ul><ul><li>AS3 </li></ul></ul><ul><ul><li>AS2 </li></ul></ul><ul><ul><li>ColdFusion </li></ul></ul><ul><ul><li>C# </li></ul></ul><ul><ul><li>Objective C </li></ul></ul><ul><ul><li>Ruby </li></ul></ul><ul><ul><li>PHP </li></ul></ul><ul><ul><li>Python </li></ul></ul><ul><ul><li>Haxe </li></ul></ul><ul><ul><li>Java </li></ul></ul><ul><ul><li>Javascript </li></ul></ul>
  13. 13. *...mulitcore (Pipe, TeeSlipt, TeeMerge)
  14. 14. ...PureMVC weaknesses <ul><li>- none </li></ul>
  15. 15. ...PureMVC weaknesses (for real) <ul><ul><li>Not a Flex specific framework </li></ul></ul><ul><ul><ul><li>does not take advantage of MXML features. (e.g. binding, metadata) </li></ul></ul></ul><ul><ul><li>Has own event model </li></ul></ul><ul><ul><ul><li>integrating with Flex Event Model takes time, patience & practice. </li></ul></ul></ul><ul><ul><li>Complex~ish learning curve </li></ul></ul><ul><ul><ul><li>lame excuse cuz the benefits outweigh </li></ul></ul></ul><ul><ul><li>Boilerplate code </li></ul></ul><ul><ul><ul><li>requires the creation of many classes (hint: use a reproducible skeleton structure on templates) </li></ul></ul></ul>
  16. 16. PureMVC 'Event Flow'
  17. 17. On to Robotlegs...why? Because &quot;We view things not only from different sides, but with different eyes; we have no wish to find them alike.&quot;  - Blaise Pascal
  18. 18. 4.) Meet Robotlegs video
  19. 19. Robotlegs Class Diagram <ul><li>  </li></ul>
  20. 20. Strengths <ul><ul><li>Very simple </li></ul></ul><ul><ul><li>Active community </li></ul></ul><ul><ul><li>Focuses on code, not structure </li></ul></ul><ul><ul><li>MVC is simply a suggestion </li></ul></ul><ul><ul><li>Very easy to unit test (but who tests, really?) </li></ul></ul><ul><ul><li>Designed for Flash/Flex/AIR </li></ul></ul><ul><ul><li>Awesome name and logo  </li></ul></ul><ul><ul><li>Uses Automated Dependency Injection  </li></ul></ul><ul><ul><li>No Boilerplate </li></ul></ul>
  21. 21. Weaknesses <ul><ul><li>No multicore  </li></ul></ul><ul><ul><li>Young </li></ul></ul><ul><ul><li>Small-ish comminuty (but very very active) </li></ul></ul><ul><ul><li>Can be difficult to find documentation/example of more advanced features </li></ul></ul><ul><ul><li>Metadata is scary at first </li></ul></ul><ul><ul><li>Injection errors don't throw compiler errors </li></ul></ul>
  22. 22. Automated Dependency Injection (DI) <ul><li>Robotlegs leverages SwiftSuspenders for it's DI which is based on metadata e.g. [Inject] public var foo:Bar; </li></ul><ul><li>  </li></ul><ul><li>The benefit of DI is that it takes the responsibility from the classes of creating new objects. (Inverse of control) </li></ul><ul><li>  </li></ul><ul><li>This in turn return makes your classes much cleaner to read and increase writing speed. </li></ul>
  23. 23. It's all about community... <ul><li>Robotlegs has a very active community on twitter (#robotlegs) and on github where all of the source for the main framework can be found.  </li></ul><ul><li> </li></ul><ul><li>  </li></ul><ul><li>They also have a community driven  support site : </li></ul>
  24. 24. x.) Resources & References <ul><li>Software framework </li></ul><ul><ul><li> </li></ul></ul><ul><li>Design Patterns: </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>GoF </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>PureMVC: </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>Choosing a framework: </li></ul><ul><ul><li> </li></ul></ul><ul><li>Actionscript 3.0 Design Patterns (O'REILLY, ISBN-10: 0-596-52846-9): </li></ul><ul><ul><li> </li></ul></ul>
  25. 25. Parting thought <ul><li>In the words of marketing guru John Colanzi , &quot;Sometimes you have to take a step back before you can move forward.&quot; </li></ul><ul><li>As developers mature and their skills increase on the long road to mastery, there are few opportunities to truly leap forward. These special moments are the result of taking calculated risks to step up their game. </li></ul><ul><li>While using this framework admittedly has a learning curve, can initially increase development time, and requires discipline, you may find it well worth the effort. </li></ul><ul><li>Evolving from creating custom, per-project frameworks to using a consistent, framework is one such opportunity to leap forward. </li></ul>