Successfully reported this slideshow.
The Next Step in AS3 Framework Evolution                    02.2013
About me                               Raimundas Banevicius                               Senior AS3 Developer            ...
About this presentation●   AS3 framework evolution●   Modular programming in mvcExpress●   mvcExpress live
AS3 framework    evolution
AS3 framework history    (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscri...
AS3 framework history    (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscri...
AS3 framework history    (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscri...
PureMVC              The good                                 The bad●   Organize your code in small units      ●   Slight...
robotlegs           The good                       The bad●   All PureMVC goodness.      ●   Hurts performance a lot!●   R...
robotlegs 2 (beta)           The good                       The bad●   Highly configurable       ●   Adds some boilerplate...
mvcExpress             The good                          The bad●    All PureMVC and robotlegs      ●   Hurts performance ...
package {                                                                 pureMVC mediatorpublic class PureMvcMediator ext...
package {                                                                 pureMVC mediatorpublic class PureMvcMediator ext...
package {                                                                 pureMVC mediatorpublic class PureMvcMediator ext...
package {                                                                 pureMVC mediatorpublic class PureMvcMediator ext...
mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator {     [Inject]     public var view:ViewCompone...
mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator {     [Inject]     public var view:ViewCompone...
mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator {     [Inject]     public var view:ViewCompone...
mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator {     [Inject]     public var view:ViewCompone...
Speed test data                                    mvcExpress      pureMVC    robotlegs    robotlegs 2 Command creation an...
Command performanceCommand runs /1ms         pureMVC    robotlegs   robotlegs 2   mvcExpress   mvcExpress                 ...
Communication performanceDirect communication:     runs /1ms                    1 parameter          5 parameters     Even...
Overview
Modular programming in      mvcExpress
Modular programmingfeatures●   Aggregation●   Communication●   Dependencies(data)●   Permission control (v1.4)
Aggregationvar moduleB:ModuleB = new ModuleB();view.addChild(moduleB);mediatorMap.mediate(moduleB);
Module communication
Module communication
Module communicationsendScopeMessage("scopeName", "messageType", new ParamObject());addScopeHandler("scopeName", "messageT...
Module data sharing(data dependencies)
Module data sharing(data dependencies)
Module data sharing(data dependencies)proxyMap.scopeMap("scopeName", myProxyObject);[Inject(scope="scopeName")]public var ...
Scope permissions   registerScope(scopeName:String,                 messageSending:Boolean = true,                 message...
Dungeon viewer example
Modular programmingpitfalls●   Planning is needed●   Good module should be able to stand    as application on its own    –...
mvcExpress live
mvcExpress live●   mvcExpress live = mvcExpress + game engine    –   Continuous logic execution    –   Dynamic animations ...
mvcExress live diagram
mvcExress live diagram
mvcExress live diagram
mvcExress live diagram
mvcExress live diagram
mvcExress live diagram
mvcExress live diagram
package com.mindscriptact.testProject.engine {                   Process examplepublic class GameEngineProcess extends Pro...
Task examplepackage com.mindscriptact.testProject.engine.tasks {public class ShowEnemiesTask extends Task {     [Inject(na...
mvcExpress live testingpackage com.mindscriptact.testProject.engine.tasks {public class ShowEnemiesTask extends Task {    ...
Process run speed●   Best case:    – Runs   1000000 empty Tasks in 17 ms    – 58823   empty tasks in 1 ms●   Worst case:  ...
mvcExpress live overview●   Designed with games in mind but can be used in any    application than has repeating logic to ...
On learning    curve
On learning curve●   MVC framework initial learning curve is steep...●   But if you learned one – learning another is easy...
mvcExpress logger
Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpres...
Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpres...
Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpres...
Upcoming SlideShare
Loading in …5
×

The Next Step in AS3 Framework Evolution

1,813 views

Published on

Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca

OVERVIEW
Join Raimundas (author of mvcExpress frameworks) as he presents his vision of next step in AS3 MVC framework evolution.

Writing maintainable software fast – was never a trivial task, but MVC frameworks are here to help us! In this session you will see short reminder of MVC framework history, comparison of coding convenience and performance benchmark results for PureMVC, robotlegs and mvcExpress frameworks.

For those who does not enjoy seeing code or statistic tables as much as running applications, Raimundas will show dungeon editor/crawler to demonstrate mvcExpress modular programming features, designed to save even more time and headaches while developing games and applications.

Published in: Internet
  • Be the first to comment

The Next Step in AS3 Framework Evolution

  1. 1. The Next Step in AS3 Framework Evolution 02.2013
  2. 2. About me Raimundas Banevicius Senior AS3 Developer Working with Flash from 2001 Author of open source AS3 framework – mvcExpress Blog : http://www.mindscriptact.com/ Twitter : @Deril E-mail : raima156@yahoo.com
  3. 3. About this presentation● AS3 framework evolution● Modular programming in mvcExpress● mvcExpress live
  4. 4. AS3 framework  evolution
  5. 5. AS3 framework history (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscript (2007)●Parsley(2008)●Mate(2008) [flex only]●Robotlegs(2009)●Swiz(2009) [flex only]●mvcExpress(2012)●Robotlegs 2 (2012) (in beta)
  6. 6. AS3 framework history (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscript (2007)●Parsley(2008)●Mate(2008) [flex only]●Robotlegs(2009)●Swiz(2009) [flex only]●mvcExpress(2012)●Robotlegs 2 (2012) (in beta)
  7. 7. AS3 framework history (ActionScript 3.0 released in 2006)●PureMVC (2006)●Cairngorm (2007?) [flex only]●Springactionscript (2007)●Parsley(2008)●Mate(2008) [flex only]●Robotlegs(2009)●Swiz(2009) [flex only]●mvcExpress(2012)●Robotlegs 2 (2012) (in beta)
  8. 8. PureMVC The good The bad● Organize your code in small units ● Slightly hurts performance● Let those units communicate ● Built on static classes● Standardize your code● Focus on app instead of architecture ● Lots of boilerplate code● Ported to many languages Can it be done simpler?
  9. 9. robotlegs The good The bad● All PureMVC goodness. ● Hurts performance a lot!● Removed most boilerplate code● Introduces dependency injection Can it be done simpler... and run fast?
  10. 10. robotlegs 2 (beta) The good The bad● Highly configurable ● Adds some boilerplate code● Modular ● Code less standardized● Guards, hooks, rules. ● Hurts performance a lot (and more) Can it be done simpler... and run fast?
  11. 11. mvcExpress The good The bad● All PureMVC and robotlegs ● Hurts performance the least goodness. ● Young framework● Focus on modular development● Simplifies code even more Simplest and fastest MVC framework!
  12. 12. package { pureMVC mediatorpublic class PureMvcMediator extends Mediator implements IMediator { public static const NAME:String = "PureMvcMediator"; public function PureMvcMediator(initViewComponent:ViewComponent) { super(NAME, initViewComponent); } // cast view for convenient local use. public function get view():ViewComponent { return super.getViewComponent() as ViewComponent; } // listen for framework notices override public function listNotificationInterests():Array { return [ // DataNote.STUFF_DONE // ]; } // handle framework events override public function handleNotification(notice:INotification):void { switch (notice.getName()) { case DataNote.STUFF_DONE: // do stuff… break; }}}
  13. 13. package { pureMVC mediatorpublic class PureMvcMediator extends Mediator implements IMediator { public static const NAME:String = "PureMvcMediator"; public function PureMvcMediator(initViewComponent:ViewComponent) { super(NAME, initViewComponent); } // cast view for convenient local use. public function get view():ViewComponent { return super.getViewComponent() as ViewComponent; } // listen for framework notices override public function listNotificationInterests():Array { return [ // DataNote.STUFF_DONE // ]; } // handle framework events override public function handleNotification(notice:INotification):void { switch (notice.getName()) { case DataNote.STUFF_DONE: // do stuff… break; }}}
  14. 14. package { pureMVC mediatorpublic class PureMvcMediator extends Mediator implements IMediator { public static const NAME:String = "PureMvcMediator"; public function PureMvcMediator(initViewComponent:ViewComponent) { super(NAME, initViewComponent); } // cast view for convenient local use. public function get view():ViewComponent { return super.getViewComponent() as ViewComponent; } // listen for framework notices override public function listNotificationInterests():Array { return [ // DataNote.STUFF_DONE // ]; } // handle framework events override public function handleNotification(notice:INotification):void { switch (notice.getName()) { case DataNote.STUFF_DONE: // do stuff… break; }}}
  15. 15. package { pureMVC mediatorpublic class PureMvcMediator extends Mediator implements IMediator { public static const NAME:String = "PureMvcMediator"; public function PureMvcMediator(initViewComponent:ViewComponent) { super(NAME, initViewComponent); } // cast view for convenient local use. public function get view():ViewComponent { return super.getViewComponent() as ViewComponent; } // listen for framework notices override public function listNotificationInterests():Array { return [ // DataNote.STUFF_DONE // ]; } // handle framework events override public function handleNotification(notice:INotification):void { switch (notice.getName()) { case DataNote.STUFF_DONE: // do stuff… break; }}}
  16. 16. mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator { [Inject] public var view:ViewComponent; override public function onRegister():void { // listen for framework events addHandler(DataMessage.STUFF_DONE, handleStuffDone); } // handle framework events private function handleStuffDone(params:DataChangeParamsVO):void { view.showStuff(params.dataParam1); }}}
  17. 17. mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator { [Inject] public var view:ViewComponent; override public function onRegister():void { // listen for framework events addHandler(DataMessage.STUFF_DONE, handleStuffDone); } // handle framework events private function handleStuffDone(params:DataChangeParamsVO):void { view.showStuff(params.dataParam1); }}}
  18. 18. mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator { [Inject] public var view:ViewComponent; override public function onRegister():void { // listen for framework events addHandler(DataMessage.STUFF_DONE, handleStuffDone); } // handle framework events private function handleStuffDone(params:DataChangeParamsVO):void { view.showStuff(params.dataParam1); }}}
  19. 19. mvcExress mediatorpackage {public class MvcExpressMediator extends Mediator { [Inject] public var view:ViewComponent; override public function onRegister():void { // listen for framework events addHandler(DataMessage.STUFF_DONE, handleStuffDone); } // handle framework events private function handleStuffDone(params:DataChangeParamsVO):void { view.showStuff(params.dataParam1); }}}
  20. 20. Speed test data mvcExpress pureMVC robotlegs robotlegs 2 Command creation and execution: 0.00087 0.00219 0.00866 0.01894 1.0 /2.5 /10.0 /21.8 Proxy inject into command: 0.00037 0.00024 0.00491 0.00247 1.0 /0.7 /13.2 /6.6 Mediator create: 0.02100 0.02100 0.05100 0.13600 1.0 /1.0 /2.4 /6.5 https://github.com/MindScriptAct/as3-mvcFramework-performanceTest Mediator remove: 0.01700 0.10300 0.01850 0.05550 1.0 /6.1 /1.1 /3.3 Communication 1 to 1: 0.00030 0.00060 0.00153 0.00141 1.0 /2.0 /5.0 /4.6 Communication 1 to 10: 0.00073 0.00788 0.00670 0.00629 1.0 /10.9 /9.2 /8.7 Communication 1 to 100: 0.00480 0.06897 0.05746 0.05071 1.0 /14.4 /12.0 /10.6
  21. 21. Command performanceCommand runs /1ms pureMVC robotlegs robotlegs 2 mvcExpress mvcExpress (pooled)Command with nothing: 495.0 109.3 55.3 1010.1 1754.4Command with 1 inject: 487.5 70.4 49.6 961.5 1694.9Command with 2 injects: 458.7 58.6 47.2 724.6 1724.1Command with 4 injects: 340.1 44.1 42.7 480.8 1783.3
  22. 22. Communication performanceDirect communication: runs /1ms 1 parameter 5 parameters Events: 688 654 Signals: 1116 741 Callback: 28571 10416Indirect communication: runs /1ms 1 parameter 5 parameters PureMvc notifications: 552 454 robotlegs events: 652 622 mvcExpress messages: 5464 2584
  23. 23. Overview
  24. 24. Modular programming in  mvcExpress
  25. 25. Modular programmingfeatures● Aggregation● Communication● Dependencies(data)● Permission control (v1.4)
  26. 26. Aggregationvar moduleB:ModuleB = new ModuleB();view.addChild(moduleB);mediatorMap.mediate(moduleB);
  27. 27. Module communication
  28. 28. Module communication
  29. 29. Module communicationsendScopeMessage("scopeName", "messageType", new ParamObject());addScopeHandler("scopeName", "messageType", scopedMessageHandrlerFunction);
  30. 30. Module data sharing(data dependencies)
  31. 31. Module data sharing(data dependencies)
  32. 32. Module data sharing(data dependencies)proxyMap.scopeMap("scopeName", myProxyObject);[Inject(scope="scopeName")]public var myProxy:MyProxy;
  33. 33. Scope permissions registerScope(scopeName:String, messageSending:Boolean = true, messageReceiving:Boolean = true, proxieMapping:Boolean = false ):void
  34. 34. Dungeon viewer example
  35. 35. Modular programmingpitfalls● Planning is needed● Good module should be able to stand as application on its own – Chat window – Stand alone tutorial● Worst case scenario: extracting module/reintegrating module refactoring.
  36. 36. mvcExpress live
  37. 37. mvcExpress live● mvcExpress live = mvcExpress + game engine – Continuous logic execution – Dynamic animations – Breaking execution in parts. (batching)● Compatible with mvcExpress
  38. 38. mvcExress live diagram
  39. 39. mvcExress live diagram
  40. 40. mvcExress live diagram
  41. 41. mvcExress live diagram
  42. 42. mvcExress live diagram
  43. 43. mvcExress live diagram
  44. 44. mvcExress live diagram
  45. 45. package com.mindscriptact.testProject.engine { Process examplepublic class GameEngineProcess extends Process { override protected function onRegister():void { addTask(MoveHeroTask); addTask(MoveEnemiesTask); addTask(HeroCollideEnemiesTask); addTask(EnemySpawnTask); addTask(ShowHeroTask); addTask(ShowEnemiesTask); addHandler(Message.PAUSE_GAME, handleGamePause); } private function handleGamePause(isPaused:Boolean):void { if (isPaused) { disableTask(MoveHeroTask); disableTask(MoveEnemiesTask); } else { enableTask(MoveHeroTask); enableTask(MoveEnemiesTask); } }}}
  46. 46. Task examplepackage com.mindscriptact.testProject.engine.tasks {public class ShowEnemiesTask extends Task { [Inject(name="enemyDatas")] public var enemyDatas:Vector.<EnemyVO>; [Inject(name="enemyViews")] public var enemyImages:Vector.<EnemySprite>; override public function run():void { for (var i:int = 0; i < enemyDatas.length; i++) { enemyImages[i].x = enemyDatas[i].x; enemyImages[i].y = enemyDatas[i].y; enemyImages[i].rotation = enemyDatas[i].rotations; } }}}
  47. 47. mvcExpress live testingpackage com.mindscriptact.testProject.engine.tasks {public class ShowEnemiesTask extends Task { [Inject(name="enemyDatas")] public var enemyDatas:Vector.<EnemyVO>; [Inject(name="enemyViews")] public var enemyImages:Vector.<EnemySprite>; override public function run():void { for (var i:int = 0; i < enemyDatas.length; i++) { enemyImages[i].x = enemyDatas[i].x; enemyImages[i].y = enemyDatas[i].y; enemyImages[i].rotation = enemyDatas[i].rotations; } } [Test] public function showEnemiesTask_enemyViewAndDataCount_isEqual():void { assert.equals(enemyDatas.length, enemyImages.length, "Enemies data and view count must be the same!"); } [Test(delay="500")] public function showEnemiesTask_enemyViewAndDataPosition_isEqual():void { for (var i:int = 0; i < enemyDatas.length; i++) { assert.equals(enemyImages[i].x, enemyDatas[i].x, "Enemy x is damaged. enemyId:" + enemyDatas[i].id); assert.equals(enemyImages[i].y, enemyDatas[i].y, "Enemy y is damaged. enemyId:" + enemyDatas[i].id); } }}}
  48. 48. Process run speed● Best case: – Runs 1000000 empty Tasks in 17 ms – 58823 empty tasks in 1 ms● Worst case: – 13300 empty tasks in 1 ms
  49. 49. mvcExpress live overview● Designed with games in mind but can be used in any application than has repeating logic to run.● Processes and Tasks are decoupled● Convenient communication with MVC● It is possible to break Model and View decoupling rules, but gives tools to detect it.● It is fast!● It just works!
  50. 50. On learning  curve
  51. 51. On learning curve● MVC framework initial learning curve is steep...● But if you learned one – learning another is easy! http://mvcexpress.org/documentation/ https://github.com/MindScriptAct/mvcExpress-examples Also I do workshops.
  52. 52. mvcExpress logger
  53. 53. Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpress-exampleshttps://github.com/MindScriptAct/mvcExpress-downloads http://puremvc.org/ http://www.robotlegs.org/Raimundas BaneviciusBlog : http://www.mindscriptact.com/Twitter : @DerilE-mail : raima156@yahoo.com Thank you for your time! Questions?
  54. 54. Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpress-exampleshttps://github.com/MindScriptAct/mvcExpress-downloads http://puremvc.org/ http://www.robotlegs.org/Raimundas BaneviciusBlog : http://www.mindscriptact.com/Twitter : @DerilE-mail : raima156@yahoo.com Questions?
  55. 55. Linkshttp://mvcexpress.org/https://github.com/MindScriptAct/mvcExpress-frameworkhttps://github.com/MindScriptAct/mvcExpress-exampleshttps://github.com/MindScriptAct/mvcExpress-downloads http://puremvc.org/ http://www.robotlegs.org/Raimundas BaneviciusBlog : http://www.mindscriptact.com/Twitter : @DerilE-mail : raima156@yahoo.com Questions?

×