Robotlegs 2 and your brain

15,237 views

Published on

Extended slide deck of my September 2011 Flash on the Beach presentation "Robotlegs 2 and your brain - a great developer toolchain".

The presentation asks the question - what do programmers need to know about how their brains work? And how did we employ cognitive and neuroscience to make decisions about version 2 of the Robotlegs ActionScript framework.

If you're brand new to Robotlegs then the coverage of the workings of Robotlegs 1 are likely to be insufficient - I'd suggest picking up a copy of ActionScript Developers Guide to Robotlegs first.

More details are available at www.robotlegs.org

Published in: Technology, Health & Medicine
2 Comments
19 Likes
Statistics
Notes
  • Great Robotlegs Example. The dependency injection is functional, but non-native.

    Adobe's Flash Platform roadmap is out! Included are ActionScript 4.0 revelations. From a language design standpoint, Adobe uses the following assumptions as a guide for next-generation ActionScript development; a) longterm productivity, b) high performance, & c) hardware utilization.

    What would Robotlegs developers love to see in AS4? Native dependency injection?

    READ ALL THE DETAILS!
    http://www.rivellomultimediaconsulting.com/actionscript-4-revealed/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • i like the Steve Jobs one point per slide + imagery influence. I used it on my latest deck (not currently up) as well. Nice.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
15,237
On SlideShare
0
From Embeds
0
Number of Embeds
3,325
Actions
Shares
0
Downloads
156
Comments
2
Likes
19
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Robotlegs 2 and your brain

    1. Robotlegs 2 and Your Brain Stray (Lindsey Fallow) @stray_and_ruby xxcoder.net 1
    2. Stray (Lindsey Fallow) @stray_and_ruby xxcoder.net Ruby Stray 2
    3. Team Robotlegs Joel Hooks Ro botlegs Core Robot legs or iginator Signals Shaun Smith Robert Penner Till Schneidereit Swiftsuspendersand me, Stray (behind camera) 3
    4. +[robotlegs 2] 4
    5. What we’ll cover [robotlegs 2] ? ? ? 5
    6. A robotlegs pomodoro timer (FOTB attendees won these)You’ll need a pen and paper for exercises 6
    7. STOPJARGON FREE ZONE 7
    8. “Dependency Injection” We’ll try not to terms like this w use ithout explaining them. 8
    9. What is Robotlegs? “ActionScript 3 framework”[robotlegs] Doesn’t really tell us much. 9
    10. What do we meanby “framework”? 10
    11. What do we meanby “framework”? A framework is a tool 11
    12. What do we meanby “framework”? Take 30 seconds to A framework is a tool list as many things as you can think of that you could do with this tool. 12
    13. What do we meanby “framework”? A framework is a toolMost people would say that this is a better screwdriver, but howmany things on your list can’t be done with this tool? 13
    14. I used the correct size of screwdriver for this screw.Using the wrong tool can be I used the wrongfrustrating, or - worse - it can size of screwdriverresult in the work becoming for this screw.‘broken’ beyond repair. 14
    15. Write down yourdevelopment toolset 15
    16. You probably included some of these. 16
    17. Your toolset includes your brain17
    18. Most developers know almost nothing about the mostimportant part of their toolset. 18
    19. :~ man brain 19
    20. :~ man brain> No manual entry for ‘brain’ 20
    21. Your brain is a legacy system 21
    22. Your brain is a legacy system If you were designing a system for writing software you wouldn’t start with the human brain. 22
    23. “The triune brain” Problem solving brain Mammal brain (neo-cortex)Lizard brain (limbic system)(brain stem)
    24. Your lizard brain takes care of basic ‘staying alive’ impulses such as breathing.24
    25. Your mammal brain (limbic-system) allows you to formattachments, cooperate and live alongside your peers. 25
    26. Your mammal brain evolvedbefore we had language, so its influence on you is mostlychemical - you ‘feel’ messages from your limbic-system. 26
    27. Your problem-solving brain is aminor additionto the olderbrain structurethat supports it.
    28. We care about the brain because - as with any tool - we need to know: What is your brain good at?What is your brain not good at?
    29. What is your brain good at? Simple mental arithmetic
    30. What is your brain good at? Estimating 30 seconds Simple mental arithmetic
    31. What is your brain good at? Estimating 30 seconds while doing Simple mental arithmetic
    32. Start a stopwatch, then make a list of thesquares of prime numbers starting from 2, and try to estimate 30 seconds passing.
    33. GO!
    34. Multi-tasking FTL! Our lizard brain is fine at multi- tasking, but our problem-solvingbrain isn’t. When we try to multi- task our performance in evensimple tasks dramatically reduces.
    35. Architecture & Coding are different tasks Using Robotlegs should allow you to focus more cleanly on one or the other. When you’re coding a class, thoughts about architecture shouldn’t be intruding.
    36. Working memory• The ‘RAM’ we use to hold things in mind in order to solve a problem.• Items stored in working memory are regularly garbage collected - you won’t remember them later.• Programmers rely heavily on working memory when carrying concepts within and between classes.
    37. Working memory test Give yourself 30 seconds to commit the following list of words to memory, and then move to the next slide.
    38. Working memory testrefugee mill architectquilt mermaid pimpleweather salary walletlaundry tram verseinternet athletics thundereyebrow nurse spacechess seal eggflight stamp system
    39. Working memory test Now write down as many as you can remember. Order is not important. Give yourself 30 - 60 seconds.
    40. Working memory test Check your answers.refugee mill architectquilt mermaid pimpleweather salary walletlaundry tram verseinternet athletics thundereyebrow nurse spacechess seal eggflight stamp system
    41. Working memory test Most people remember 6 - 9 words. I’m now going to challenge you to remember more than twice as many, from a different list of 25. Again, give yourself 30 seconds to memorise them, and then move to the next slide.
    42. Working memory test 25 words - 30 secondsWar and peace Nobody does it betterOver the rainbow Love and warCats and dogs I’ll be backNight before Christmas ctrl, alt, delete
    43. Working memory test 25 words - 30 seconds Now write down as many as you can remember. Order is not important. Give yourself 30 - 60 seconds.
    44. Working memory test 25 words - 30 seconds Check your answers - count every word that you got correct.War and peace Nobody does it betterOver the rainbow Love and warCats and dogs I’ll be backNight before Christmas ctrl, alt, delete
    45. Chunking FTW! Your working me7±2 of 7 ‘plus or min mory consists us 2’ chunks
    46. Chunking is like ‘zip’ for your working memory up and Mickey down Mouse nurse 747 7 7,8,9 A chunk can be a single A chunk can be a word or number sequence, set or pattern that you have met before
    47. Chunking uses neural networks Peace Pipes War Repeated simultaneous firing of individual neurons creates connections between them. Triangle Euclid Love
    48. “What fires together, wires together!” Peace Pipes War Triangle Euclid Love
    49. If you wrote crap code today,you hard wired your brain to ... 49
    50. If you wrote crap code today,you hard wired your brain to find it easier to write crap code tomorrow. 50
    51. Chunking and RobotlegsWe want Robotlegs to occupy as few chunks aspossible, leaving most of your working memoryfree to tackle your specific problem.
    52. Are you bored yet?If you are, this presentation isn’t causingyou to create enough dopamine. 52
    53. DopamineDopamine is a neurotransmitter. Like engine oil foryour brain. It helps you to stay on task and alsomakes you more effective at problem solving. 53
    54. DopamineDistracted Focussed 54
    55. Dopamine Vicious Circle - not enough dopamine => distracted, unproductive, prone to mistakes, slow progress => Virtuous Circle - plenty lower dopamine. dopamine => focussed, productive, insightful, fast progress => more dopamine.Distracted Focussed 55
    56. Dopamine is key topattern recognition Helps you find ‘the zone’ and stay there 56
    57. You noticed that some of theseshapes were different, withoutdeciding to look for differences.We call this ‘pre-attentive’ processing. Helps you find ‘the zone’ and stay there 57
    58. Give yourself 6 seconds to estimate the number oftriangles in the next picture 58
    59. 59
    60. how many triangles? 60
    61. how many triangles? Answer = Zero(to see why, flick back and forth between the next 2 slides) 61
    62. 62
    63. 63
    64. Our brain craves patternsTo the extent that we’ll findthem even when they’re notreally there. 64
    65. Cognitive dissonanceThe feeling that“Something doesn’t fit”.That ‘feeling’ is a dropin dopamine. 65
    66. Dopamine Cognitive dissonance Time 66
    67. Cognitive dissonance canbe meaningful and directingFighter pilots rely on it for rapidly detecting problems.It can also tell you that something is wrong with your code. 67
    68. Cognitive dissonance can bemeaningless and distracting Event.ADDED Event.COMPLETE To me, it feels like there’s something wrong when I mix cases in event types. 68
    69. Meaningful, directing vsMeaningless, distracting 69
    70. Meaningful, directing In order to tune in to this, we need to limit the amount of cognitive vs dissonance the Robotlegs framework triggers.Meaningless, distracting 70
    71. Dopaminevariation FTW & FTL!
    72. Have you everwritten code that was like this?
    73. Great solution,wrong problem.
    74. Great solution, wrong problem. It’s a really lovely yoda suit for adog, but who needs one of those?
    75. ‘Right execution of the wrong thing’ happens when one half of our brain dominates decision making. Left brain Right brain(right hand) (left hand) 75
    76. A brain of two halves Left brain Right brain(right hand) (left hand) • Specific • Context • Details • Big picture • Calculation • Estimation 76
    77. Programming is whole-brain problem solving Left brain Right brain(right hand) (left hand) “How to do it right” “The right thing to do” Emerges as specific Emerges as somatic thoughts (body) feelings 77
    78. Metaphors triggerwhole brain activity +(Which is why we talked about Yoda-suits for dogs) 78
    79. Metaphors triggerwhole brain activity +(And why Robotlegs 2 will try to give things descriptive names) 79
    80. Brain Summary• Avoid multi-tasking• Take advantage of chunking• Dopamine is key to staying in flow• Make cognitive dissonance meaningful• Programming is a ‘whole brain’ activity• Metaphor activates the ‘whole brain’ 80
    81. Brain questions?81
    82. What is Robotlegs? “ActionScript 3 framework”[robotlegs] 82
    83. What is Robotlegs? “ActionScript 3 communication, cooperation, and configuration framework”[robotlegs] 83
    84. Writing code is easy Very clever class that gets and A menu A really sends data to accepting user tasty view and from a input server A clever class that checks whether Another reallyA quite simple tasty viewclass that does input is validstuff with XML 84
    85. Joining code together is hard Very clever class that gets and A menu A really sends data to accepting user tasty view and from a input server A clever class that checks whether Another reallyA quite simple tasty viewclass that does input is validstuff with XML 85
    86. A “dependency” is just a need touse an instance of another object for communication, cooperation, or configuration 86
    87. “Dependency Injection”var kittenPath:String = “http://kittens978.com/feed.xml”;var kittenRequest:URLRequest = new URLRequest(kittenPath);_kittenLoader = new URLLoader(kittenRequest); 87
    88. “Dependency Injection”var kittenPath:String = “http://kittens978.com/feed.xml”;var kittenRequest:URLRequest = new URLRequest(kittenPath);_kittenLoader = new URLLoader(kittenRequest); 88
    89. DI can lead to a lot of “pass the parcel code”Animation timing View class that has nothing to do with timing, or feeds, but creates and contains the animation and the menu Feed details Animation class Menu class that that times the displays feeds to fading of images the user 89
    90. Static Singletons One approach to solving the ‘pass the parcel’ dependency chain problem. 90
    91. Static SingletonsSuck• ImposeSingleton class on the extra responsibilities• Impose extra knowledge on the using class• Very difficult to vary and test corner cases 91
    92. The Robotlegs dream:Dependency Inception Feed details 92
    93. The Robotlegs dream:Dependency Inception A an object inside an object inside an object inside an object... and Feed details nobody knows how it got there - it just appeared. 93
    94. To declare a dependency [Inject] public var importantCollaborator:ICollaboratorClass; 94
    95. Injections recipe Class with Injected [Inject] objectrequirements The Robotlegs Injector is just a factory 95
    96. Injection opens up possibilities• Communication via a shared eventDispatcher instance• “Mediators” - connecting (dumb) views to your application• The Command Pattern 96
    97. Shared eventDispatcher -broadcast events to your app Some Some other Some Some service service model other model 97
    98. Mediators for individual views View Mediator 98
    99. Commands are snack-sizecontrollers, triggered by events Feed Loader Service FeedSelectorEvent.Mediator FEED_SELECTED Command with [Inject] requirements 99
    100. Again: Injection is not magic• The Injector is just a factory• It needswithbe pre-advised about how to deal to injection requests 100
    101. How to tell the injector what to doinjector.mapSingletonOf(IFeedService, XMLFeedService);injector.mapValue(IFeedConfig, new DefaultFeedConfig()); 101
    102. Robotlegs 1 - Feature recap• [Inject] dependencies• Shared eventDispatcher• Mediators automatically created & destroyed for views• Commands mapped to events 102
    103. Robotlegs questions?[robotlegs] 103
    104. +[robotlegs 2] 104
    105. Robotlegs uses ‘Semantic versioning’• Point releases must be backward compatible - eg 1.3 can be dropped in to an application previously using 1.2, without breakages.• Major releases (eg 2.0 vs 1.0) can rewrite the API.• This gives us great freedom in terms of Robotlegs 2.0• but... 105
    106. Neural networks do not adhereto semantic versioning 106
    107. So, everything you alreadyunderstand about Robotlegs will remain the same. 107
    108. We looked onthe robotlegsforums for thethings that madeyou feel likethis... 108
    109. Using mediators as view controllers 109
    110. Unclear mapping syntaxinjector.mapClass(IFeedConfig, FeedConfig); 110
    111. Lack of symmetryaddViewListener(MouseEvent.CLICK, handleSubmit);removeViewListener(MouseEvent.CLICK, handleSubmit); 111
    112. Lack of symmetryaddViewListener(MouseEvent.CLICK, handleSubmit);removeViewListener(MouseEvent.CLICK, handleSubmit); This function doesn’t exist 112
    113. Annoying to mix utilitiespublic class MyContext extends RelaxedSignalModuleStatefulContext 113
    114. Modular feels hard 114
    115. In unfamiliar territory, we canlose our ‘right brain’ context.We feel lost.New and upgrading users wanta quick push in the rightdirection. 115
    116. 4 new Robotlegs 2 ‘flavours’ PerformanceFast Flexible Clean 116
    117. Choose one to start your project PerformanceFast Flexible Clean 117
    118. DISCLAIMERthis.api.is(UNDER_CONSTRUCTION); 118
    119. Fluent context buildercontextBuilder.installUtility(CommandMap) .installUtility(ConfigLoader) .installUtility(ViewManager) .installUtility(SignalCommandMap) .withConfiguration(XMLMappings) .build(); 119
    120. Fluent mappingsinjector.asSingleton.map(IFeedService).to(XMLFeedService);viewManager.handle(FeedMenu) .mediateWith(FeedMenuMediator); 120
    121. Chunking in Robotlegs 2? “Guards and Hooks” 2 Simple ideas add a lot of functionality 121
    122. Guards prevent/allow action Feed Loader Service FeedSelectorEvent. Command withMediator FEED_SELECTED [Inject] requirements 122
    123. Guards prevent/allow action Feed Loader Service Sufficient Command with FeedSelectorEvent. Network [Inject] requirementsMediator FEED_SELECTED Capacity Guard Feed Status Fallback Command 123
    124. Hooks support collaborationView Mediator Menu Skinner Hook View and a skinning factory are injected into the hook. 124
    125. Hooks support collaborationView Mediator View Logic Wiring Hook View and a logic factory are injected into the hook. 125
    126. Many-mediators-per-view Enemy Spaceship EnemySpaceship Mediator Mediator View 126
    127. Descriptive type matchingISpaceship IPlayer Spaceship ✓ ✗ Mediator IEnemy IBoss Enemy ✓ ✗ Mediator 127
    128. var enemyMatcher:TypeMatcher = matcherFor(ISpaceship) .and(IEnemy) .not(IBoss) .andNot(IEnemyGhost); 128
    129. View manager:have your cake and eat it Awesome Utility Mediator Map View Map Map Stage Never more than one listener for a stage event 129
    130. Wow, I thought we weresomewhere totally different 130
    131. Imagine every stop is a state of your app. Confused?131
    132. Grouping control flow can help youCommand Flows follow state changes more easily. 132
    133. Rule setsInjections recipe Injections recipe Rules applied and removed in response to events. 133
    134. Less cognitive dissonance, more flow We often create big classes with multiple responsibilities in order to create a sense of flow. 134
    135. Less cognitive dissonance, more flowRobotlegs can help you stayin flow even when workingwith larger numbers ofsmaller classes.And speaking of separatingresponsibilities... 135
    136. Modular just works“everything is a module” 136
    137. “Soft” mappings Excuse me, if Injections recipe nobody else has already created a mapping for this, then I’ll oblige. Allows you to use thismodule stand-alone or in combination with other Robotlegs modules. Without recompiling! 137
    138. The InspectorGadgetYour code de 138
    139. The InspectorGadget“This injection point looks broken” 139
    140. The InspectorGadget“This Command never executed” 140
    141. The InspectorGadget“This is the order in whichobjects were instantiated” 141
    142. Robotlegs 2: Feature overview• Build your context - have it your way • Rule sets• Fluency / mxml • Multiple mediators• 4 Robotlegs ‘flavours’ • Type matchers• Command flows • The InspectorGadget• Mix view management strategies • Modular just works 142
    143. Release process• Alpha releases: API still in flux• Beta releases: API locked, future proof• One feature at a time• Match v1 Feature set• As fast as we can! 143
    144. [robotlegs 2]www.robotlegs.org 144
    145. Robotlegs 2 questions?[robotlegs 2] 145

    ×