Scaling the Cairngorms<br />One Way Up the Mountain<br />Test-Driven Flex and ArcGIS Server Development Utilizing Cairngor...
Your Sherpa<br />Glenn Goodrich<br />Enspiria Solutions<br />ggoodrich@enspiria.com<br />@ruprictGeek<br />
Pragmatica<br />Destination: Summit of Pragmatica<br />Build good practices like TDD, IoC, DI and make a MOCKery of unmain...
What’s on our backs?<br />Flex API<br />Cairngorm 3<br />FlexUnit 4<br />Parsley<br />ASMock<br />Hamcrest<br />
Who are you?<br />Previous Climbing Experience<br />  Flex Developer<br />  Understand TDD, IoC/DI<br />  Understand Mocki...
Base Camp: Cairngorm<br />Micro-Architecture<br />  Command Pattern<br />IoC to Inject Models & Services<br />Guidelines<b...
Base Camp: Cairngorm Guidelines<br />Application Layers<br /> Presentation<br />  Application<br /> Domain<br /> Infrastru...
Base Camp: Cairngorm Guidelines<br />Presentation<br /> View and View Models<br />  MXML has minimal script<br />  MXML bi...
Base Camp: Cairngorm Guidelines<br />Cairngorm<br />Messaging<br />event<br />event<br />Infrastructure<br />View => PM<br...
Base Camp: Cairngorm Tools<br />Leverage Existing Libraries<br /> FlexUnit4<br />ASMock<br />FlexPMD<br /> IDE Plugins<br ...
Base Camp: Cairngorm Libraries<br />Integration<br />Observer<br />Validation<br />Navigation<br />Module<br />Task <br />...
Base Camp: Cairngorm Libraries<br />public class SelectStadiumsCommand<br />{<br />  [Inject]<br />  public varservice:ISt...
Base Camp: Cairngorm Libraries<br />Observer<br />Data binding <br />  Don’t use this<br />  (unless you have to)<br /><ob...
Base Camp: Cairngorm Libraries<br />Validation<br />Data Input<br />  Domain Validation<br /><validators:ValidatorGroup id...
Base Camp: Cairngorm Libraries<br />Navigation<br />Waypoints and Landmarks<br />  Navigation Interceptors<br />  Navigati...
Base Camp: Cairngorm Libraries<br />PopUp<br />PopUp Management <br />  Abstract PopUpManager<br /><popup:PopUpWrapper id=...
Base Camp: Cairngorm Libraries<br />Module<br /> Modular Applications*<br />Task<br />  Sequence Commands<br /> Parallel C...
Base Camp: Parsley & SpiceLib<br />Parsley<br /> Dependency Injection<br /> Messaging<br /> Task Framework<br />SpiceLib<b...
Pragmatica Need<br />The Cairngorms are the last place on earth where the NFL hasn’t played a football game.  The leaders ...
The Foot of the Summit<br />Data<br /> Base Map<br /> NFL Stadiums (via GeoCommons)<br />Special Instructions<br /> Compil...
The Foot of the Summit<br />Source Structure<br />  Broken into Functional Areas<br />  Separate test folder<br />
First Belay: Write a Test<br />FlexUnit4 Setup<br /> Test Suite (Scaling Tests)	<br />TestRunner Application<br />User Sto...
First Belay: Under Test<br />Cairngorm<br />Messaging<br />event<br />View => PM<br />
First Belay: Under Test<br />
Second Belay: Write a Test<br />Command Test<br /> Should call a service<br />  Should update model with results<br />Appl...
Second Belay: Under Test<br />Cairngorm<br />Messaging<br />Infrastructure<br />Command<br />invokes<br />returns<br />upd...
Second Belay: Under Test<br />
Third Belay: Hook Up the View<br />Guidelines<br />   Only knows about PM <br />   Use Flex data binding<br />
Third Belay: Hook Up the View<br />
Fourth Belay: Configure IoC<br />Views<br />addedToStage<br />PMs<br />ManagedEvents<br />Parsley IoC<br />   Create a Con...
Fourth Belay: Configure IoC<br />
Fourth Belay: Configure IoC<br />
Race to the Summit<br />Pragmatica<br />Rinse, Lather, Repeat<br />   Write Tests<br />   Write Code to Satisfy Tests<br /...
Back at Base Camp<br />Presentation on SlideShare<br />http://slideshare.net/ruprict/scaling-caringorms<br />Source Code o...
Questions<br />Thanks for coming!<br />Post Climb Refreshments<br />
Upcoming SlideShare
Loading in...5
×

Scaling Cairngorms

2,415

Published on

My 2010 ESRI Developers Summit preso on Cairngorm 3 and best practices.

Published in: Technology, Education
1 Comment
4 Likes
Statistics
Notes
  • good overview of Cainrgorm 3
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,415
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide
  • Flex work for &gt;2 yearUsed Cairngorm 2 on a couple of projectsThis presentation focuses on Cairngorm 3, which is in beta
  • Goal: To get to Base Camp Pragmatica where maintainable, clean Flex apps are the norm.
  • Cairngorm 3 – the frameworkFlexUnit4 – TDDSpicefactory/Parsley – IoC, messagingAGS Flex API - MapsHamcrest – MatchersASMock – Mock framework
  • Cairngorm 3 – the frameworkFlexUnit4 – TDDSpicefactory/Parsley – IoC, messagingAGS Flex API - MapsHamcrest – MatchersASMock – Mock framework
  • Cairngorm 3 is still in betaI recommend using it b/c it&apos;s cleaner, easier to test &amp; maintain&quot;Microarchitecture&quot; to develop RIAsWhile some of the Cairngorm 2 patterns are still around, much of what was wrong with Cairngorm 2 is gone.Command pattern is still hereIOC is goneHas a set of Guidelines, Tools, and Libraries to help describe and support this microarchitecture
  • Split the application into functional areas.In larger applications, you would split the functional areas into modules, and each FA would have layersPresume IoC, but don&apos;t specify a provider.  This is the heart of Cairngorm 3&apos;s adaptability.  The example implementation is written using Parsley and SpiceLibVERY different from Cairngorm 2
  • Layout application (or modules) into the these four functional areas
  • Layout application (or modules) into the these four functional areas
  • Scaling Cairngorms

    1. 1. Scaling the Cairngorms<br />One Way Up the Mountain<br />Test-Driven Flex and ArcGIS Server Development Utilizing Cairngorm 3<br />
    2. 2. Your Sherpa<br />Glenn Goodrich<br />Enspiria Solutions<br />ggoodrich@enspiria.com<br />@ruprictGeek<br />
    3. 3. Pragmatica<br />Destination: Summit of Pragmatica<br />Build good practices like TDD, IoC, DI and make a MOCKery of unmaintainable development.<br />
    4. 4. What’s on our backs?<br />Flex API<br />Cairngorm 3<br />FlexUnit 4<br />Parsley<br />ASMock<br />Hamcrest<br />
    5. 5. Who are you?<br />Previous Climbing Experience<br /> Flex Developer<br /> Understand TDD, IoC/DI<br /> Understand Mocking<br />Bonus<br /> Cairngorm experience<br /> Other MVC experience<br />
    6. 6. Base Camp: Cairngorm<br />Micro-Architecture<br /> Command Pattern<br />IoC to Inject Models & Services<br />Guidelines<br />Tools<br />Libraries<br />We are here<br />NOTHING like Cairngorm 2.<br />(Really, like, they are TOTALLY different)<br />
    7. 7. Base Camp: Cairngorm Guidelines<br />Application Layers<br /> Presentation<br /> Application<br /> Domain<br /> Infrastructure<br />Presume IoC, but don’t specify<br />Loose Coupling<br />NOTHING like Cairngorm 2.<br />(Really, like, they are TOTALLY different)<br />
    8. 8. Base Camp: Cairngorm Guidelines<br />Presentation<br /> View and View Models<br /> MXML has minimal script<br /> MXML binds to Model<br /> MXML throws inline events<br /> View Model throws business events<br />Application<br /> Events & Commands<br /> Integrate to the world<br /> Changes Model<br />Domain<br /> Business Objects<br /> Business Logic (Client-side)<br />Infrastructure<br /> Services, Remote & Local (cache)<br />
    9. 9. Base Camp: Cairngorm Guidelines<br />Cairngorm<br />Messaging<br />event<br />event<br />Infrastructure<br />View => PM<br />Command<br />invokes<br />returns<br />updates<br />binds to<br />Model<br />
    10. 10. Base Camp: Cairngorm Tools<br />Leverage Existing Libraries<br /> FlexUnit4<br />ASMock<br />FlexPMD<br /> IDE Plugins<br />Pretty sparse, right now.<br />IDE Integration could be the only place Cairngorm 3 is like Caringorm 2<br />
    11. 11. Base Camp: Cairngorm Libraries<br />Integration<br />Observer<br />Validation<br />Navigation<br />Module<br />Task <br />PopUp<br />Think Patterns & Practices<br /> Provide framework<br /> Handle common needs<br />
    12. 12. Base Camp: Cairngorm Libraries<br />public class SelectStadiumsCommand<br />{<br /> [Inject]<br /> public varservice:IStadiumService;<br /> [Inject]<br /> public varselectedStadiums:Stadiums;<br /> [Command(selector="selectStadiums")]<br /> public function execute(event:SelectStadiumsEvent):AsyncToken{<br />return service.getStadiumsForGeometry(event.geometry);<br /> }<br /> [CommandResult(selector="selectStadiums")]<br /> public function handleStadiums(result:*,event:SelectStadiumsEvent):void{<br /> //Transform result <br />Integration <br />Command Pattern<br /> Global Error Handling<br /> Progress Information<br />
    13. 13. Base Camp: Cairngorm Libraries<br />Observer<br />Data binding <br /> Don’t use this<br /> (unless you have to)<br /><observer:Observe source="{model.selectedExtent.xmin}“ handler="updateExtent"/><br />
    14. 14. Base Camp: Cairngorm Libraries<br />Validation<br />Data Input<br /> Domain Validation<br /><validators:ValidatorGroup id="validatorGroup"><br /> <validators:validators><br /> <mx:StringValidator id="firstnameValidator"<br /> source="{ firstnameInput }"<br /> required="true"<br />minLength="3"<br /> property="text"<br />triggerEvent="change"/><br /> <mx:StringValidator id="lastnameValidator"<br /> source="{ lastnameInput }"<br /> required="true"<br />minLength="2"<br /> property="text"<br />triggerEvent="change"/><br /> </validators:validators><br /></validators:ValidatorGroup><br />
    15. 15. Base Camp: Cairngorm Libraries<br />Navigation<br />Waypoints and Landmarks<br /> Navigation Interceptors<br /> Navigation State<br /><mx:ViewStackxmlns:mx="http://www.adobe.com/2006/mxml" > <br /> <mx:Metadata><br /> [Waypoint]<br /> </mx:Metadata><br /> <dashboard:BoardViewautomationName="{ ContentDestination.DASHBOARD }“/><br /> <news:NewsView automationName="{ ContentDestination.NEWS }"/><br /> <messages:MessagesViewautomationName="{ ContentDestination.MESSAGES }"/><br /></mx:ViewStack><br />………………………………………………………………………………………..<br />[Landmark(name=“news")]<br />public class ContentPM implements ISelectedIndex<br />{<br /> [Bindable]<br /> public varselectedIndex:int;<br />………………………………………………………………………………………..<br />private function navigateTo(destination:String):void { dispatcher(NavigationEvent.newNavigateToEvent(destination)); <br />}<br />
    16. 16. Base Camp: Cairngorm Libraries<br />PopUp<br />PopUp Management <br /> Abstract PopUpManager<br /><popup:PopUpWrapper id="popup1" open="{model.popUpHandler.showStadium}" ><br /> <mx:TitleWindow width="450" height="400" title="{model.selectedStadium.team}" layout="absolute" ><br /> <esri:Map id="stadiumMap" verticalCenter="0" horizontalCenter="0"<br />mapClick="trace(model.selectedExtent);trace(stadiumMap.extent)"<br /> width="400“ height="300"><br /> </esri:Map><br /> <mx:Button bottom="10" left="10"<br /> label="Close"<br /> click=“dispatchEvent( new Event( Event.CLOSE ) )"/><br /> </mx:TitleWindow><br /> <popup:behaviors><br /> <mx:Array><br /> <popup:AddPopUpToParsleyContext context="{ context }"/><br /> </mx:Array><br /> </popup:behaviors><br /> </popup:PopUpWrapper><br />
    17. 17. Base Camp: Cairngorm Libraries<br />Module<br /> Modular Applications*<br />Task<br /> Sequence Commands<br /> Parallel Commands<br />*Duh<br />
    18. 18. Base Camp: Parsley & SpiceLib<br />Parsley<br /> Dependency Injection<br /> Messaging<br /> Task Framework<br />SpiceLib<br />Submodule of Parsely<br /> Reflection<br /> Task Framework<br />
    19. 19. Pragmatica Need<br />The Cairngorms are the last place on earth where the NFL hasn’t played a football game. The leaders of Pragmatica want to lure the NFL to Scotland and need a way to select the different stadiums and learn about these “football” teams.*<br />User Story<br /> As a Pragmatica Leader, I want to select specific NFL Stadiums so I can see what makes a good stadium. *<br />*worst contrived presentation demo story ever<br />
    20. 20. The Foot of the Summit<br />Data<br /> Base Map<br /> NFL Stadiums (via GeoCommons)<br />Special Instructions<br /> Compiler setting for ASMock/FlexUnit4 runner<br /> Create “test” folder for our unit tests<br />
    21. 21. The Foot of the Summit<br />Source Structure<br /> Broken into Functional Areas<br /> Separate test folder<br />
    22. 22. First Belay: Write a Test<br />FlexUnit4 Setup<br /> Test Suite (Scaling Tests) <br />TestRunner Application<br />User Story<br /> As a Pragmatica Leader, I want to select specific NFL Stadiums so I can see what makes a good stadium. <br />Map Test<br /> User draws a polygon<br /> Map fires event (SelectStadiumsEvent)<br />
    23. 23. First Belay: Under Test<br />Cairngorm<br />Messaging<br />event<br />View => PM<br />
    24. 24. First Belay: Under Test<br />
    25. 25.
    26. 26. Second Belay: Write a Test<br />Command Test<br /> Should call a service<br /> Should update model with results<br />Application Layer<br /> Shields view from Infrastructure<br /> Changes Model<br />Drives the Model<br /> Stadium<br /> Stadiums<br />
    27. 27. Second Belay: Under Test<br />Cairngorm<br />Messaging<br />Infrastructure<br />Command<br />invokes<br />returns<br />updates<br />Model<br />
    28. 28. Second Belay: Under Test<br />
    29. 29.
    30. 30.
    31. 31. Third Belay: Hook Up the View<br />Guidelines<br /> Only knows about PM <br /> Use Flex data binding<br />
    32. 32. Third Belay: Hook Up the View<br />
    33. 33. Fourth Belay: Configure IoC<br />Views<br />addedToStage<br />PMs<br />ManagedEvents<br />Parsley IoC<br /> Create a Context<br /> Add Presentation Models<br /> Add Business Objects<br /> Add Commands<br /> Add Services<br />
    34. 34. Fourth Belay: Configure IoC<br />
    35. 35. Fourth Belay: Configure IoC<br />
    36. 36. Race to the Summit<br />Pragmatica<br />Rinse, Lather, Repeat<br /> Write Tests<br /> Write Code to Satisfy Tests<br /> Hook up Views<br /> Configure IoC<br />Some Other Examples<br /> Stadium Map<br /> Show PopUp<br />
    37. 37.
    38. 38.
    39. 39.
    40. 40. Back at Base Camp<br />Presentation on SlideShare<br />http://slideshare.net/ruprict/scaling-caringorms<br />Source Code on GitHub<br />http://github.com/ruprict/scaling-cairngorm-ags<br />Links to all libraries<br />Contact Me<br />ggoodrich@enspiria.com<br />@ruprictGeek<br />
    41. 41. Questions<br />Thanks for coming!<br />Post Climb Refreshments<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×