<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -17,6 +17,10 @@ package com.insideria.twitteria.business {
 		
 		private var useDummyData:Boolean = true;
 		
+		/**
+		 * The Delegate's responsibility is to encapsulate the services to isolate the
+		 * application from changes to the services
+		 */
 		public function TwitterDelegate(responder:IResponder) {
 			trace(&quot;creating TwitterDelegate with useDummyData: &quot; + useDummyData);
 			this.responder = responder;</diff>
      <filename>cairngorm/src/com/insideria/twitteria/business/TwitterDelegate.as</filename>
    </modified>
    <modified>
      <diff>@@ -13,16 +13,28 @@ package com.insideria.twitteria.command {
 		
 		private var model:TwitteRIAModel = TwitteRIAModel.getInstance();
 		
+		/**
+		 * execute is where the main responsibilities of the command 
+		 * are executed.
+		 */		
 		public function execute(event:CairngormEvent):void {
 			var evt:SetStatusEvent = event as SetStatusEvent;
 			var delegate:TwitterDelegate = new TwitterDelegate(this);
 			delegate.setStatus(evt.statusText);
 		}
 		
+		/**
+		 * This command is a responder, so when a service call is done
+		 * it will call result
+		 */		
 		public function result(result:Object):void {
 			new LoadTimelineEvent().dispatch();
 		}
 		
+		/**
+		 * This command is a responder, so when a service call fails
+		 * it will call fault
+		 */		
 		public function fault(fault:Object):void {
 			
 		}</diff>
      <filename>cairngorm/src/com/insideria/twitteria/command/SetStatusCommand.as</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,9 @@ package com.insideria.twitteria.controller {
 			initialize();
 		}
 		
+		// The Front Controller's responsibility is to match CairngormEvents to 
+		// CairngormCommands. To make that work, you associate them in your implementation
+		// of the controller, like here
 		private function initialize():void {
 			addCommand(LogInEvent.LogIn_Event, LogInCommand);
 			addCommand(LoadTimelineEvent.LoadTimeline_Event, LoadTimelineCommand);</diff>
      <filename>cairngorm/src/com/insideria/twitteria/controller/TwitteRIAController.as</filename>
    </modified>
    <modified>
      <diff>@@ -15,21 +15,27 @@ package com.insideria.twitteria.model {
 		 */		
 		public static const LOGIN_VIEW:int	= 0;
 		public static const MAIN_VIEW:int	= 1;
+		
 		[Bindable]
 		public var mainViewIndex:int		= LOGIN_VIEW;
 		
 		public var username:String;
 		public var password:String;
 		
+		// In this case, although not a best-practice, we store the 
+		// domain data and view state data in the same model.
 		[Bindable]
 		public var currentTweets:ArrayCollection; // &lt;TwitterStatus&gt;
 
+		// Since we can't have private constructors in AS3, we hack together a solution
 		public function TwitteRIAModel(access:Private) {
 			if (access == null) {
 				throw new CairngormError(CairngormMessageCodes.SINGLETON_EXCEPTION, &quot;XCLModelLocator&quot;);
 			}
 		}
 		
+		// The model needs to be accessed through a static accessor method
+		// following the singleton pattern
 		public static function getInstance():TwitteRIAModel {
 			if (instance == null) {
 				instance = new TwitteRIAModel(new Private());</diff>
      <filename>cairngorm/src/com/insideria/twitteria/model/TwitteRIAModel.as</filename>
    </modified>
    <modified>
      <diff>@@ -12,10 +12,12 @@
 		private var model:TwitteRIAModel = TwitteRIAModel.getInstance();
 		
 		private function init():void {
+			// Dispatches the LoadTimelineEvent, which corresponds to the LoadTimelineCommand
 			new LoadTimelineEvent().dispatch();
 		}
 		
 		private function setStatus():void {
+			// Dispatches the SetStatusEvent, which corresponds to the SetStatusCommand
 			new SetStatusEvent(statusText.text).dispatch();
 			statusText.clear();
 		}
@@ -29,8 +31,9 @@
 		height=&quot;100%&quot;
 		styleName=&quot;statusList&quot;
 		itemRenderer=&quot;com.insideria.twitteria.view.itemRenderers.TwitterStatusRenderer&quot;
-		dataProvider=&quot;{model.currentTweets}&quot;
-	/&gt;
+		dataProvider=&quot;{model.currentTweets}&quot; 
+	/&gt;&lt;!-- The data provider is bound to the model ^^ --&gt;
+	
 	&lt;mx:HBox width=&quot;100%&quot; styleName=&quot;instructions&quot;&gt;
 		&lt;mx:Label text=&quot;What are you doing?&quot; /&gt;
 		&lt;mx:Spacer width=&quot;100%&quot; /&gt;</diff>
      <filename>cairngorm/src/com/insideria/twitteria/view/MainView.mxml</filename>
    </modified>
    <modified>
      <diff>@@ -7,11 +7,15 @@
 	&lt;![CDATA[
 		import com.insideria.twitteria.model.TwitteRIAModel;
 		
+		
+		// We get a reference to the model through the Model Locator
+		// which is a singleton
 		[Bindable]
 		private var model:TwitteRIAModel = TwitteRIAModel.getInstance();
 	]]&gt;
 	&lt;/mx:Script&gt;
 	
+	&lt;!-- The Front Controller needs to be instantiated at the application level --&gt;
 	&lt;controller:TwitteRIAController id=&quot;controller&quot; /&gt;
 	
 	&lt;mx:DropShadowFilter id=&quot;twitteShadow&quot; inner=&quot;true&quot; distance=&quot;1&quot; blurX=&quot;2&quot; blurY=&quot;2&quot; /&gt;
@@ -20,6 +24,10 @@
 	&lt;mx:Label id=&quot;titleTwitteLabel&quot; styleName=&quot;twitTitle&quot; filters=&quot;{[twitteShadow]}&quot; text=&quot;Twitte&quot; /&gt;
 	&lt;mx:Label id=&quot;titleRIALabel&quot; styleName=&quot;riaTitle&quot; left=&quot;71&quot; top=&quot;4&quot; filters=&quot;{[riaShadow]}&quot; text=&quot;RIA&quot; /&gt;
 	&lt;mx:Label id=&quot;poweredLabel&quot; styleName=&quot;poweredBy&quot; right=&quot;0&quot; top=&quot;15&quot; filters=&quot;{[riaShadow]}&quot; text=&quot;powered by Cairngorm&quot; /&gt;
+	
+	&lt;!-- This is typical Cairngorm - binding something in the view to the model to change state when the model changes
+		Here the view stack's selected index is bound to a variable that can be thought of as holding the state of the main view 
+		which can be either the login or main state --&gt;
 	&lt;mx:ViewStack bottom=&quot;0&quot; left=&quot;0&quot; right=&quot;0&quot; top=&quot;30&quot; selectedIndex=&quot;{model.mainViewIndex}&quot;&gt;
 		&lt;view:LoginView id=&quot;loginView&quot; /&gt;
 		&lt;view:MainView id=&quot;mainView&quot; /&gt;</diff>
      <filename>cairngorm/src/twitteria_cairngorm.mxml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7b36b8a76ff1a7a330db1b7fde6ff2b1d1e80f6c</id>
    </parent>
  </parents>
  <author>
    <name>Tony Hillerson</name>
    <email>tony.hillerson@effectiveui.com</email>
  </author>
  <url>http://github.com/thillerson/twitteria/commit/2c3b4e018f1589440be690d4dc2e5484fcb0d131</url>
  <id>2c3b4e018f1589440be690d4dc2e5484fcb0d131</id>
  <committed-date>2009-01-30T17:50:52-08:00</committed-date>
  <authored-date>2009-01-30T17:50:52-08:00</authored-date>
  <message>documented some of the key Cairngorm points</message>
  <tree>4a450fa0a023d2a687f97aead7ba1d4d9d3b7941</tree>
  <committer>
    <name>Tony Hillerson</name>
    <email>tony.hillerson@effectiveui.com</email>
  </committer>
</commit>
