<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kiichigo</title>
	<atom:link href="http://kiichigo.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://kiichigo.eu</link>
	<description>Rich Internet and Agent Oriented Consulting with Raspberry Flavor</description>
	<lastBuildDate>Sun, 27 Feb 2011 11:37:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Route Framework: Routes</title>
		<link>http://kiichigo.eu/route-framework/route-framework-routes/</link>
		<comments>http://kiichigo.eu/route-framework/route-framework-routes/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 13:58:53 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Route Framework]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[route-framework]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=355</guid>
		<description><![CDATA[Summary Before we start, I want to point out, that this article covers low-level API of Route Framework. In most case you don&#8217;t want to worry about low-level, unless you building your own framework on top or with Route Framework Center of Route Framework are IRoute and it&#8217;s implementor Route hence the name of the [...]]]></description>
			<content:encoded><![CDATA[<h3>Summary</h3>
<p>Before we start, I want to point out, that this article covers low-level API of Route Framework. In most case you don&#8217;t want to worry about low-level, unless you building your own framework on top or with Route Framework</p>
<p>Center of Route Framework are <code>IRoute</code> and it&#8217;s implementor <code>Route</code> hence the name of the framework. Route sort of inspired by Agent Oriented<sup><a href="#1">1</a></sup> approach minus concurrency and proactivity and EventHandlers from Mate Framework<sup><a href="#2">2</a></sup>. Generally it consists of three types of instances: <code>ISensor</code>, <code>IPattern</code> and <code>IAction</code>.<a href="http://kiichigo.eu/wp-content/uploads/2011/02/RF-Percept-Flow.png"><img src="http://kiichigo.eu/wp-content/uploads/2011/02/RF-Percept-Flow.png" alt="" title="RF-Percept-Flow" width="680" height="481" class="alignleft size-full wp-image-361" /></a><br />
Simply put:</p>
<ul>
<li>Sensor get&#8217;s messages from Environment, which uses some way to send and receive messages, whether it&#8217;s <code>flash.events.Event</code> or some custom solution.</li>
<li>After sensor received message, it parses it if needed and passes it&#8217;s to <code>IRoute.perceive( percept:Object );</code> method. In future we&#8217;ll call &#8220;sensed&#8221; message &#8211; percept.</li>
<li><code>IRoute</code> will match percept against <code>IPattern</code></li>
<li>If successful Route will then execute it&#8217;s <code>IAction</code></li>
</ul>
<p>.<br />
This allows <code>IRoute</code> to be very agile Inversion of Control<sup>3</sup> container. Each part of a framwork is simple enough system that can be easily modified.</p>
<h3>Percept</h3>
<p>Plainly speaking percept can be anything: Object, String, Event or any kind of instance. Whatever Sensor retrieves from Application and passes to Route considered to be Percept. Percept will then be matched against Patterns and passed along to Actions assigned to current Route.</p>
<h3>Sensor</h3>
<p>In lamen terms Sensor is an Event Listener or an instance of Observer. It simply receives messages from Application/Environment. Of course Sensors can be internal too. For example there could be a Sensor that listens to internal messages of other Routes, but that&#8217;s more rare case.</p>
<h3>Pattern</h3>
<p>Plainly put, Patterns used by Route to see if Actions will be executed. For example Handle Route:</p>
<pre class="brush:as3">route( Handle, { event: SampleEvent.BIND_PLEASE, generator: SampleEvent } ).</pre>
<pre class="brush:xml">&lt;route:Handle event="{SampleEvent.BIND_PLEASE}" generator="{SampleEvent}"/&gt;</pre>
<p>Uses two patterns, to filter by <code>Event.type</code> and actual <code>Class</code> of Event.</p>
<h3>Actions</h3>
<p>Actions are variation on Command Design Pattern<sup>5</sup>. Predefined actions in package <code>eu.kiichigo.route.actions</code> cover basic Application manipulation such as: Apply/Bind/Copy data, run closure or method on class, invoke RPC operation and such. You can extend Action, AsyncAction or Actions classes in order to create custom functionality.</p>
<p>There is two major things you can do with actions: assign predicates and group actions</p>
<h3>Conclusion</h3>
<p>This covers basic logic of Route, once again, this is low-level API which most programmers should not concern themselves with.</p>
<h3>Footnotes</h3>
<p><a name="1"></a>[1] PDF: <a href="http://www.cs.unb.ca/~ulieru/Teaching/CS6705/Shoham.pdf">Shoham, “Agent-oriented Programming”</a>.<br />
<a name="2"></a>[2] <a href="http://mate.asfusion.com/">Mate Framework</a>.<br />
<a name="3"></a>[3] <a href="http://martinfowler.com/articles/injection.html">Martin Fowler about IoC</a>.<br />
<a name="4"></a>[4] <a href="http://en.wikipedia.org/wiki/Command_pattern">Command Pattern at Wikipedia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/route-framework/route-framework-routes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Route Framework: Guards and Execution Control</title>
		<link>http://kiichigo.eu/route-framework/route-framework-guards-and-conditionals/</link>
		<comments>http://kiichigo.eu/route-framework/route-framework-guards-and-conditionals/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 18:05:33 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Route Framework]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[data-bindings]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[guards]]></category>
		<category><![CDATA[MXML]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=345</guid>
		<description><![CDATA[Most instances of IAction also implement IGuarded interface, that allows programmer to control when certain actions will be executed. It acts a lot like guards from declarative languages, such as Prolog, Erlang or Scala. Essentially speaking: if IGuard.when evaluates into true IAction will be executed successfully, otherwise it won&#8217;t. Predicate for guard ( value of [...]]]></description>
			<content:encoded><![CDATA[<p>Most instances of <code>IAction</code> also implement <code>IGuarded</code> interface, that allows programmer to control when certain actions will be executed. It acts a lot like guards from declarative languages, such as Prolog, Erlang or Scala. Essentially speaking: if <code>IGuard.when</code> evaluates into <code>true</code> <code>IAction</code> will be executed successfully, otherwise it won&#8217;t.</p>
<p>Predicate for guard ( value of <code>IGuard.when</code> ) can be in a form of: <code>Boolean</code>, <code>function ():Boolean</code> or <code>function ( percept:Object ):Boolean</code>. Here is small example with fluent dsl:</p>
<pre class="brush:as3">
var router:IRouter = new Router().
	route( Handle, { event: LoginEvent.LOGIN } ).
		run( Run, { closure: Alert.show, arguments: ["Logging in "] } ).
			when( check ).
end;

protected function check( percept:LoginEvent ):Boolean
{
	if( percept.username == null || percept.username.length == 0 ||
	    percept.password == null || percept.password.length == 0 )
		return false;
	return true;
}</pre>
<p>Action <code>Run</code> will be executed only if incoming <code>LoginEvent</code> has defined username and password. Of course, you will prefer  sophisticated validation than simple length check.</p>
<p>Following example shows how to use multiple <code>IGuarded.when</code> predicates with some Functional Programming mojo:</p>
<pre class="brush:as3">var router:IRouter = new Router().
	route( Handle, { event: LoginEvent.LOGIN } ).
		run( Run, { closure: Alert.show, arguments: ["Logging in "] } ).
			when( check( "username" ) ).
			when( check( "password" ) ).
end;

/**
 * Checks if &lt;code&gt;String&lt;/code&gt; that's evaluated via &lt;code&gt;percept[property]&lt;/code&gt; is not empty and is not &lt;code&gt;null&lt;/code&gt;.
 *
 * @param	property	&lt;code&gt;String&lt;/code&gt; name of property on &lt;code&gt;percept&lt;/code&gt; argument.
 * @param	percept		&lt;code&gt;percept&lt;/code&gt; received by &lt;code&gt;IRoute&lt;/code&gt; for testing.
 *
 * @returns	&lt;code&gt;Boolean&lt;/code&gt;. &lt;code&gt;true&lt;/code&gt; if string is not &lt;code&gt;null&lt;/code&gt; and contains at least 1 symbol, &lt;code&gt;false&lt;/code&gt;otherwise&lt;/code&gt;.
 */
protected function checkString( property:String, percept:LoginEvent ):Boolean
{
	var string:String = percept[property];
	if( string == null || string.length == 0 )
		return false;
	return true;
}

/**
 * Higher order function. Simplistic Curry function.
 */
protected function check( property:String ):Function
{
	return function( percept:LoginEvent ):Boolean
	{
		return checkString( property, percept );
	}
}</pre>
<p>I&#8217;ve used Higher Order Function, to construct actual predicates. If you have some experience working with Functional Programming, you will find this methods more elegant and logical.</p>
<p>MXML syntax also allows us to use Data Bindings in this example:</p>
<pre class="brush:xml">&lt;route:Router id="router"&gt;
	&lt;route:Handle event="{ LoginEvent.LOGIN }"&gt;
		&lt;route:Run closure="{ Alert.show }" arguments="{ ['Logging in'] }"
			   when="{ router.percept.username != null &amp;&amp; router.percept.username.length &gt; 0 &amp;&amp;
					   router.percept.password != null &amp;&amp; router.percept.password.length &gt; 0 }" /&gt;
	&lt;/route:Handle&gt;
&lt;/route:Router&gt;</pre>
<p>No additional functions are requited.</p>
<p>This is rather simple, yet very powerful mechanism of controlling execution cycle of application, without need to create special actions that will check data before execution that can be achieved by simple injection of a guard.</p>
<p><a href="http://route.kiichigo.eu/laboratory/simple/Guards.html">Example</a> and <a href="http://route.kiichigo.eu/laboratory/simple/srcview">Sources</a></p>
<p>
<h4>Futher Reading</h4>
<p><a href="http://en.wikipedia.org/wiki/Guard_(computing)">About Guards on Wikipedia.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/route-framework/route-framework-guards-and-conditionals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Route Framework: Sensors and Routing</title>
		<link>http://kiichigo.eu/route-framework/route-framework-sensors-and-routing/</link>
		<comments>http://kiichigo.eu/route-framework/route-framework-sensors-and-routing/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 20:43:07 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Route Framework]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[delegate-model]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[movie-view-controller]]></category>
		<category><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=334</guid>
		<description><![CDATA[In Model View Controller or Delegate Model architectures special place is reserved to messaging system. When it comes to ActionScript, we usually utilise one of three solutions: flash.events.Event/flash.events.IEventDispatcher. custom Observer implementation. AS3 Signals by Robert Penner. Usually Application Framework comes tightly coupled with some or another messaging library. It might work in many cases, but [...]]]></description>
			<content:encoded><![CDATA[<p>In Model View Controller or Delegate Model architectures special place is reserved to messaging system. When it comes to ActionScript, we usually utilise one of three solutions:<br />
flash.events.Event/flash.events.IEventDispatcher.<br />
custom Observer implementation.<br />
AS3 Signals by Robert Penner.</p>
<p>Usually Application Framework comes tightly coupled with some or another messaging library. It might work in many cases, but sometimes it might be a serious bottleneck*. Route Framework can switch messaging systems easily by subclassing just 2 classes: Sensor, that will receive messages, and Route to wrap sensor and pattern in it.</p>
<p>Let&#8217;s consider following example with custom Observer Implementation:<br />
IMessage.as</p>
<pre class="brush:as3">package observer
{
	public interface IMessage
	{
		/**
		 * <code>IMessage</code> name, can be used for additional filtering.
		 */
		function get name():String;
		/**
		 * @private
		 */
		function set name( value:String ):void;

		/**
		 * Any data that can be sent with <code>IMessage</code>
		 */
		function get data():Object;
		/**
		 * @private
		 */
		function set data( value:Object ):void;
	}
}</pre>
<p>IObserver.as</p>
<pre class="brush:as3">package observer
{
	public interface IObserver
	{
		/**
		 * Invoked automatically by instance of <code>IObservable</code>. Should contain any update logic.
		 *
		 * @param message		<code>IMessage</code> sent by <code>IObservable</code>
		 */
		function update( message:IMessage ):void;
	}
}</pre>
<p>IObservable.as</p>
<pre class="brush:as3">package observer
{
	public interface IObservable
	{
		/**
		 * Adds an instance of <code>IObserver</code> to notify queue.
		 *
		 * @param observer		<code>IObserver</code> to be added.
		 */
		function add( observer:IObserver ):void;

		/**
		 * Use this methods, to notify all instances of <code>IObserver</code> added to current <code>IObservable</code>.
		 *
		 * @param message		<code>IMessage</code> to be sent.
		 */
		function notify( message:IMessage ):void;
	}
}</pre>
<p>You can check actual implementation of this interfaces in sources, but implementation does not really matter in this case.</p>
<p>In order to teach Route to accept Messages all we need is to subclass Sensor and Route as follows:</p>
<pre class="brush:as3">package observer
{
	import eu.kiichigo.route.pattern.*;
	import eu.kiichigo.route.pattern.match.type;
	import eu.kiichigo.route.routes.*;

	/**
	 * Version of <code>IRoute</code> to work with custom Observer pattern implementation.
	 * Fluent style:
	 * <code>
	 * route( Receive, { from: "idOfObserver" } );
	 * </code>
	 * MXML Syntax:
	 * <code>
	 * <ns:Receive from="idOfObserver" />
	 * </code>
	 *
	 * @author David "nirth" Sergey
	 *
	 */
	public class Receive extends Route implements IRoute
	{
		public function Receive()
		{
			super();

			// Setup pattern to filter out messages of correct type.
			var p:IPattern = new Pattern;
				p.matcher = type;
				p.store( "type", IMessage );
			// Inject pattern.
			pattern = p;
			// Inject Sensor.
			sensor = new ObserverSensor;
		}

		// Receive.from is simple proxy get-set accesor
		/**
		 * @copy		ObserverSensor#from
		 */
		public function get from():Object
		{
			return ( sensor as ObserverSensor ).from;
		}
		/**
		 * @private
		 */
		public function set from( value:Object ):void
		{
			( sensor as ObserverSensor ).from = value;
		}
	}
}
import eu.kiichigo.route.sensors.Sensor;

import observer.IMessage;
import observer.IObserver;
import observer.Messenger;

class ObserverSensor extends Sensor implements IObserver
{
	/**
	 * @copy		observer.IObserver#update
	 */
	public function update( message:IMessage ):void
	{
		send( message );
	}

	/**
	 * @private
	 */
	protected var _from:Object;

	/**
	 * Indicates an instance of <code>IObservable</code> that this <code>ISensor</code> is listening too.
	 */
	public function get from():Object
	{
		return _from;
	}
	/**
	 * @private
	 */
	public function set from( value:Object ):void
	{
		//ToDo: Handle removal from old Messenger here.
		_from = value;
		Messenger.get( value ).add( this );
	}
}</pre>
<p>Now our class has nice readable class name and accessor name, and it&#8217;s actually reads as: &#8220;Receive from accessorId&#8221; as in example:</p>
<pre class="brush:as3">const router:IRouter = new Router().
	route( Receive, { from: "leftButtons" } ).
		action( Run, { closure: Alert.show, arguments: ["Received message from leftButtons"] } ).
	route( Receive, { from: "rightButtons" } ).
		action( Run, { closure: Alert.show, arguments: ["Received message from rightButtons"] } ).
end;</pre>
<p>Alternatively you can use MXML Syntax too:</p>
<pre class="brush:as3">&lt;route:Router&gt;
	&lt;observer:Receive from="leftButtons"&gt;
		&lt;route:Run closure="{ Alert.show }" arguments="{ ['Received message from leftButtons'] }" /&gt;
	&lt;/observer:Receive&gt;
	&lt;observer:Receive from="rightButtons"&gt;
		&lt;route:Run closure="{ Alert.show }" arguments="{ ['Received message from rightButtons'] }" /&gt;
	&lt;/observer:Receive&gt;
&lt;/route:Router&gt;
</pre>
<p><a href="http://route.kiichigo.eu/laboratory/simple/SensorObserver.html">Example</a> and <a href="http://route.kiichigo.eu/laboratory/simple/srcview">Sources</a></p>
<p>* Another framework that handles decoupling of messaging from mvc logic very nicely is <a href="http://www.spicefactory.org/parsley/" target="_blank">Parsley framework</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/route-framework/route-framework-sensors-and-routing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Route Framework: Interfacing</title>
		<link>http://kiichigo.eu/route-framework/route-framework-interfacing/</link>
		<comments>http://kiichigo.eu/route-framework/route-framework-interfacing/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 13:44:38 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Route Framework]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[delegate-model]]></category>
		<category><![CDATA[design-patterns]]></category>
		<category><![CDATA[movie-view-controller]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=324</guid>
		<description><![CDATA[[ToDo: add link to Route Framework introduction] [ToDo: add link to overview of the Route] There is 3 basic ways of working with Route Framework: ActionSctipt, ActionScript-Fluent and MXML. ActionScript: Allows you to work with Route Framework on a low level. It should be used in case you are interested in generating FrontControllers in Runtime [...]]]></description>
			<content:encoded><![CDATA[<p>[ToDo: add link to Route Framework introduction]<br />
[ToDo: add link to overview of the Route]</p>
<p>There is 3 basic ways of working with Route Framework: ActionSctipt, ActionScript-Fluent and MXML.<br />
<strong>ActionScript:</strong> Allows you to work with Route Framework on a low level. It should be used in case you are interested in generating FrontControllers in Runtime from Configuration files or Data Base settings.<br />
<strong>Fluent:</strong> This is also a way of defining Routers in ActionScript, but much less verbose, and easier to read and define. em>You can read more about fluent programming on <a href="http://www.martinfowler.com/bliki/FluentInterface.html" target="_blank">Martin Fowler&#8217;s Bliki</a>.</em><br />
<strong>MXML:</strong> This style allows programmer to define Routers in MXML.</p>
<p>Let&#8217;s get some abstract but nevertheless good example: We&#8217;ll create two TextAreas <code>original</code> and <code>copy</code> and link their values via Model which we call <code>LabModel</code>. Overral data flow can be represented as:<br />
<code>original.text → labModel.text → copy.text</code></p>
<h3>ActionScript: Low Level</h3>
<pre class="brush:as3">// Create a pattern that will match input to flash.events.Event:
var eventPattern:IPattern = new Pattern;
	eventPattern.matcher = eu.kiichigo.route.pattern.match.type;
	eventPattern.store( "type", flash.events.Event );

// Create Pattern that will match "bindPlease" string.
var bindPleasePattern:IPattern = new Pattern;
	bindPleasePattern.matcher = eu.kiichigo.route.pattern.match.values;
	bindPleasePattern.store( "type", "bindPlease" );

// This action will bind view to model
var view2model:Bind = new Bind;
	view2model.from = original;
	view2model.to = LabManager;
	view2model.text = "text";

// And this will bind model to view.
var model2view:Bind = new Bind;
	model2view.from = LabManager;
	model2view.to = copy;
	model2view.text = "text";

// Create Route that will be catching "bindPlease" events:
var routeBindPlease:IRoute = new Route;
	routeBindPlease.pattern = new Patterns( eventPattern, bindPleasePattern );
	routeBindPlease.add( view2model );
	routeBindPlease.add( model2view );
	routeBindPlease.sensor = Events;

var router:eu.kiichigo.route.kore.IRouter = new eu.kiichigo.route.kore.Router;
	router.add( routeBindPlease );</pre>
<p>Here is what happens:</p>
<ul>
<li>We define two patterns:
<ul>
<li>First will match incoming <code>percepts</code> and filter by Class: <code>percept is flash.events.Event</code></li>
<li>Second pattern checks value: <code>percept.type = "bindPlease"</code></li>
</ul>
</ul>
<li>We then create two instances of <code>Bind</code> actions and set them up.</li>
<li>We create instance of Route and inject Patterns, Actions and Events-Sensor.</li>
<li>We add Route to Router.</code>
</p>
<h3>Fluent and MXML</h3>
<p>Following two examples show how same logic can be defined in Fluent and MXML DSLs:</p>
<pre class="brush:as3">var router:IRouter = new Router().
	route( Handle, { event: "bindPlease" } ).
		action( Bind, { from: original, to: LabManager, text: "text" } ).
		action( Bind, { from: LabManager, to: copy, text: "text" } ).
end;</pre>
<pre class="brush:xml">&lt;route:Router&gt;
	&lt;route:Handle event="{ 'bindPlease' }"&gt;
		&lt;route:Bind from="{ original }" to="{ LabManager }" text="text" /&gt;
		&lt;route:Bind from="{ LabManager }" to="{ copy }" text="text" /&gt;
	&lt;/route:Handle&gt;
&lt;/route:Router&gt;</pre>
<p>I want to stress attention on <code>Handle</code>. <code>Handle</code> is one of the pre-defined types of <code>Route</code> that handles percepts of <code>flash.events.Event</code>. There is other Route types available:<br />
<code>ValueObject:</code> Will perceive and process data from RPC services.<br />
<code>Inject:</code> Will perceive and process created by Router instances, or added DisplayObjects to DisplayList.<br />
Programmer can also create own Routes and Sensors to work with other ways of messaging, such as custom implementation of Observer or Delegating Event Model design patterns.</p>
<p><a href="http://route.kiichigo.eu/laboratory/simple/Interfacing.html">Example</a> and <a href="http://route.kiichigo.eu/laboratory/simple/srcview">Sources</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/route-framework/route-framework-interfacing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consulting and Documents</title>
		<link>http://kiichigo.eu/consulting/reporting-to-client/</link>
		<comments>http://kiichigo.eu/consulting/reporting-to-client/#comments</comments>
		<pubDate>Sun, 26 Dec 2010 12:16:26 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Consulting]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=278</guid>
		<description><![CDATA[While I write it from consultant perspective, I guess it&#8217;s quite good practice for any semi-executive position in research and development department in software company. The idea is – your client have to know what you doing. That&#8217;s good ethics and actually quite useful for self management. General Rules Company might use internal jabber service [...]]]></description>
			<content:encoded><![CDATA[<p>While I write it from consultant perspective, I guess it&#8217;s quite good practice for any semi-executive position in research and development department in software company. The idea is – your client have to know what you doing. That&#8217;s good ethics and actually quite useful for self management.</p>
<h3>General Rules</h3>
<p>Company might use internal jabber service or even some exotic IM protocol, voip, bug tracker or any other means of talking to each other. That&#8217;s all good, and consultant should use them. But never forget about good old E-Mail. Try to send anything important to your-self for future reference. And copy status updates and white papers to the clients mail box.</p>
<p>There is multiple reasons for that, one of them, starting from: you might have dozen of clients, and everybody use different protocol, it&#8217;s nice to know that you won&#8217;t accidentally forget to send somebody a note or update.</p>
<h3>Status Updates</h3>
<p>Make this regular, I would not recommend sending them more than once a day. But daily is good. If you lazy you can try bi-daily or weekly, consider weekly status updates to be an absolute limit. Daily is actually not that bad, and will take only 5-10 minutes or your (paid by a client) time.</p>
<p>Always [blind] carbon copy yourself (cc/bcc), and it&#8217;s nice to have an imap mail server, where you can have different folders per status updates for each client. If you are not a modest type like me &#8211; you might consider compiling huge update in a PDF from all those small emails you were writing for weeks or months to a client &#8211; to remind him of enormous work you&#8217;ve done <em>wink</em>.</p>
<h3>White Papers</h3>
<p>It&#8217;s nice to write a white paper for libraries, frameworks and utilities you develop. While documentation in code will be most likely seen and understood only by programmers in your current department. Whitepapers should be a good reference point for people from any other department: UI, GUI, Back-end, Front-End, QA and such. If you are involved in Rich Internet Application / Web 2.0 development it&#8217;s really useful to supply Web Designers, UI, GUI and Web Security people with some reference on code, so that they know what to expect.</p>
<p>If a library or framework you&#8217;ve developed is particularly huge (150 or more classes for Flex Project for example) – it&#8217;s nice to provide your fellow developers with some kind of reference on Facade points of your library too, while they can get documentation, it&#8217;s not always clear where to start reading documentation.</p>
<p>And don&#8217;t forget to include whitepaper writing to the status updates <em>wink</em>.</p>
<h3>Client Specific</h3>
<p>As I stated before – each company might have some specific ways of communication. While some of them are exotic and hard to guess. JIRA, Redmine, Mantis, Confluence, SIP and BaseCamp. While it&#8217;s quite useless to guess what client&#8217;s company might use – it&#8217;s nice to install bunch of different IMs from old ICQ to new Skype and open source Jabber, and learn some wikisyntax. Also If you are going to work for scientific/research companies and there is lot&#8217;s of interesting job in that sector – LaTEX is quite useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/consulting/reporting-to-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIY QA or What to do when QA Engineer left company</title>
		<link>http://kiichigo.eu/consulting/diyqa/</link>
		<comments>http://kiichigo.eu/consulting/diyqa/#comments</comments>
		<pubDate>Sun, 26 Dec 2010 11:34:00 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Consulting]]></category>
		<category><![CDATA[consulting]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technics]]></category>

		<guid isPermaLink="false">http://kiichigo.eu/?p=270</guid>
		<description><![CDATA[That&#8217;s not professional QA technic, but in my experience it&#8217;s a best one for team that does not have dedicated QA engineer for some reason. If you working in young Start Up company, or huge company in pre-Christmas season, you might experience lack of QA engineers. Personally I consider QA-people to be second most important [...]]]></description>
			<content:encoded><![CDATA[<p><em>That&#8217;s not professional QA technic, but in my experience it&#8217;s a best one for team that does not have dedicated QA engineer for some reason.</em></p>
<p>If you working in young Start Up company, or huge company in pre-Christmas season, you might experience lack of QA engineers. Personally I consider QA-people to be second most important engineers in Software Development. While programmers can find critical bugs and develop software on their on. It&#8217;s quite hard to find all those small glitches, and small bugs. But it&#8217;s very easy to miss them, and build rather smelly foundations.</p>
<p>Usually this bugs are quite easy to fix, but occasionally you can accidentally base important bits of architecture on buggy library. So, I want to share a simple QA technic that can be exploited in almost any company/group. I will use Twitter and WordPress as a simple enough examples.</p>
<p><em>I want to make a point here: all this sounds very-very easy. But you should not rely on your memory. Tests should be done step by step, and it&#8217;s good to have a actual document, and not just oral contract with other people.</em></p>
<h3>Brainstorm use-cases</h3>
<p>Get all possible use-cases that matter at this point. It might be good idea to write use-cases that does not matter too, for future. Use cases can be devided by &#8220;start position&#8221; In case of twitter we might have 3 start position:</p>
<ul>
<li><strong>Full Stop</strong>: Logout, Quit Browser, Clear Cache and open Twitter site</li>
<li><strong>Main</strong>: Simply go to main page, without relogging.</li>
<li><strong>Refresh</strong>: Simply refresh current page.</li>
<li><strong>Continue</strong>: Just continue from any position.</li>
</ul>
<p>It&#8217;s important to note, that some operations might and have to work only once per session (like popups, announcements, settings storing and such), while other features should work from any point.</p>
<h3>Outline each use-case</h3>
<p>Each use case should be outlined, with every action that user should do. Then list expected behaviour under each action, in case of a WordPress blog commenting it might look like this:</p>
<p>
<ul>
<li><strong>[Full Stop]</strong><br/>
<li>
<li>Open main page &#8211; http://kiichigo.eu
<li>
<ul>
<li><em>Page loads</em>
<li>
<li><em>Posts rendered, and sorted by date.</em>
<li>
<li><em>Sidebar displayed.</em>
<li></ul>
<li>Click on any post title.
<li>
<ul>
<li><em>Individual Post loaded.</em>
<li>
<li><em>Comment text-field is available</em>
<li></ul>
<li>Write some text.
<li>
<ul>
<li><em>Spell check is engaged.</em>
<li>
<li><em>Post button becomes active</em>
<li></ul>
<li>Post Comment
<li>
<ul>
<li>…and so on.</p>
<li></ul>
</ul>
<p>Yes it looks excessive, but it&#8217;s not. Trust me if you are in Agile or Game Development environment, and this days it seems like it&#8217;s either one or the other – you will be testing same application and same use cases over and over again. If R&#8217;n'D is fast &#8211; even multiple times a day. Unless you some kind of Savant – you will most probably forget small details here and there.</p>
<h3>Print it</h3>
<p>My last advice &#8211; is to print it, many copies of it actually, and then tick off each step as you go. That&#8217;s faster than command-tab/alt-tab every time you want to check next step, and easier to compare.</p>
<h3>Conclusion</h3>
<p>In my experience, QA is responsible for Deadlines. Good team of programmers can write code pretty fast. But QA can specify functional (requested by client) and non-funcitonal (security and such) features that should be implemented. If QA is unavailable it&#8217;s nice to know that software will be stable anyways.</p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/consulting/diyqa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>λ-Calculus</title>
		<link>http://kiichigo.eu/computer-science/lambda-calculus/</link>
		<comments>http://kiichigo.eu/computer-science/lambda-calculus/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 20:10:49 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[λ calculus]]></category>

		<guid isPermaLink="false">http://blog.kiichigo.eu/?p=252</guid>
		<description><![CDATA[I decided that&#8217;s it time to learn λ-calculus. I started it as writing simple Scheme REPL which could evaluate simple expressions as: var code:Array = ["+", ["*", 1, 2, 3], ["-", 4, 2]]; var result:Number = new Scheme().read( code ); trace( result ); // 8 And that worked sort of fine, but I needed system [...]]]></description>
			<content:encoded><![CDATA[<p>I decided that&#8217;s it time to learn λ-calculus. I started it as writing simple Scheme REPL which could evaluate simple expressions as:</p>
<pre class="brush:as3">var code:Array =
["+", ["*", 1, 2, 3], ["-", 4, 2]];

var result:Number = new Scheme().read( code );
trace( result ); // 8</pre>
<p>And that worked sort of fine, but I needed system to do something more complex. To be honest I never actually new mechanics of λ-calculus intimately, so, I decided to learn it. I found some papers[1][2][3] and started to code:</p>
<pre class="brush:as3">// Identity x.x
var identity:Function = function( x:* ):* { return x; };

// Succ nfx.f ( n f x )
var succ:Function = function( n:* ):* { return function( f:* ):* { return function( x:* ):* {
	return f( n( f )( x ) ); } } };

// Plus mnfx.m f (n f x)
var plus:Function = function( m:* ):* { return function( n:* ):* { return function( f:* ):* { return function( x:* ):* {
	return m( f )( n( f )( x ) ) } } } };

// Church-Booleans, since true and false are reserved yes and no used instead. wink prolog
var yes:Function = function( x:* ):* { return function( y:* ):* { return x; }; };
var no:Function = function( x:* ):* { return function( y:* ):* { return y; }; };

// Numbers
var zero:Function = no; //Zero is alpha equivalent to false (no).
var one:Function   = succ( zero );
var two:Function   = succ( one );
var three:Function = succ( two );
var four:Function  = plus( two )( two );
var five:Function  = plus( three )( two );
trace( [one, two, three, four, five].map( function( functor:Function, index:int, array:Array ):int {
	return ( functor( function( n:* ):* { return n + 1} )( 0 ) );
} ) ); // 1, 2, 3, 4, 5</pre>
<p>Project lacks abstraction at this point, I&#8217;ll have to work on that, and learn some stuff about lexical parsing and tokenization before I can actually handle writing Scheme REPL.</p>
<p>[1]http://www.inf.fu-berlin.de/lehre/WS03/alpi/lambda.pdf<br />
[2]http://www.cs.bham.ac.uk/~axj/pub/papers/lambda-calculus.pdf<br />
[3]<a href="http://dkeenan.com/Lambda/">To Dissect a Mockingbird: A Graphical Notation for the Lambda Calculus with Animated Reduction</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/computer-science/lambda-calculus/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Functional approach to working with Arrays in ActionScript</title>
		<link>http://kiichigo.eu/uncategorized/functional-approach-to-working-with-arrays-in-actionscript/</link>
		<comments>http://kiichigo.eu/uncategorized/functional-approach-to-working-with-arrays-in-actionscript/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 15:13:00 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[functional programming]]></category>

		<guid isPermaLink="false">http://blog.kiichigo.eu/?p=244</guid>
		<description><![CDATA[Actually I&#8217;ll be working with Vector but since I&#8217;m passing theoretical knowledge – that won&#8217;t be a problem. Say we want to play my favorite game: Fizz-Buzz[1], first I&#8217;ll create two helper methods that will do most list creation and number checking, to remove details from our way: /** * Utility factory method, creates simple [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I&#8217;ll be working with <code>Vector</code> but since I&#8217;m passing theoretical knowledge – that won&#8217;t be a problem.<br />
Say we want to play my favorite game: Fizz-Buzz[1], first I&#8217;ll create two helper methods that will do most list creation and number checking, to remove details from our way:</p>
<pre class="brush:as3">/**
 * Utility factory method, creates simple ranges of numbers.
 * @param from	Initial number.
 * @param to	Target number
 * @return 		<code>Vector.<int></code> of number in range <code>from</code> and <code>to</code>.
 */
protected function range(from:int, to:int):Vector.<int>
{
	var result:Vector.<int> = new Vector.<int>;
	var current:int = from;

	while(current != to)
		if(from < to)
			result.push(current++);
		else
			result.push(current--);

	result.fixed = true;
	return result;
}
/**
 * Simple helper method, emulates "Fizz-Buzz" game, returns "Fizz" if number dividable by 3, "Buzz" if by 5, and "Fizz-Buzz" if by both.
 * @param number	Number to check.
 * @return 			"Fizz" if number is dividable by 3, "Buzz" if by 5, and "Fizz-Buzz" if by both.
 */
		protected function fizzBuzz(number:int):String
		{
			if(number % 3 == 0 &#038;&#038; number % 5 == 0)
				return "Fizz-Buzz";
			else if(number % 3 == 0)
				return "Fizz";
			else if(number % 5 == 0)
				return "Buzz";
			else
				return "";
		}</pre>
<p>First method as you already guessed simply creates ranges of number, while second checks individual number on it's fizz-buzz-ines. Structural approach would be to create a loop:</p>
<pre class="brush:as3">protected function structural():void
{
	for each(var number:int in range(1, 101))
		trace(fizzBuzz(number));
}</pre>
<p>No surprise here I guess, using <code>for</code> instead of <code>for each</code> could be smarter but I was going for shortness here. But there is a functional approach too:</p>
<pre class="brush:as3">protected function test():void
{
	range(1, 101).forEach(loop);
}
/**
 * Used as a callback in <code>Array.forEach</code> or <code>Vector.forEach</code> methods.
 * @param element	Current element.
 * @param index		Current index.
 * @param vec		Reference to the Vector.
 */
protected function loog(element:int, index:int, vec:Vector.<int>):void
{
	trace("[" + index + "] " + fizzBuzz(element));
}</pre>
<p>This approach does not look short*, but it gives us some flexibility because we've just reached new level of abstraction and went beyond Object Oriented. Here is better example:</p>
<pre class="brush:as3">/**
 * Higher order function that creates a loop closure.
 * @param output	Reference to the desired output method, such as "trace".
 * @return 			Function with selected output method.
 *
 */
protected function looper(output:Function):Function
{
	return function(element:int, index:int, vec:Vector.<int>):void
	{
		output("[" + index + "] " + fizzBuzz(element));
	}
}</pre>
<p>Method <code>looper</code> is a Higher Order Function (hof) instead of doing anything - it creates and returns another function, we also pass closure/function as argument, this gives us ability to change way we want to output information, we can easily switch between <code>trace</code>, <code>ILogger.log</code> or any custom debug method <code>myDebugger.debug</code>, and we can do it fluently:</p>
<pre class="brush:as3">
range(1, 101).forEach(looper(trace)); //using trace()
range(1, 101).forEach(looper(myLogger.log)); //using Flex Logger
range(1, 101).forEach(looper(console)); //my custom debug method that traces items to Firebug Console</pre>
<p>No ActionScript IDE support functional approach to programming, so I wouldn't recommend heavy use of fp, but there is places where FP (Functional Programming) can be very helpful, such as Game AIs, which might need to easily discard unworking tactics and try new ones, without storing whole classes/modules of tactics and plans in memory. I also found that it's quite usable to use FP in small utility and helper functions, just make sure that your team understands what it is.</p>
<p>* At least it does not look that short in ActionScript, but you might be surprised by it's elegance in languages like Ruby, Scala, Erlang and Haskell.</p>
<p>[1] <a href="http://www.codinghorror.com/blog/2007/02/fizzbuzz-the-programmers-stairway-to-heaven.html">Coding Horror: FizzBuzz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/uncategorized/functional-approach-to-working-with-arrays-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Erlang: Minimalistic Agent Oriented Library</title>
		<link>http://kiichigo.eu/artificial-intelligence/learning-erlang-primitive-agent-oriented-library/</link>
		<comments>http://kiichigo.eu/artificial-intelligence/learning-erlang-primitive-agent-oriented-library/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 21:51:45 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[agent oriented]]></category>
		<category><![CDATA[ai]]></category>
		<category><![CDATA[erlang]]></category>

		<guid isPermaLink="false">http://blog.kiichigo.eu/?p=232</guid>
		<description><![CDATA[So, I was experimenting with Erlang this week for some more, and decided to start writing simplistic agent oriented[1] library for Erlang. My guess is that Erlang should do just fine, the only concern is – I have no idea how to implement logical reasoning right now, but that&#8217;s fixable with research. Right now it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>So, I was experimenting with Erlang this week for some more, and decided to start writing simplistic agent oriented[1] library for Erlang. My guess is that Erlang should do just fine, the only concern is – I have no idea how to implement logical reasoning right now, but that&#8217;s fixable with research.</p>
<p>Right now it&#8217;s not much of a framework, but a draft/template. Don&#8217;t get your hopes up just yet: <a href="http://github.com/nirth/kiichigo-communique">kiichigo-communique@github</a></p>
<pre class="brush:erlang">4> mas:start(main_environment).
true
5> main_environment ! {create, agent_smith}.
{create,agent_smith}
6> main_environment ! {create, neo}.
{create,neo}
7> agent:talk(neo, agent_smith, "Boo Hoo").</pre>
<p>[1] <a href="http://www.cs.unb.ca/~ulieru/Teaching/CS6705/Shoham.pdf">Agent Oriented</a>,<a href="http://arxiv.org/abs/1008.1328">Semantic Oriented Agent based Approach towards Engineering Data Management, Web Information Retrieval and User System Communication Problems</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/artificial-intelligence/learning-erlang-primitive-agent-oriented-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logical predicates in Declarative MVC</title>
		<link>http://kiichigo.eu/artificial-intelligence/ai-gui/</link>
		<comments>http://kiichigo.eu/artificial-intelligence/ai-gui/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 09:10:56 +0000</pubDate>
		<dc:creator>nirth</dc:creator>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[gui]]></category>

		<guid isPermaLink="false">http://blog.kiichigo.eu/?p=221</guid>
		<description><![CDATA[Not long ago, I&#8217;ve started to develop Mate-like Event-Driven MVC+S framework. At the same time I was improving my AI skills with Scala, AgentSpeak(L) and Agent0. While I was developing FrontController I noticed that it&#8217;s has a lot in common with Agent – it has events, and events have to be handled[1], while it misses [...]]]></description>
			<content:encoded><![CDATA[<p>Not long ago, I&#8217;ve started to develop Mate-like Event-Driven MVC+S framework. At the same time I was improving my AI skills with Scala, AgentSpeak(L) and Agent0. While I was developing FrontController I noticed that it&#8217;s has a lot in common with Agent – it has events, and events have to be handled[1], while it misses Guards[2] and mailbox[3], it still have a lot in common with Agents.</p>
<p>Main difference between FrontController and Agent as I see it is Usage: Agent is an entity in some network, while FrontController is a bottle-neck in Application. What I wonder is – if I can meet this two concept, and look at application as a Neural Network. It might &#8220;learn&#8221; to adapt to concrete user ( via Cookies or Shared Objects ), or some user demographic ( via Server ).</p>
<p>So, that&#8217;s how your normal &#8220;mate-like&#8221; handling might look like:</p>
<pre class="brush:xml"><kiichigo:Handle type="{FlexEvent.CREATION_COMPLETE}">
	<kiichigo:Preload loadId="preload">
		<kiichigo:styles>
			<fx:String>ButtonStyles.swf</fx:String>
			<fx:String>FolioStyles.swf</fx:String>
			<fx:String>TextStyles.swf</fx:String>
		</kiichigo:styles>
		<kiichigo:Get service="{service}">
			<kiichigo:result>
				<kiichigo:Apply source="{service.lastResult}"
							target="{someModel}"
							modelField="sourceField"/>
			</kiichigo:result>
			<kiichigo:fault>
				<kiichigo:Log/>
			</kiichigo:fault>
		</kiichigo:Get>
	</kiichigo:Preload>
</kiichigo:Handle></pre>
<p>Handling with Guards might look more like if/else or case clauses:</p>
<pre class="brush:xml"><kiichigo:Handle type="{FlexEvent.CREATION_COMPLETE}">
	<handle:Guard condition="{isDebug();}">
		<kiichigo:Preload loadId="preload">
			<kiichigo:modules>
				<!-- Preload some Debug module if in debug mode -->
				<fx:String>DebugModule.swf</fx:String>
			</kiichigo:modules>
	</handle:Guard>
	...
</kiichigo:Handle></pre>
<p>You can have as many Guards per handler as you want.</p>
<p>Next step is to think about and implement FrontController to FrontController communication protocol to make them look more like AI-Agents. ^_^ </p>
<p>That&#8217;s just an early idea, but it looks prommising. You can check pre-alpha source code at my git-hub: <a href="http://github.com/nirth/kiichigo-ria" target="_blank">nirth@github</a>.</p>
<p><em>[1] Granted, agent usually have more event types than a FrontController, events represented by Fact and a status ( +some( fact ), -some( fact ), +-some( fact ): fact added, fact deleted, fact updated ).<br />
[2]<a href="http://en.wikipedia.org/wiki/Guard_(computing)" target="_blank">Wiki:Guard</a>.<br />
[3]<a href="http://en.wikipedia.org/wiki/Mailbox_(computing)" target="_blank">Wiki:Mailbox</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://kiichigo.eu/artificial-intelligence/ai-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

