<?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"
	>

<channel>
	<title>KiloOctet Blog &#187; P.O.O</title>
	<atom:link href="http://kilooctet.net/category/poo/feed/" rel="self" type="application/rss+xml" />
	<link>http://kilooctet.net</link>
	<description>Flash Platform Developpement, Flash, Flex, ActionScript, LowRA, PixLib, PixIOC, Cairngorm, MVC+C</description>
	<pubDate>Thu, 13 Nov 2008 13:25:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>fr</language>
			<item>
		<title>LowRA est en train de passer à la prochaine étape</title>
		<link>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/</link>
		<comments>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 12:04:35 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Communauté]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[ioc]]></category>

		<category><![CDATA[pixioc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=73</guid>
		<description><![CDATA[Une conférence en ligne a permis de faire un gros point sur l'état d'avancé de LowRA, le framework AS3 bâti sur PixLib et PixIOC.

Collections : harmonisation des Collections et documentation compléte.
Structures : les classes Point et Rectangle sont supprimées car redondantes avec les classes natives.
Medias : le paquetage sound va être entièrement refait et un [...]]]></description>
			<content:encoded><![CDATA[<p>Une conférence en ligne a permis de faire un gros point sur l'état d'avancé de LowRA, le framework AS3 bâti sur <a href="http://osflash.org/projects/pixlib" hreflang="en">PixLib</a> et PixIOC.<span id="more-73"></span></p>
<ul>
<li>Collections : harmonisation des Collections et documentation compléte.</li>
<li>Structures : les classes Point et Rectangle sont supprimées car redondantes avec les classes natives.</li>
<li>Medias : le paquetage sound va être entièrement refait et un paquetage video mis en place.</li>
<li>Data (accès serveur) : Le paquetage data laisse sa place au paquetage service avec toute la partie abstraite mise en place, des paquetages concrets vont voir le jour pour remoting et toutes les technologies possibles.</li>
<li>Locator : Tous les locators implémentent maintenant la même Interface Locator, le FrontController devient aussi un Locator.</li>
<li>Transitions : Pour les transitions, la notion de onEnterFrame va disparaître au profit de onTick. Mais celà demande un gros boulot + de l'optimisation des Tweens.</li>
<li>ConfigLoader : Le ConfigLoader est IOC orienté maintenant, merci a Ali_o_kan.</li>
<li>IOC : Gros refactoring de la partie IOC qui n'est pas finalisée pour l'instant. Avec des Parser configurables et une notion de namespace dans les contextes qui permettra d'inclure une appli lowra en tant que plugin d'une autre appli.</li>
<li>LoopCommand : La LoopCommand est une classe importante qui permet de ne pas freezer le player lors du parsing de gros XML ou de manipulation de données. Le XMLLoader va d'ailleurs être redesigné.</li>
</ul>
<p>Ca bouge donc beaucoup et ce n'est qu'un début. LowRA est toujours en Alpha, principalement sur la partie IOC. Vous pouvez jetter un coup d'oeil au SVN, mais il bouge pas mal et ce n'est pas fini <img src='http://kilooctet.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>D'autre part, un gros effort va être fait sur la documentation et des outils communautaires vont être mis en place, notamment un aggrégateur des fils RSS des différents blogs LowRA. Tout se passe désormais sur <a href="http://lowra.googlecode.com/" hreflang="en">googlecode</a>. Donc je vous conseille d'y venir en masse pour vous inscrire à la mailing liste officielle LowRA et vous tenir au courant <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://blog.geturl.net/download/0801_lowra/lowra_meeting_070111.html" hreflang="fr">PS : Ali_o_Kan a publié la discussion compléte</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Comparatif de frameworks FrontController (Cairngorm vs PureMVC vs LowRA)</title>
		<link>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/</link>
		<comments>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 15:21:38 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Cairngorm]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[actionscript3]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mvc+c]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=72</guid>
		<description><![CDATA[Je vous propose un comparatif non exhaustif de 3 frameworks utilisant le principe du MVC+C. Une présentation rapide est une mise en avant de leurs point forts et faiblesses sera proposé. Il y a beaucoup d'autres frameworks proposant ce pattern, mais j'ai sélectionné ce qui me semblait les plus aboutis et les plus connus. Et [...]]]></description>
			<content:encoded><![CDATA[<p>Je vous propose un comparatif non exhaustif de 3 frameworks utilisant le principe du MVC+C. Une présentation rapide est une mise en avant de leurs point forts et faiblesses sera proposé. Il y a beaucoup d'autres frameworks proposant ce pattern, mais j'ai sélectionné ce qui me semblait les plus aboutis et les plus connus. Et que j'ai eu le temps d'utiliser un minimum...<span id="more-72"></span></p>
<p><em><strong>Cairngorm</strong></em></p>
<p><strong>Présentation</strong></p>
<p>Cairngorm est un Framework dédié à Flex et qui propose une implémentation du principe du FrontController.</p>
<p>Il propose aussi une gestion des échanges serveurs à travers plusieurs principes :</p>
<p>Le Business Delegate qui est une classe proxy gérant toute la logique de communication directe avec le serveur (web service, http ou autres). Elle est appelé par les commandes, qui leur passe deux méthodes : onResult, onFault recevant les résultats.</p>
<p>Les Value Object qui sont des objets de retour du serveur Remoting. Ils sont automatiquement mappés par Flex à nos propres classes. Pour cela les classes doivent indiqués le type AMF correspondant.</p>
<p>Le Service Locator qui permet de centraliser l’accès aux différents service (Web Service, http, XML) avec une interface unifiée.</p>
<p><strong>Points forts :</strong></p>
<ul>
<li>Framework léger (à peine une vingtaines de classes)</li>
<li>Soutenu, documenté et géré par Adobe de manière officielle</li>
<li>Répandu dans la communauté Flex donc assez universel</li>
</ul>
<p><strong>Points faibles :</strong></p>
<ul>
<li>Totallement dépendant du Flex SDK, ne peut donc pas s'utiliser dans des projets Flash ou pur ActionScript</li>
<li>La mise à jour des vues dans le cadre d'une mise à jour des modèles se fait par data binding, ce qui peut poser des problèmes de lisibilité du code et de debugging. (Ex. Si une propriété du modèle n'existe plus, on n'aura pas de notification d'erreur)</li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li><a href="http://labs.adobe.com/wiki/index.php/Cairngorm">http://labs.adobe.com/wiki/index.php/Cairngorm</a></li>
<li><a href="http://www.cairngormdocs.org">http://www.cairngormdocs.org</a></li>
<li><a href="http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf">http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf</a></li>
<li><a href="http://www.cairngormdocs.org/docs/cairngorm_2_1/index.html">http://www.cairngormdocs.org/docs/cairngorm_2_1/index.html</a></li>
</ul>
<p><em><strong>LowRA</strong></em></p>
<p><strong>Présentation</strong></p>
<p>LowRA est la version AS3 des Framework PixLib et PixIOC.</p>
<p>Il propose notamment une implémentation du principe du FrontController. Mais aussi beaucoup d’autres choses.</p>
<p>Entre autres :</p>
<p>Un Service Locator qui permet de centraliser l’accès aux différents service du côté serveur.</p>
<p>Un paquetage de Tween.</p>
<p>Des paquetages de Collections et d’Iterator.</p>
<p>Une gestion unifiés des Loading (Graphique, son, XML, etc…) et la possibilité de créé des piles de chargement.</p>
<p>Une possibilité d’avoir des Commandes déclenchés à intervalles réguliers.</p>
<p>Une gestion d’événements typés et un eventBroadcaster propre au Framework.</p>
<p>Les deux autres grosses parties du Framework concernent l’IOC et par extension la possibilité de créé une application par plugin.</p>
<p><strong>Points forts :</strong></p>
<ul>
<li>Non basé sur le Flex SDK</li>
<li>Propose beaucoup plus que simplement une implémantation du MVC+C</li>
<li>Propose une implémentation d'IOC et une architecture de plug-in toute faite</li>
<li>Open source et possibilité d'évolution</li>
</ul>
<p><strong>Points faibles :</strong></p>
<ul>
<li>Pas de version stable (pour l'instant)</li>
<li>Certains éléments non développés à l'heure actuelle</li>
<li>Documentation manquante</li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li>SVN : <a href="http://lowra.googlecode.com/svn/trunk">http://lowra.googlecode.com/svn/trunk</a></li>
</ul>
<ul>
<li><a href="http://osflash.org/projects/lowra">http://osflash.org/projects/lowra</a></li>
<li><a href="http://www.geturl.net/lowra/">http://www.geturl.net/lowra/</a></li>
<li><a href="http://groups.google.com/group/lowra/">http://groups.google.com/group/lowra//a&gt;</a></li>
<li><a href="http://www.community.oddlyonward.com/">http://www.community.oddlyonward.com/</a></li>
</ul>
<p><em><strong>PureMVC</strong></em></p>
<p><strong>Présentation</strong></p>
<p>PureMVC propose lui aussi une implémentation du pattenr MVC+C en se reposant aussi sur pas mal d'autres patterns (Proxy, Observer, Facade, Mediator)</p>
<p>Dans PureMVC, View et Model sont deux classes qui ne font que donner des accés a des listes d'instances (de Mediator pour View et de Proxy pour Model) et elles sont elle mêmes gérées par la facade qui est le point central de l'application.</p>
<p><strong>Points forts</strong></p>
<ul>
<li>Non basé sur le Flex SDK</li>
<li>Implémentation rapide sans héritage (on utilise directement les classes du framework)</li>
<li>Bonne documentation et site actif derrière</li>
<li>Bonne réputation</li>
</ul>
<p><strong>Points faibles</strong></p>
<ul>
<li>Système événementiel différents des habitudes</li>
<li>Pas de Notification typées</li>
<li>Nomenclature des classes différentes donc un peu plus longe à appréhender</li>
<li>Certains points (Mediator) peuvent nécessiter un redéveloppement <a href="http://kilooctet.net/index.php/2007/12/11/68-puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi" hreflang="fr">(cf mon post précédent)</a></li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li><a href="http://www.puremvc.org">http://www.puremvc.org/</a></li>
</ul>
<p>Et pour ne pas rester en reste il y aussi ceux là :</p>
<ul>
<li><a href="http://code.google.com/p/vegas/" hreflang="fr">Vegas</a></li>
<li><a href="http://ariaware.com/products/arp/" hreflang="en">ARP</a></li>
<li><a href="http://www.servebox.com/foundry/doku.php" hreflang="fr">Foundry</a> (Flex)</li>
</ul>
<p>Au final et pour ne pas éluder la question, je dirais qu'on peut conseiller Cairngorm dans le cadre de projet Flex pas trop gros et passer à PureMVC ou LowRA si vraiment le projet grossit trop. J'ai fait la manipulation sur un mini projet, la transition se fait assez facilement. Au final, le passage en PureMVC est quand même un peu plus long du fait de la nomenclature radicalement différentes des classes. Donc Cairngorm est une bonne introduction aussi pour ceux qui ne sont pas super à l'aise avec le pattern MVC+C. C'est un framerwork qui va à l'essentiel et qui est ultra bien documenté. Par contre dans le cadre d'un projet ActionScript hors Flex je recommande LowRA sans hésiter tant il apporte tout un tas de faciliter (loaders, event typés, request, collections) sans parle de l'IOC et des plugins. Même si PureMVC, n'est pas absolument lié à Flex, il semble logique de l'adatper pour les gros projets Flex. On pourra toujours extraire certaines classes de LowRA pour des besoins particuliers.</p>
<p>Sur ce, bon dev et bon week-end <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PureMVC - Le KoMediator, un Mediator un petit peu plus souple (selon moi)</title>
		<link>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/</link>
		<comments>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 14:48:43 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mvc+c]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=71</guid>
		<description><![CDATA[Salut à tous,
J'explore actuellement les frameworks proposant une implémentation du principe MVC+C (dit aussi FrontController) .
J'ai découvert PureMVC qui est pas mal dans son genre. ( Et je ne suis pas le seul à le dire  
Si vous venez, comme moi, de PixLib / LowRA ou Cairngorm, un peu de traduction s'impose ! Dans [...]]]></description>
			<content:encoded><![CDATA[<p>Salut à tous,</p>
<p>J'explore actuellement les frameworks proposant une implémentation du principe MVC+C (dit aussi FrontController) .</p>
<p><a href="http://puremvc.org" hreflang="en">J'ai découvert PureMVC</a> qui est pas mal dans son genre. ( <a href="http://www.asserttrue.com/articles/2007/10/17/silvafug-application-frameworks-presentation" hreflang="en">Et je ne suis pas le seul à le dire</a> <img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span id="more-71"></span></p>
<p>Si vous venez, comme moi, de PixLib / LowRA ou Cairngorm, un peu de traduction s'impose ! Dans PureMVC, les ViewHelper sont des Mediator, les Events des Notifications et les EventBroadcaster des Observer.</p>
<p>C'est le Mediator qui m'intéresse tout particulièrement ici.</p>
<p>Dans PureMVC, chaque Mediator posséde une constante statique publique NAME de type String. Elle détermine son identifiant unique. Mais comme il s'agit d'une constante on doit la définir dans le code, pas de possibilité de la définir au runtime. Afin de référencer les Mediator, la classe View centralise leur accès en appelant sur chaque Mediator référencé, la méthode getMediatorName(). Du coup, il faut dans chaque classe étendant Mediator, copier/coller le code de la méthode getMediatorName(), pour quelle accéde bien à la constante de notre classe et non à celle de la super classe.</p>
<pre class="actionscript">&nbsp;
override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getMediatorName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">String</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">NAME</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Un peu lourd, je trouve et surtout pas très heureux dans le genre.</p>
<p>Lors de l'enregistrement d'un Mediator dans la classe View, cette dernière va aussi demander une liste des Notifications auxquels ce Mediator devra être abonner. Pour cela il passe par la méthode listImplementations qui renvoie un tableau de type de Notification (String). Le callback pour chaque Notification est le même une méthode handleNotifications( notification : INotification). Du coup, il faut faire un switch dans chaque Mediator pour adapter la logique selon le type de Notification reçue. Brrrrr...</p>
<p><a href="http://www.zshare.net/download/55377985f8ab57/">Je propose donc une classe KoMediator</a> avec deux solutions qui me semblent un peu plus élégantes :</p>
<p><strong>1- Le nom du Mediator</strong></p>
<p>Pour cela j'utilise une propriété d'instance privée, transmise au constructeur. Ce qui permet d'utiliser une seconde classe qui va simplement lister les noms uniques de nos Mediator en constant publique de classe et notre classe héritant du KoMediator, passera la référence à cette variable :</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ExampleMediator <span style="color: #0066CC;">extends</span> KoMediator
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ExampleMediator<span style="color: #66cc66;">&#40;</span> document : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> document, MediatorList.<span style="color: #006600;">EXAMPLE</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MediatorList
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const EXAMPLE : <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;example&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi la signature de notre Mediator est la même que celui du Mediator d'origine de PureMVC</p>
<p><strong>2- Gérer les notifications avec une méthode pour chaque et sans switch</strong></p>
<p>Pour cela, j'ai "extrait" la classe HashMap de <a href="http://osflash.org/projects/lowra" hreflang="en">LowRA</a> et me suis contenté de la rendre indépendante du reste du framework. Le code complet de cette classe est donc bien de Francis Bourre. <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Je me sert donc d'une instance de Map pour garder la liste de mes notifications en clefs, la valeurs correspondantes étant la méthode qui va recevoir la Notification.</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ExampleMediator <span style="color: #0066CC;">extends</span> KoMediator <span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ExampleMediator<span style="color: #66cc66;">&#40;</span> document : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> document, MediatorList.<span style="color: #006600;">EXAMPLE</span> <span style="color: #66cc66;">&#41;</span>
_mNotificationInterest.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span> NotificationList.<span style="color: #006600;">MODEL_UPDATED</span>, onModelUpdate <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onModelUpdate<span style="color: #66cc66;">&#40;</span> notification : INotification <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi on a une implémentation bien plus simple et proche du EventBroadcasting classique.</p>
<p>Enfin je trouve.</p>
<p>Pour ma part.</p>
<p>Et de mon humble avis...</p>
<p>Et vous ?</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Utiliser une ViewList dans un ViewHelper de Cairngorm</title>
		<link>http://kilooctet.net/2007/12/03/utiliser-une-viewlist-dans-un-viewhelper-de-cairngorm/</link>
		<comments>http://kilooctet.net/2007/12/03/utiliser-une-viewlist-dans-un-viewhelper-de-cairngorm/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 16:50:34 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Cairngorm]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[actionscript3]]></category>

		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=69</guid>
		<description><![CDATA[Un petit truc en passant.
Venant de PixLib, je m'étais bien habitué en utilisant les ViewList, en gros une classe de constante public listant les identifiants uniques des vues. Pour prendre la même technique mais dans Cairngorm, il suffit d'overrider la function initialized de notre helper de la façon suivante :
&#160;
override public function initialized&#40;document:Object, id:String&#41;:void &#123;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Un petit truc en passant.</p>
<p>Venant de PixLib, je m'étais bien habitué en utilisant les ViewList, en gros une classe de constante public listant les identifiants uniques des vues. Pour prendre la même technique mais dans Cairngorm, il suffit d'overrider la function initialized de notre helper de la façon suivante :</p>
<pre class="actionscript">&nbsp;
override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialized<span style="color: #66cc66;">&#40;</span>document:<span style="color: #0066CC;">Object</span>, id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">super</span>.<span style="color: #006600;">initialized</span><span style="color: #66cc66;">&#40;</span> document, ViewList.<span style="color: #006600;">VIEWNAME</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Où on remplace bien sur VIEWNAME par la constante de l'id unique. Simple, mais efficace. On est ainsi sur que c bien notre helper qui donne son id et non le mxml l'incluant.</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/03/utiliser-une-viewlist-dans-un-viewhelper-de-cairngorm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>KoDeserializer</title>
		<link>http://kilooctet.net/2007/04/18/kodeserializer/</link>
		<comments>http://kilooctet.net/2007/04/18/kodeserializer/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 18:05:50 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[]]></category>

		<category><![CDATA[pixlib]]></category>

		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=66</guid>
		<description><![CDATA[Vous trouverez ici : kodeserializer.zip un petit Deserializer perso à utiliser avec PixLib et qui ajoute deux petites fonctionnalités au XMLToObjectDeserializer fournit par Francis :
Une propriété statique USE_ATTRIBUTE_NAME qui est un Boolean (false par défaut). Il désactive l'utilisation de l'attribut name d'un noeud en tant que nom de propriété de l'objet déserialisé (du coup c'est [...]]]></description>
			<content:encoded><![CDATA[<p>Vous trouverez ici : <a href="http://ks351861.kimsufi.com/%7Ekiloocte/wp-content/uploads/2008/01/kodeserializer.zip" title="kodeserializer.zip">kodeserializer.zip</a> un petit Deserializer perso à utiliser avec <a href="http://osflash.org/projects/pixlib" hreflang="en">PixLib</a> et qui ajoute deux petites fonctionnalités au XMLToObjectDeserializer fournit par Francis :</p>
<p>Une propriété statique USE_ATTRIBUTE_NAME qui est un Boolean (false par défaut). Il désactive l'utilisation de l'attribut name d'un noeud en tant que nom de propriété de l'objet déserialisé (du coup c'est le nom du noeud qui est utilisé</p>
<p>Une méthode d'instance</p>
<pre class="actionscript">&nbsp;
 forceType<span style="color: #66cc66;">&#40;</span> sNodeName : <span style="color: #0066CC;">String</span>, sType : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Elle permet d'indiquer un type pour des noms. Le but étant de pouvoir gérer des types sur des XML sur lesquels on a pas la main.<span id="more-66"></span></p>
<p>Une classe et un xml de test sont dans le zip mais en gros voici le principe :</p>
<p>Mon XML</p>
<pre><span style="color: #009900"><span style="font-weight: bold; color: black">&lt;</span>?xml <span style="color: #000066">version</span>=<span style="color: #ff0000">"1.0"</span> <span style="color: #000066">encoding</span>=<span style="color: #ff0000">"UTF-8"</span>?<span style="font-weight: bold; color: black">&gt;</span></span> <span style="color: #009900"><span style="font-weight: bold; color: black">&lt;root<span style="font-weight: bold; color: black">&gt;</span></span></span> 	<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;test1NodeName</span> <span style="color: #000066">name</span>=<span style="color: #ff0000">"test1AttributeName"</span><span style="font-weight: bold; color: black">&gt;</span></span>Cool<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/test1NodeName<span style="font-weight: bold; color: black">&gt;</span></span></span> 	<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;test2<span style="font-weight: bold; color: black">&gt;</span></span></span>'item1','item2','item3'<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/test2<span style="font-weight: bold; color: black">&gt;</span></span></span> <span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/root<span style="font-weight: bold; color: black">&gt;</span></span></span></pre>
<p>Si je le charge avec le Deserialize de base voici en gros ce que j'aurais :</p>
<pre class="actionscript"> <span style="color: #66cc66;">&#91;</span>
<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#93;</span> test1AttributeName : <span style="color: #ff0000;">&quot;cool&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
test2 : <span style="color: #ff0000;">&quot;'item1','item2','item3'&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
&nbsp;</pre>
<p>Avec mon déserializer, en forcant le type du noeud test2 sur array :</p>
<pre class="actionscript">&nbsp;
<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#93;</span> test1NodeName : <span style="color: #ff0000;">&quot;cool&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
test2 : <span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#93;</span> <span style="color: #808080; font-style: italic;">// Type Array</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item1&quot;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item2&quot;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item3&quot;</span>
&nbsp;</pre>
<p>Et voici le bout de code dans la classe Test.as, au passage vous noterez que j'ai mis les types en propriétés statiques pour plus de sécurité...</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">// Méthode classique</span>
<span style="color: #000000; font-weight: bold;">var</span> xto : XMLToObject = <span style="color: #000000; font-weight: bold;">new</span> XMLToObject<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
xto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, debugObject <span style="color: #66cc66;">&#41;</span>;
xto.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;test.xml&quot;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// Flapflap Style &lt;img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /&gt;</span>
KoXTODeserializer.<span style="color: #006600;">USE_ATTRIBUTE_NAME</span> = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #808080; font-style: italic;">// On utilise plus l'attribut name</span>
<span style="color: #000000; font-weight: bold;">var</span> deserializer : KoXTODeserializer = <span style="color: #000000; font-weight: bold;">new</span> KoXTODeserializer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
deserializer.<span style="color: #006600;">forceType</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test2&quot;</span>, KoXTODeserializer.<span style="color: #006600;">ARRAY_TYPE</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// ON force le type Array pour le noeud test2</span>
<span style="color: #000000; font-weight: bold;">var</span> koXto : XMLToObject = <span style="color: #000000; font-weight: bold;">new</span> XMLToObject<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>, deserializer <span style="color: #66cc66;">&#41;</span>;
koXto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, debugObject <span style="color: #66cc66;">&#41;</span>;
koXto.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;test.xml&quot;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Deux limitations : On force un type pour un nom de noeud donc si on a plusieurs noeud a différents niveaux ayant le même nom ils auront le même type Forcer le type array sur un noeud ayant des enfants n'est pas gérer</p>
<p>J'attends vos retour <img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/04/18/kodeserializer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Design Pattern Strategy - Un exemple concret avec la validation de formulaire</title>
		<link>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/</link>
		<comments>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 16:30:47 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[actionscript2]]></category>

		<category><![CDATA[design pattern]]></category>

		<category><![CDATA[strategy]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=64</guid>
		<description><![CDATA[Salut à tous,
On m'a toujours dit que la meilleur utilisation à faire des Design patterns n'était pas de concevoir directement avec, mais que lorqu'un problème de conception se posait, voir si il n'y avait pas déjà un Design Pattern pouvant nous aider à le traiter. Mais comme tout ceux qui lisent pour la première fois [...]]]></description>
			<content:encoded><![CDATA[<p>Salut à tous,</p>
<p>On m'a toujours dit que la meilleur utilisation à faire des Design patterns n'était pas de concevoir directement avec, mais que lorqu'un problème de conception se posait, voir si il n'y avait pas déjà un Design Pattern pouvant nous aider à le traiter. Mais comme tout ceux qui lisent pour la première fois <a href="http://www.amazon.fr/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.fr%2FHead-First-Design-Patterns-Freeman%2Fdp%2F1600330541%3Fie%3DUTF8%26s%3Denglish-books%26qid%3D1173455707%26sr%3D1-2&amp;tag=kilblo-21&amp;linkCode=ur2&amp;camp=1642&amp;creative=6746">Design Patterns Head First</a><img src="http://www.assoc-amazon.fr/e/ir?t=kilblo-21&amp;l=ur2&amp;o=8" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" /> ou <a href="http://www.amazon.fr/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.fr%2FEssential-ActionScript-2-0-en-anglais%2Fdp%2F0596006527%3Fie%3DUTF8%26s%3Denglish-books%26qid%3D1173455802%26sr%3D1-2&amp;tag=kilblo-21&amp;linkCode=ur2&amp;camp=1642&amp;creative=6746">Essential ActionScript</a><img src="http://www.assoc-amazon.fr/e/ir?t=kilblo-21&amp;l=ur2&amp;o=8" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" />, j'ai voulu tester les design patterns en cherchant a les appliquer directement à ma conception d'application.<span id="more-64"></span></p>
<p>Heuresement le temps est parfois un grand allié et il nous apporte un peu de sagesse et d'expérience. J'avais donc garder de côté ma liste de Design pattern avec une vague impression d'imaginer ce à quoi ils pouvaient servir. Et puis ce matin, ping (c'est le bruit de l'illumination). Un simple petit jeu concours à réaliser. Rien de bien complexe. Juste des champs de formulaire à valider. Je me suis dit autant en profiter pour faire une petite classe de validation de formulaire rapide et réutilisable.</p>
<p>J'ai donc commencer une classe utils avec des méthodes statiques qui permettraient de valider différents champs tels que E-mail, N° de téléphone, Code postal etc...</p>
<p>Mais bon ça ne me plaisait pas trop, tout ça était un peu lourd. Et là je me suis souvenu du pattern <a href="http://en.wikipedia.org/wiki/Strategy_pattern" hreflang="en">Strategy</a> qui permet de déléguer un algorithme. Ca semblait la bonne solution à mon problème de conception trop lourde à maintenir.</p>
<p>Voilà donc un exemple de ce que ça donne :</p>
<p>D'abord une interface qui va définir la méthode indiquant si un champ est valide ou non :</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #0066CC;">interface</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>La méthode isValid reçoit une chaîne et indique si elle est valide ou pas.</p>
<p>Ensuite, on créé différentes stratégies selon ce que l'on veut valider :</p>
<p>Une adresse email :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">StringUtil</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">EmailValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> EmailValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span> StringUtil.<span style="color: #006600;">contains</span><span style="color: #66cc66;">&#40;</span> s, <span style="color: #ff0000;">&quot;@&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> &amp;amp;&amp;amp; <span style="color: #66cc66;">&#40;</span> StringUtil.<span style="color: #006600;">contains</span><span style="color: #66cc66;">&#40;</span> s, <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span></pre>
<p>Un code postal :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">ZipCodeValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> ZIPCODE_LENGTH : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">5</span>;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ZipCodeValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span> != <span style="color: #0066CC;">NaN</span> <span style="color: #66cc66;">&#41;</span> &amp;amp;&amp;amp; <span style="color: #66cc66;">&#40;</span> s.<span style="color: #0066CC;">length</span> == ZIPCODE_LENGTH<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Une date :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">NumberUtil</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">DateValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_LENGTH : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_RANGE_LIST : <span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">31</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1900</span>, <span style="color: #cc66cc;">2007</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#93;</span>;
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_LENGHT_LIST : <span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">&#93;</span>;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> DateValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span>s : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> s.<span style="color: #0066CC;">length</span> != DATE_LENGTH <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 		<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 			<span style="color: #000000; font-weight: bold;">var</span> dateArray : <span style="color: #0066CC;">Array</span> = s.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;
 			<span style="color: #000000; font-weight: bold;">var</span> dateArray_l:<span style="color: #0066CC;">Number</span> = dateArray.<span style="color: #0066CC;">length</span>;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i &amp;lt; dateArray_l; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 				<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">date</span> : <span style="color: #0066CC;">String</span> = dateArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
 				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span> <span style="color: #66cc66;">&#41;</span> != <span style="color: #0066CC;">NaN</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 					<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span>.<span style="color: #0066CC;">length</span> == DATE_LENGHT_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 						<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> ! NumberUtil.<span style="color: #006600;">isInRange</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span> <span style="color: #66cc66;">&#41;</span>, DATE_RANGE_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>, DATE_RANGE_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 							<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 						<span style="color: #66cc66;">&#125;</span>
 					<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 						<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 					<span style="color: #66cc66;">&#125;</span>
 				<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 					<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span></pre>
<p>Pour finir, j'ai créé une classe Validator qui implémente elle même l'interface et qui va recevoir en argument du constructeur la classe ayant la stratégie adéquat :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">Validator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _oValidatorStrategy : IValidator;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Validator<span style="color: #66cc66;">&#40;</span> strategy : IValidator <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 		_oValidatorStrategy = strategy;
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> _oValidatorStrategy.<span style="color: #006600;">isValid</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi pour valider le contenu d'un champ texte nomé tiEmail et qui ait censé contenir un email :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">Validator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">EmailValidator</span>;
<span style="color: #000000; font-weight: bold;">var</span> validateEmail : IValidator = <span style="color: #000000; font-weight: bold;">new</span> Validator<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> EmailValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
validateEmail.<span style="color: #006600;">isValid</span><span style="color: #66cc66;">&#40;</span> tiEmail.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>On peut rapidement et facilement maintenir notre code. Chaque classe ayant la responsabilité de valider un type d'information. Et on peut rapidement et facilement ajouter de nouveau type de validation sans que notre classe Validator ait besoin d'être modifié !</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PixIoC</title>
		<link>http://kilooctet.net/2007/01/15/pixioc/</link>
		<comments>http://kilooctet.net/2007/01/15/pixioc/#comments</comments>
		<pubDate>Mon, 15 Jan 2007 12:19:04 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[ioc]]></category>

		<category><![CDATA[pixioc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=61</guid>
		<description><![CDATA[Francis lance sa nouvelle bombe :  un framework dérivé de PixLib permettant de créer et instancier des plugins au runtime. Plus d'explication sur le site officiel sur OSFlash. Avant toute chose je vous conseil de lire Inversion du controle par Martin Fowler en Français ou en Anglais.
Ca promet tout ça !
]]></description>
			<content:encoded><![CDATA[<p>Francis lance sa nouvelle bombe :  un framework dérivé de <a href="http://www.osflash.org/pixlib" hreflang="en">PixLib</a> permettant de créer et instancier des plugins au runtime. Plus d'explication sur <a href="http://www.osflash.org/pixioc" hreflang="en">le site officiel sur OSFlash</a>. Avant toute chose je vous conseil de lire <a href="http://www.dotnetguru.org/articles/dossiers/ioc/Fowler/IoC.htm" hreflang="fr">Inversion du controle par Martin Fowler en Français</a> ou en <a href="http://www.martinfowler.com/articles/injection.html" hreflang="en">Anglais.</a></p>
<p>Ca promet tout ça !</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/01/15/pixioc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PEACE Alpha Release</title>
		<link>http://kilooctet.net/2006/12/13/peace-alpha-release/</link>
		<comments>http://kilooctet.net/2006/12/13/peace-alpha-release/#comments</comments>
		<pubDate>Wed, 13 Dec 2006 00:08:23 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[PEACE]]></category>

		<category><![CDATA[mvc+c]]></category>

		<category><![CDATA[pixlib]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=58</guid>
		<description><![CDATA[PEACE (Pixlib Event And Command Editor) Alpha version 0.0.1 is here !! This a simple editor taht allow you, in the case of a FrontController's PixLib dev, to quickly add a Command, add an event with same name in a EventList and link them in the Controller. For this you just need to set your [...]]]></description>
			<content:encoded><![CDATA[<p>PEACE (Pixlib Event And Command Editor) Alpha version 0.0.1 is here !! This a simple editor taht allow you, in the case of a FrontController's <a href="http://www.osflash.org/pixlib" hreflang="en">PixLib</a> dev, to quickly add a Command, add an event with same name in a EventList and link them in the Controller. For this you just need to set your source folder. Automaticly Peace will look for EventList and Controller and a command folder. If it not find it you can setup manually (if you call it by another name). Next, it will tell you a list of Event, Command and wich one are linked. For now just in a TextArea. This is a proof of concept to have a first feedback.<span id="more-58"></span></p>
<p>For now, it was make with Zinc but I hope next release will come using <a href="http://www.haxe.org" hreflang="en">HaXe</a>... If you have some skills on it and a little bit of time be welcome ! Also it use MM Components and I'll try to go to <a href="http://www.aswing.org/display/AsWing/Home" hreflang="en">ASWing</a> as soon as possible. My intention is to make a perfect Open Source Flash project... Also to create the Command it use a template you can find in the template folder created by the app at launch time. Change it after launching to change youre command line code. There is just two tags $package$ and $name$ to keep...</p>
<p><strong>!!! WARNING!!!! This is an earlier alpha and I just make some quick test. This application write on your as files so use it with care. I suggest you to make a copy of one of your PixLib's based work for test if. I wait for you feedback at flapflap_at_kilooctet.net</strong></p>
<p><a href="http://www.kilooctet.net/peace/alpha1/peace.zip">Let's take PEACE</a></p>
<p>PEACE (Pixlib Event And Command Editor) Alpha version 0.0.1 est disponible !! Son principe en est simple : c'est un petit éditeur qui vous permet dans le cadre d'un framework basé sur le FrontController de <a href="http://www.osflash.org/pixlib" hreflang="en">PixLib</a>, d'ajouter rapidement une commande de rajouter l'événement correspondant dans la EventList et de les lier dans le Controller. Pour celà vous devez préciser votre dossier source. Automatiquent Peace va rechercher les classes nommées EventList et Controller ainsi qu'un dossier command. Si il ne les trouve pas vous pouvez les préciser (notamment si vous les avez appeller autrement). Ensuite, il va vous lister les événements, les commandes et ceux qui sont liés. Pour l'instant tout ça est brut dans un TextArea. Le but étant un test de pertinence et de couvrir un premier panel de test.</p>
<p>Pour l'instant, l'exécutable est généré par Zinc mais j'espère pouvoir utiliser <a href="http://www.haxe.org" hreflang="en">HaXe</a> pour les prochaines versions. Si vous y connaissez n'hésitez pas à me contacter... J'utilise aussi les composants Flash mais je vais passer sur <a href="http://www.aswing.org/display/AsWing/Home" hreflang="en">ASWing</a> dès que possible. Le but étant de faire un projet totalement Open Source Flash. J'oubliais, pour créer les Command, j'utilise un template situté dans le dossier du même nom. Vous pouvez le modifier à votre guise mais uniquement une fois l'application lancée. J'utilise juste deux tags : $package$ et $name$.</p>
<p><strong>!!! ATTENTION !!!! Ceci est une alpha et je n'ai procédé qu'a des tests rapides. Ce programme intervient sur vos fichiers as donc merci de le tester avec précautions. Je vous conseil de copier un de vos projets pour faire le test. J'attends vos retours avec impatience sur flapflap_at_kilooctet.net</strong></p>
<p><a href="http://www.kilooctet.net/peace/alpha1/peace.zip">Let's take PEACE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2006/12/13/peace-alpha-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MVC, la logique abstraite et la gestion des responsabilités : un exemple.</title>
		<link>http://kilooctet.net/2006/12/01/mvc-la-logique-abstraite-et-la-gestion-des-responsabilites/</link>
		<comments>http://kilooctet.net/2006/12/01/mvc-la-logique-abstraite-et-la-gestion-des-responsabilites/#comments</comments>
		<pubDate>Fri, 01 Dec 2006 11:04:58 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[abstraction]]></category>

		<category><![CDATA[mvc]]></category>

		<category><![CDATA[responsabilité]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=56</guid>
		<description><![CDATA[Une des premières choses sur laquelle Francis est revenu pendant la formation : les responsabilités de chacun des intervenants du pattern MVC. Principalement celle du Modèle par rapport à la logique abstraite.
Je reviens rapidement sur le pattern MVC, il s’agit simplement de séparer les responsabilités d’une application, d’un composant ou d’une partie quelconque d’une application [...]]]></description>
			<content:encoded><![CDATA[<p>Une des premières choses sur laquelle <a href="http://www.tweenpix.net" hreflang="fr">Francis</a> est revenu <a href="http://www.kilooctet.net/index.php/2006/11/24/50-francis-bourre-s-style" hreflang="fr">pendant la formation</a> : les responsabilités de chacun des intervenants du pattern MVC. Principalement celle du Modèle par rapport à la logique abstraite.<span id="more-56"></span></p>
<p>Je reviens rapidement sur le pattern MVC, il s’agit simplement de séparer les responsabilités d’une application, d’un composant ou d’une partie quelconque d’une application ayant une partie graphique en trois objets : le Modèle, la Vue et le Contrôleur. Le Modèle est toujours la partie la plus difficile à appréhender alors qu'on comprend facilement que la Vue gère les éléments graphiques et le Contrôleur les actions déclenchées par l'utilisateur. En fait, le Modèle est en charge de toute la logique abstraite et non uniquement de la gestion des données comme je le pensais au départ. Le Modèle est bien plus qu'un simple réceptacle à données, à la limite il en gère peu d'ailleurs, déléguant cette gestion à d'autres classes et allant chercher dans celle-ci les infos nécessaires. La logique abstraite est donc l'unique responsabilité du Modèle.</p>
<p>Pour nous faire comprendre ce principe simple, Francis a utilisé un exemple que je m'empresse de reprendre ici : un simple menu.</p>
<p>Nous partirons par exemple d'un XML (mais ça pourrais être un tableau).</p>
<p>Un objet aura la responsabilité de charger et parser cette XML. Par exemple, et totalement au hasard, on pourra utiliser <a href="http://www.osflash.org/pixlib" hreflang="en">PixLib</a> pour le charger et le déserializer. Une fois notre XML transformé en un objet, il sera passé au Modèle c'est le début de la logique abstraite.</p>
<p>Dans cet exemple, j'aurais une tendance à faire que le Modèle passe ce tableau à la Vue qui aurait parcouru le tableau pour créer les différents éléments en fonction des données. Mais la responsabilité de parcourir le tableau est attribuée au Modèle et il est absurde de le faire parcourir deux fois par deux objets différents. Donc notre Modèle va parcourir cet objet est va simplement à chaque itération lancer un événement écouter par la Vue et relié a une fonction du type addMenuItem(); par exemple.</p>
<p>Ainsi la logique abstraite est bien séparé de la gestion graphique et pourra inter changer nos Vue. L'idéal étant de créer une Interface pour les Vues qui voudront écouter ce Modèle.</p>
<p>Ca paraît logique ainsi dit mais j'ai eu souvent tendance à laisser de la logique abstraite dans les Vue et on tombe alors dans une problématique de couplage fort. Une partie de la logique abstraite étant dans la Vue, la relation entre la Vue et le Modèle devient plus lourdement dissociable. On perd donc de la souplesse.</p>
<p>Je ne sais pas si tout ça vous a aidé, mais moi ça m'a bien remis les idées en place.</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2006/12/01/mvc-la-logique-abstraite-et-la-gestion-des-responsabilites/feed/</wfw:commentRss>
		</item>
		<item>
		<title>La chanson du MVC (en anglais)</title>
		<link>http://kilooctet.net/2006/11/30/la-chanson-du-mvc-en-anglais/</link>
		<comments>http://kilooctet.net/2006/11/30/la-chanson-du-mvc-en-anglais/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 10:58:29 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[chanson]]></category>

		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=55</guid>
		<description><![CDATA[Je ressort cette vielle chanson du mvc, créé et enregistré par James Dempsey, un ingénieur Apple en 2003.
Si vous ne l'aviez pas c'est un must !
]]></description>
			<content:encoded><![CDATA[<p>Je ressort cette vielle <a href="http://www.oreillynet.com/onjava/blog/2003/07/new_way_to_learn_mvc_view_a_si.html" hreflang="en">chanson du mvc</a>, créé et enregistré par James Dempsey, un ingénieur Apple en 2003.</p>
<p>Si vous ne l'aviez pas c'est un must !</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2006/11/30/la-chanson-du-mvc-en-anglais/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
