<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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" version="2.0">

<channel>
	<title>Joan Garnet :: RIA Architecture</title>
	
	<link>http://www.joangarnet.com/blog</link>
	<description>Blog acerca de arquitectura y desarrollo de software</description>
	<pubDate>Sun, 26 Oct 2008 20:47:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/JoanGarnet" type="application/rss+xml" /><item>
		<title>Papervision3D for dummies: Material</title>
		<link>http://www.joangarnet.com/blog/?p=493</link>
		<comments>http://www.joangarnet.com/blog/?p=493#comments</comments>
		<pubDate>Sun, 26 Oct 2008 20:47:56 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Eventos Plataforma Flash]]></category>

		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=493</guid>
		<description><![CDATA[
Lo prometido es deuda. Todo aquél que esté interesado en el material (slides +  ejemplos) de la charla acerca de Papervision3D que ofrecí en Madrid durante el evento MIF onsite III puede descargarlo desde la entrada que he publicado en la web del AUG.

Enlace a la entrada: &#8220;Papervision3D for dummies&#8221;

]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/10/papervision3d_for_dummies.jpg" title='Papervision3D for dummies - foto Luis Adri&aacute;n Rosas Wiedfeldt' /><br />
Lo prometido es deuda. Todo aquél que esté interesado en el material (slides +  ejemplos) de la charla acerca de <a href="http://code.google.com/p/papervision3d/">Papervision3D</a> que ofrecí en Madrid durante el evento <a href="http://www.madeinflex.com/mifonsite3/">MIF onsite III</a> puede descargarlo desde la entrada que he publicado en la web del <abbr title="Adobe User Group">AUG</abbr>.</p>
<ul>
<li><a href="http://www.madeinflex.com/2008/10/26/papervision3d-for-dummies">Enlace a la entrada: &#8220;Papervision3D for dummies&#8221;</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=493</wfw:commentRss>
		</item>
		<item>
		<title>Papervision3D for dummies: nueva charla para MIF onsite III</title>
		<link>http://www.joangarnet.com/blog/?p=486</link>
		<comments>http://www.joangarnet.com/blog/?p=486#comments</comments>
		<pubDate>Fri, 10 Oct 2008 20:57:11 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Eventos Plataforma Flash]]></category>

		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=486</guid>
		<description><![CDATA[Lamentándolo mucho, Alberto Albericio, uno de los ponentes del evento MIF onsite III ha tenido que renunciar a sus 55 minutos de gloria en el estrado, dejando así un vacío importante ya que su charla era interesantísima: &#8220;Aplicaciones Colaborativas en Flex&#8221;.
Así, a última hora con apenas 1,5 semanas y un montón de trabajo por enmedio [...]]]></description>
			<content:encoded><![CDATA[<p>Lamentándolo mucho, <a href="http://prexon.es/">Alberto Albericio</a>, uno de los ponentes del evento <a href="http://www.madeinflex.com/mifonsite3/">MIF onsite III</a> ha tenido que renunciar a sus 55 minutos de gloria en el estrado, dejando así un vacío importante ya que su charla era interesantísima: &#8220;Aplicaciones Colaborativas en Flex&#8221;.<br />
Así, a última hora con apenas 1,5 semanas y un montón de trabajo por enmedio voy a intentar rellenar tan gran hueco hablando del único tema que puede llegar a estar al nivel del que propuso inicialmente Alberto:Papervision3D.<br />
La charla, por su naturaleza básica y totalmente  introductoria la he bautizado con el nombre &#8220;<strong>Papervision3D for dummies</strong>&#8220;, que se podría traducir cómo: <em>Papervision3D para principiantes</em>.<br />
Así que nos vemos en Madrid este viernes que viene en MIF onsite III :)<br />
No puedes faltar!!!</p>
<ul>
<li><a href="http://www.madeinflex.com/mifonsite3/">Registro, información y calendario</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=486</wfw:commentRss>
		</item>
		<item>
		<title>Made In Flex + Domestika + ASNativos == MIF onsite III</title>
		<link>http://www.joangarnet.com/blog/?p=476</link>
		<comments>http://www.joangarnet.com/blog/?p=476#comments</comments>
		<pubDate>Wed, 17 Sep 2008 20:19:22 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Eventos Plataforma Flash]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=476</guid>
		<description><![CDATA[MIF onsite III es un evento totalmente gratuito dedicado a profesionales del sector web que trabajan con tecnologías de Adobe.
Esta tercera convocatoría del evento va a ser un festival de grupos de usuarios ya que para la ocasión se han unido tres de los grandes a nivel nacional: Made In Flex, Domestika y ASNativos.
Los ponentes [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/banner_mifonsite3.jpg" alt="MIF onsite III" title="MIF onsite III" align="left" hspace="5" vspace="5" /><a href="http://www.madeinflex.com/mifonsite3/">MIF onsite III</a> es un evento totalmente gratuito dedicado a profesionales del sector web que trabajan con tecnologías de Adobe.<br />
Esta tercera convocatoría del evento va a ser un festival de grupos de usuarios ya que para la ocasión se han unido tres de los grandes a nivel nacional: <a href="http://www.madeinflex.com/">Made In Flex</a>, <a href="http://www.domestika.org">Domestika</a> y <a href="http://groups.google.es/group/asnativos">ASNativos</a>.<br />
Los ponentes son grandes profesionales todos y las charlas serán muy interesantes. Aquí dejo un resumen del programa. Par más detalle visitar la web del evento.</p>
<ul>
<li>9.30 - 10.00: Apertura</li>
<li>10.00 - 10.30: <strong>Enrique Duvos:</strong> Keynote</li>
<li>10.30 - 11.25: <strong>Alberto Alcaraz:</strong> Optimización en Flex</li>
<li>11.30 - 12.25: <strong>Borja Delgado:</strong> Domestika, una comunidad online. Integración accesible de tecnologías</li>
<li>12.30 - 13.25: <strong>Carlos Rovira:</strong> Arquitecturas Avanzadas Flex/JEE - RIAlity</li>
<li>13.30 - 15.00: Comida</li>
<li>15.00 - 15.55: <strong>Angel Blesa:</strong> WedTool.com,una Startup sobre Flex</li>
<li>16.00 - 16.55: <strong>Alberto Albericio:</strong> Aplicaciones Colaborativas en Flex</li>
<li>17.00 - 17.30: Entrega premios concurso AIR.</li>
<li>17.30 - 18.30: <strong>Joseba Alonso y Xavi Beumala:</strong> Qué nos depara el futuro? Quieres ver que te va a aportar la plataforma Flash en un futuro inminente? </li>
</ul>
<p>Aparte del evento se hará la entrega de los premios del <a href="http://www.madeinflex.com/aug/concurso-mif-air">concurso <em>MIF AIR contest</em></a>.</p>
<p><strong>¿Cuándo?</strong> 17 de Octubre de 10:00 a.m a 6:30 p.m.<br />
<strong>¿Dónde?</strong> Universidad Pontificia de Comillas en la sede de Alberto Aguilera, nº23<br />
<strong>¿Cuánto?</strong> Gratuito<br />
Formulario de registro <a href="http://www.madeinflex.com/mifonsite3/">en la misma web del evento</a></p>
<p>Nos vemos por Madrid!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=476</wfw:commentRss>
		</item>
		<item>
		<title>The pragmatic programmer: ‘la ventana rota’ y otros cuentos</title>
		<link>http://www.joangarnet.com/blog/?p=457</link>
		<comments>http://www.joangarnet.com/blog/?p=457#comments</comments>
		<pubDate>Tue, 16 Sep 2008 23:41:40 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[libros]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=457</guid>
		<description><![CDATA[The Pragmatic Programmer es un libro que tengo hace algún tiempo. Lo voy leyendo y releyendo de vez en cuando porque siempre me sorprende lo ciertas que son las cosas que dice.
Si me preguntaran que qué quiero ser de grande diría que un pragmatic programmer :)
El paradigma del arte de la programación está descrito en [...]]]></description>
			<content:encoded><![CDATA[<p><img border="0" hspace="10" vspace="5" align="left" src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/tpp.jpg" alt="The Pragmatic Programmer" title="The Pragmatic Programmer" width="114" height="144" /><a href="http://www.pragprog.com/the-pragmatic-programmer/">The Pragmatic Programmer</a> es un libro que tengo hace algún tiempo. Lo voy leyendo y releyendo de vez en cuando porque siempre me sorprende lo ciertas que son las cosas que dice.<br />
Si me preguntaran que qué quiero ser de grande diría que un <em>pragmatic programmer</em> :)<br />
El paradigma del arte de la programación está descrito en este libro de forma brillante, con analogías de lo más acertadas y sentido del humor. Algunos títulos hablan por si solos&#8230;. como <em>The cat ate my source code</em> y <em>Stone soup and boiled frogs</em>.<br />
No puedo dejar de citar alguna parte de un capítulo que me sorprendió bastante el día que lo leí por primera vez y que me viene a menudo a la cabeza cuál voz de la conciencia cuando por la razón que sea voy a hacer algo &#8220;feo&#8221;. Se trata de &#8220;la teoría de la ventana rota&#8221; (The broken window theory), dentro de un capítulo, <a href="http://www.pragprog.com/the-pragmatic-programmer/extracts/software-entropy">Software Entropy, disponible online</a>.<br />
Lo he traducido a mi manera:</p>
<blockquote><p>En el centro de las ciudades algunos edificios están impecables, mientras que otros son armatostes en descomposición. ¿Por qué? Investigadores en el campo del crimen y el desorden urbanístico descubrieron un mecanismo de activación, uno que muy rápidamente convierte a un edificio limpio, intacto, habitado en uno roto y abandonado.<br />
Una ventana rota.<br />
Una ventana rota, olvidada sin reparar por un tiempo substancial, inculca en los habitantes del edificio una sensación de abandono, de que no se cuida el edificio. Así que otra ventana se rompe. La gente empieza a descuidar el lugar y a dejar deshechos. Aparecen pintadas. Comienza ha notarse cierto daño estructural. En un espacio relativamente corto del tiempo el edificio empeora más allá de lo que los dueño están dispuestos a asumir y la sensación de abandono se convierte en una realidad.</p>
<p>La &#8220;Teoría de la ventana rota&#8221; ha inspirado departamentos de policía en Nueva York y otras grandes ciudades a atacar las pequeñas cosas para mantener las mayores a raya. Funciona: estando encima de ventanas rotas, pintadas y otras pequeñas infracciones ha reducido el nivel de crimen.</p>
<p><strong>No vivas con ventanas rotas.</strong></p>
<p>No vivas con ventanas rotas (mal diseño, malas decisiones o código pobre) sin reparar. Arregla cada una de ellas tan pronto como la descubras. Si no hay tiempo para repararla como es debido márcatelo con un comentario. Haz algo que evite que el daño se extienda y para demostrar que estas en ello.</p>
<p>Hemos visto sistemas limpios y funcionales deteriorarse rápidamente una vez las ventanas empiezan a romperse.</p></blockquote>
<p>Pues verdades como ésta, otras explicadas de forma mucho más técnica, todo sea dicho, las hay una detrás de la otra&#8230;</p>
<p>Si te gusta aquí hay más info: <a href="http://www.pragprog.com/the-pragmatic-programmer/">http://www.pragprog.com/the-pragmatic-programmer/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=457</wfw:commentRss>
		</item>
		<item>
		<title>Barcelona PHP Conference</title>
		<link>http://www.joangarnet.com/blog/?p=450</link>
		<comments>http://www.joangarnet.com/blog/?p=450#comments</comments>
		<pubDate>Sun, 14 Sep 2008 21:52:19 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=450</guid>
		<description><![CDATA[
El Barcelona PHP user group ha organizado la PHP international conference un evento que trae ponentes de todo el mundo a la ciudad de Cornellà, muy cerca de Barcelona este 27 de Setiembre (27-09-2008) .
Pinta pero que muy bien! solo hace falta ver la programación y los ponentes.
Éstas son las charlas:

Xdebug, por Derick Rethans
Website releases [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/phpbarcelonaconference.png" alt="PHP Barcelona international conference" title="PHP Barcelona international conference" /><br />
El <a href="http://phpbarcelona.org/">Barcelona PHP user group</a> ha organizado la <strong>PHP international conference</strong> un evento que trae ponentes de todo el mundo a la ciudad de Cornellà, muy cerca de Barcelona este 27 de Setiembre (27-09-2008) .<br />
Pinta pero que muy bien! solo hace falta ver la <a href="http://phpconference.es/barcelona-php-conference-27-09-2008/talks/">programación</a> y los <a href="http://phpconference.es/barcelona-php-conference-27-09-2008/speakers/">ponentes</a>.<br />
Éstas son las charlas:</p>
<ul>
<li><strong>Xdebug</strong>, <em>por Derick Rethans</em></li>
<li><strong>Website releases made easy with the PEAR installer</strong>, <em>por Helgi Þormar</em></li>
<li><strong>SQLite3</strong>, <em>por Scott MacVicar</em></li>
<li><strong>Text indexing and search libraries for PHP</strong>, <em>por Zoë Slattery</em></li>
<li><strong>Rasmus, think again! - Agile Framework == happy PHP Developer</strong>, <em>por Arno Schneider</em></li>
<li><strong>How to pimp high volume PHP websites</strong>, <em>por Jens Bierkandt</em></li>
<li><strong>Email in PHP</strong>, <em>por Marcus Bointon</em></li>
<li><strong>Tuning the usability of online applications using web analytics techniques</strong>, <em>por Jordi Roura</em></li>
<li><strong>eyeOS: Open Source Web Desktop System in PHP</strong>, <em>por Pau Garcia-Milà</em></li>
</ul>
<p>Si desarrollas con PHP no te puedes perder esta oportunidad&#8230; a ver si nos vemos por ahí :)</p>
<h2 id="toc-enlaces">Enlaces:</h2>
<ul>
<li><a href="http://phpbarcelona.org/eventos/segunda-barcelona-php-conference">Segunda Barcelona PHP Conference</a></li>
<li><a href="http://phpconference.es/barcelona-php-conference-27-09-2008/venue/">Lugar</a></li>
<li><a href="http://phpconference.es/barcelona-php-conference-27-09-2008/talks/">Charlas</a></li>
<li><a href="http://phpconference.es/barcelona-php-conference-27-09-2008/schedule/">Horarios</a></li>
<li><a href="http://phpconference.es/barcelona-php-conference-27-09-2008/speakers/">Speakers</a></li>
<li><a href="http://phpconference.es/barcelona-php-conference-27-09-2008/registration/">Registro</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=450</wfw:commentRss>
		</item>
		<item>
		<title>Talleres subflash 2008 ( sbfl’08 )</title>
		<link>http://www.joangarnet.com/blog/?p=446</link>
		<comments>http://www.joangarnet.com/blog/?p=446#comments</comments>
		<pubDate>Sun, 14 Sep 2008 18:00:19 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Eventos Plataforma Flash]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=446</guid>
		<description><![CDATA[


Han pasado ya dos semanas desde que finalizaron los VI talleres de verano subflash.
Después de pasar por:

2003 Teruel
2004 Madrid
2005 Barcelona
2006 Oviedo
2007 Málaga [me lo perdí...]

este 2008 hemos estado en Alicante y debo decir que, como de costumbre, ha sido una gran experiencia.
¿Dónde será el año que viene? quién sabe&#8230;. cualquiera puede decidirlo. Y es que [...]]]></description>
			<content:encoded><![CDATA[<div style="width:220px; float:left;">
<img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/sbfl08.jpg" alt="sbfl 2008" title="sbfl 2008" width="200" height="356"/>
</div>
<p>Han pasado ya dos semanas desde que finalizaron los <a href="http://www.subflash.com/talleres/2008/php/index.php">VI talleres de verano subflash</a>.<br />
Después de pasar por:</p>
<ul>
<li>2003 Teruel</li>
<li>2004 Madrid</li>
<li><a href="http://www.subflash.com/talleres/2005/index.html">2005 Barcelona</a></li>
<li><a href="http://www.subflash.com/talleres/2006/">2006 Oviedo</a></li>
<li><a href="http://www.subflash.com/talleres/2007/">2007 Málaga</a> [me lo perdí...]</li>
</ul>
<p>este <a href="http://www.subflash.com/talleres/2008/php/index.php">2008 hemos estado en Alicante</a> y debo decir que, como de costumbre, ha sido una gran experiencia.<br />
¿Dónde será el año que viene? quién sabe&#8230;. cualquiera puede decidirlo. Y es que ése es el espíritu/lema del evento. Por y para los asistentes :)</p>
<p>Este año la gente de Alicante se ha ocupado de buscar un contexto ideal para el evento: La <a href="http://www.villauniversitaria.com">Universidad de Alicante</a>, en <a href="http://www.subflash.com/talleres/2008/php/mapa.php?opcion=1">San Vicente del Raspeig</a>.<br />
Aparte de la idoneidad del lugar creo que todos nos quedamos alucinados cuando vimos las instalaciones: las habitaciones, la sala de ponencias, el comedor, etc&#8230; un diez!</p>
<p>Claro está, el lugar es una parte importante que ayuda a perfilar el posible éxito del evento, pero el contenido acapara otra gran parte, y este año han habido 5+1 personas que se han ocupado de proporcionarlo:<br />
( <em class="small">Todas las ponencias tienen su material colgado en el micro-site del evento: <a href="http://www.subflash.com/talleres/2008/php/sesiones.php">http://www.subflash.com/talleres/2008/php/sesiones.php</a></em> )</p>
<p><strong>Sábado 30, 10:00h &#8220;JSFL para automatizar procesos&#8221;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/Luis_Rosas_jsfl.jpg"  alt="Luis Rosas (foto Rodrigo Diaz Medina)" title="Luis Rosas (foto Rodrigo Diaz Medina)" /><br />
<a href="http://www.nomeva.com/">Luis Adrían Rosas Wiedfeldt</a> se ocupó de poner <strong>JSFL</strong> en su lugar. A lo largo de una interesantísima charla nos contó sus experiencias personales con esta tecnología en su trabajo diario y cómo la han implementado en su empresa para ahorrar tiempo de compilación y de realización de tareas repetitivas. A mi parecer fue una brillante presentación. Amena, divertida y completa en cuanto a contenido. Todo lo que se le puede pedir a una charla.</p></blockquote>
<p><strong>Sábado 30, 11:15h &#8220;Fundamentos SEO&#8221;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/jorge_quintas_seo.jpg"  alt="Jorge Quintas (foto Rodrigo Diaz Medina)" title="Jorge Quintas (foto Rodrigo Diaz Medina)" /><br />
<a href="http://jorgequintas.com/">Jorge Quintas</a> habló de la mágia que hay detrás de la indexación en buscadores. Yo no pude asistir porque estuve ultimando mi charla&#8230;. pero por lo que he oído estuvo realmente bién! muchos hubieran alargado la ronda de preguntas unas horas :).</p></blockquote>
<p><strong>Sábado 30, 16:00h &#8220;De 2 a 3 en 45&#8242;&#8221;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/joan_garnet_as3.jpg"  alt="Joan Garnet (foto Rodrigo Diaz Medina)" title="Joan Garnet (foto Rodrigo Diaz Medina)" /><br />
Esta corrió de mi cuenta. La finalidad de la charla fue romper con el mito que hay detrás de Actionscript 3 mostrando su cara más <em>simpática</em>, contrastando ejemplos de la versión 2 y 3 del lenguaje. Teniendo en cuenta que aproximadamente el 90% de los asistentes no han utilizado esta versión del lenguaje creo que fue acertado el escoger esta temática.</p></blockquote>
<p><strong>Domingo 31, 10:00h &#8220;&#8216;Yo aquí he venido a hablar de mi blog&#8221;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/armando_sotoca_blog.jpg"  alt="Armando Sotoca (foto Rodrigo Diaz Medina)" title="Armando Sotoca (foto Rodrigo Diaz Medina)" /><br />
<a href="http://www.criteriondg.info/">Armando Sotoca</a>, la indiscutible perla del evento :) Este entrañable y simpático personaje sacado de los mismísimos <a href="http://www.q-interactiva.com">[Q]Interactiva headquarters</a> vino a contarnos su historia de <em>blogger</em> de éxito. Una charla realmente inspiradora. Desde el por qué, hasta el cómo pasando por un sinfin de anécdotas personales, datos estadísticos explicados y un largo etcétera. Su charla fue una de las más (la más?) largas! Si es que cuando se tiene el público en el bolsillo uno hace lo que quiere ;) Yo personalmente no dudaré en copiar algunos de sus métodos secretos para mantener viva la llama de este blog :)</p></blockquote>
<p><strong>Domingo 31, 11:15h &#8220;&#8216;Social Networks Interactivas 2.0&#8243;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/nitsnets.jpg"  alt="nitsnets (foto Rodrigo Diaz Medina)" title="nitsnets (foto Rodrigo Diaz Medina)" /><br />
<a href="http://www.nitsnets.com/">Elad Rodriguez</a> y <a href="http://emilianovelasco.com/blog/">Emiliano Velasco</a> dieron una charla acerca de varios aspectos relacionados con las redes sociales. Es todo muy bonito, pero&#8230; cómo monetizar tu red social? de hecho&#8230; qué es exactamente una red social? y cosas así&#8230; Aparte de esto me gustó mucho la parte de la charla en la que nos contaron cosas más internas de su empresa (<a href="http://www.nitsnets.com">nitsnets</a>) como por ejemplo el desarrollo e implantación de alguno de sus productos.</p></blockquote>
<p><strong>Domingo 31, 12h y pico &#8220;&#8216;filmoteca&#8221;:</strong> </p>
<blockquote><p><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/marc_palau_filmoteca.jpg"  alt="Marc Palau (foto Rodrigo Diaz Medina)" title="Marc Palau (foto Rodrigo Diaz Medina)" /><br />
Ya es todo un clásico ver a <a href="http://www.nbsp.es/">Marc Palau</a> subiendo al escenario y haciendo una sesión de vídeos de lo más freak. Este año no ha sido menos y hasta la hora de &#8220;El sorteo&#8221; nos estrujamos las abdominales a carcajada limpia.
</p></blockquote>
<p>El domingo, después de las charlas y de la sesión de vídeos <a href="http://www.q-interactiva.com">los organizadores del evento</a> sortearon un montón de regalos, ni más ni menos que 2 regalos seguros por cabeza! Entre los regalos había camisetas de Adobe, juegos de ordenador, libros, planes de alojamiento de CDMON, <em>suites</em> de aplicaciones de Adobe, cursos de formación y otros objetos como ratones, hubs USB, etc&#8230;. todo gentileza de <a href="http://www.subflash.com/talleres/2008/php/sponsors.php">los distintos sponsors</a>: que han apoyado el evento como <a href="http://www.v2b.es/">video2brain</a>, <a href="http://www.cdmon.com/">cdmon</a>, <a href="http://www.fxinteractive.com/">fx interactive</a>, <a href="http://www.indexbook.com/">indexbook</a>, <a href="http://www.loring-art.com/">loring-art</a>, <a href="http://www.subflash.com/talleres/2008/php/sponsors.php">etc..</a><br />
<center><br />
<img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/sorteo.jpg"  alt="Marcos en pleno sorteo (foto Rodrigo Diaz Medina)" title="Marcos en pleno sorteo (foto Rodrigo Diaz Medina)" /><br />
</center></p>
<p>En resumen han sido 2 días muy intensos. He aprendido un montón de cosas, he podido ver a la gente que solo veo en este evento, he conocido nuevas caras, me he sentido comprendido entre tanto freak :p y finalmente he vuelto a casa con las pilas recargadas hasta el año que viene, y&#8230; a ver dónde nos llevarán esta vez!</p>
<p><center><a href='http://www.joangarnet.com/blog/wp-content/uploads/2008/09/todos_big.jpg'><img src="http://www.joangarnet.com/blog/wp-content/uploads/2008/09/todos.jpg" border="0" alt="Todos los asistentes" title="Todos los asistentes" width="400" height="300" /></a></center></p>
<p>Gracias a la gente de Alicante y a Sir Marcos González Sancho y la [Q]peolpe por hacer posible este evento!</p>
<p><strong>Media:</strong></p>
<ul>
<li><a href="http://vimeo.com/1691249?pg=embed&#038;sec=1691249">Vídeo resumen</a> (por <a href="http://www.fcomoreno.net/">Paco Moreno</a>)</li>
<li><a href="http://www.cristalab.com/blog/60952/conferencias-subflash-2008.html">Vídeos de las charlas</a> (por <a href="http://cdmon.com">Marc Palau</a>)</li>
<li><a href="http://www.flickr.com/search/?q=subflash+2008">Fotos en Flickr</a></li>
</ul>
<p><strong>Posts:</strong></p>
<ul>
<li>Andrés Karp: <a href="http://www.akelarreweb.com/yo-aqui-vengo-a-hablar-de-subflash">Yo aquí vengo a hablar de Subflash</a></li>
<li>Ramón Massip a.k.a. Sipi: <a href="http://www.quadricula.com/blog/?p=333">Talleres Subflash 2008</a></li>
<li>BlocketPC: <a href="http://www.blocketpc.com/2008/09/02/talleres-subflash-2008-dia-1/">Talleres Subflash día 1</a></li>
<li>BlocketPC: <a href="http://www.blocketpc.com/2008/09/06/talleres-subflash-2008-dia-2/">Talleres Subflash Día 2</a></li>
<li>Emiliano Velasco: <a href="http://emilianovelasco.com/blog/subflash-alicante-2008/">Subflash 2008 Alicante </a></li>
<li>Luis Adrián: <a href="http://www.nomeva.com/2008/09/03/subflash-2008-vivencias/">Subflash 2008, vivencias </a></li>
<li>Armando Sotoca: <a href="http://www.criteriondg.info/wordpress/subflash-2008-despedida-y-cierre/">Subflash 2008, despecida y cierre</a></li>
<li>[Q] Interactiva: <a href="http://www.q-interactiva.com/blog/2008/09/talleres-subflash-2008-web-grafico-experiencias/">Talleres Subflash 2008</a></li>
<li>Jorge Quintas: <a href="http://jorgequintas.com/seos-congresos-y-networking/talleres-subflash-2008-mas-que-satisfecho">Talleres SubFlash 2008 - Más que satisfecho!</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=446</wfw:commentRss>
		</item>
		<item>
		<title>UMFlash: de UML a AS3 con StarUML</title>
		<link>http://www.joangarnet.com/blog/?p=445</link>
		<comments>http://www.joangarnet.com/blog/?p=445#comments</comments>
		<pubDate>Sat, 16 Aug 2008 22:21:08 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=445</guid>
		<description><![CDATA[Hay una nueva herramienta disponible para generación de código AS3 a partir de diagramas de clase UML llamada UMFlash. Está basada en StarUML y ha sido desarrollada por UnderMedia a partir de un trabajo inicial de Digitaldogbyte.
No he tenido oportunidad de probarla porque me acabo de enterar pero seguro que le hecharé un vistazo en [...]]]></description>
			<content:encoded><![CDATA[<p>Hay una nueva herramienta disponible para generación de código AS3 a partir de diagramas de clase UML llamada UMFlash. Está basada en StarUML y ha sido desarrollada por <a href="http://blog.undermedia.com.ec">UnderMedia</a> a partir de un trabajo inicial de <a href="http://www.digitaldogbyte.com/?p=3">Digitaldogbyte</a>.<br />
No he tenido oportunidad de probarla porque me acabo de enterar pero seguro que le hecharé un vistazo en cuanto llegue de vacaciones (me voy mañana!).<br />
Para los que quieran adelantarse aquí dejo el <a href="http://blog.undermedia.com.ec/index.php/generacion-de-codigo-actionscript-30-a-partir-de-diagramas-uml">artículo de presentación de la herramienta</a>.<br />
Si alguien tiene a oportunidad de pegarle un vistazo feedback será bienvenido!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=445</wfw:commentRss>
		</item>
		<item>
		<title>Strategy pattern</title>
		<link>http://www.joangarnet.com/blog/?p=443</link>
		<comments>http://www.joangarnet.com/blog/?p=443#comments</comments>
		<pubDate>Sat, 16 Aug 2008 00:57:11 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[design patterns]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=443</guid>
		<description><![CDATA[

Descripción
Implementación
Beneficios
Inyección de dependencias
Conclusión


Descripción
A veces es necesario que ciertas funcionalidades en una aplicación sean intercambiables en tiempo de ejecución. Esto es, que en un punto determinado en el ciclo de ejecución de la aplicación se disponga de un grado de flexibilidad que permita ejecutar una misma acción de distintas formas sin que esto implique tener que [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://www.joangarnet.com/blog/?p=443#toc-descripcion">Descripción</a></li>
<li><a href="http://www.joangarnet.com/blog/?p=443#toc-implementacion">Implementación</a></li>
<li><a href="http://www.joangarnet.com/blog/?p=443#toc-beneficios">Beneficios</a></li>
<li><a href="http://www.joangarnet.com/blog/?p=443#toc-inyeccion-de-dependencias">Inyección de dependencias</a></li>
<li><a href="http://www.joangarnet.com/blog/?p=443#toc-conclusion">Conclusión</a></li>
</ol>
</div>
<h2 id="toc-descripcion">Descripción</h2>
<p>A veces es necesario que ciertas funcionalidades en una aplicación sean intercambiables en tiempo de ejecución. Esto es, que en un punto determinado en el ciclo de ejecución de la aplicación se disponga de un grado de flexibilidad que permita ejecutar una misma acción de distintas formas sin que esto implique tener que implementar en dicha acción todas las posibles formas que puedan existir.<br />
El patrón de diseño <a href="http://en.wikipedia.org/wiki/Strategy_pattern"><strong>Strategy</strong></a> define una metodología que permite que esto sea posible de forma sencilla.<br />
En realidad el concepto de Strategy está fuertemente relacionado con una de las bases de la programación orientada a objetos, el polimorfismo: poli<em>(muchas)</em>morfismo<em>(formas)</em>, que es lo que permite que una clase pueda tener más de un tipo, el de la misma clase, el de su(s) superclase(s) y el de las interfaces que implementa (si nos ponemos puristas podríamos dejarlo en "las interfaces que implementa" ya que una clase es en realidad una implementación de una interfaz al fin y al cabo, ¿no?).</p>
<h2 id="toc-implementacion">Implementación</h2>
<p>Desarrollando un sencillo ejemplo se verá claramente cómo funciona.<br />
Vamos a poner por ejemplo un sistema de cobro de una tienda virtual. Las tiendas viruales disponen de distintos sistemas de pago: Visa, PayPal, Google Checkout, etc... cada uno con una lógica de conexión a la pasarela de pago diferente. Sinembargo todos los sistemas de pago tiene algo en común, que se paga :)<br />
Con esto ya tenemos todos los ingredientes necesarios para una implementación del patrón Strategy.<br />
Los actores son la clase principal de la aplicación <code>TiendaVirtual</code>, la interfaz común de todos los sistemas de pago <code>ISistemaDePago</code> y finalmente las distintas implementaciones (estrategias) de dicha interfaz <code>SistemaDePagoVisa</code>, <code>SistemaDePagoPayPal</code> y <code>SistemaDePagoGoogleCheckout</code>.<br />
Esto traducido a código sería así:</p>
<div class="igBar"><span id="lactionscript-3"><a href="#" onclick="javascript:showCodeTxt('actionscript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-3">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// clase de la aplicación</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TiendaVirtual<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> sistemaDePago:ISistemaDePago;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> seleccionaSistemaDePago<span style="color: #66cc66;">&#40;</span> sistemaDePago:ISistemaDePago <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">sistemaDePago</span> = sistemaDePago;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> realizaPago<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> sistemaDePago.<span style="color: #006600;">pagar</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Pago realizado!"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Pago no realizado..."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// la interfaz común de todas las &quot;estrategias&quot; de pago</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> ISistemaDePago<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> pagar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// las distinas implementaciones de ISistemaDePago (estrategias)</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SistemaDePagoVisa <span style="color: #0066CC;">implements</span> ISistemaDePago<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> functino pagar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Pagando con Visa"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// lógica de pago...</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> resultadoDelPago;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SistemaDePagoPayPal <span style="color: #0066CC;">implements</span> ISistemaDePago<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> functino pagar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Pagando con PayPal"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// lógica de pago...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> resultadoDelPago;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SistemaDePagoGoogleCheckout <span style="color: #0066CC;">implements</span> ISistemaDePago<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> functino pagar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Pagando con Google Checkout"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// lógica de pago...</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> resultadoDelPago;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// un posible uso de la aplicación...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> tienda:TiendaVirtual = <span style="color: #000000; font-weight: bold;">new</span> TiendaVirtual<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tienda.<span style="color: #006600;">seleccionaSistemaDePago</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> SistemaDePagoPayPal<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tienda.<span style="color: #006600;">realizaPago</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2 id="toc-beneficios">Beneficios</h2>
<p>Es limpio y permite abstraer a la aplicación de la lógica de pago.<br />
Los distintos proveedores de pasarelas de pago solo deben desarrollar sus estrategias de pago implementando la interfaz <code>ISistemaDePago</code> sin tener que saber cómo funciona cada sistema de tienda virtual.<br />
Por otro lado se puede ver que si en algún momento se requiere añadir más sistemas de pago lo único que vamos a tener que hacer es añadir en nuestro classpath la nueva implementación de <code>ISistemaDePago</code> y compilar. </p>
<h2 id="toc-inyeccion-de-dependencias">Inyección de dependencias</h2>
<p>Si nos lo montamos de forma más dinámica para evitar el paso de la compilación incluso se podrían inyectar las dependencias cargándolas en tiempo de ejecución de un swf y accediendo a ellas utilizando las nuevas APIs de Reflection de AS3. Algo así:</p>
<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showCodeTxt('actionscript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-4">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> nombreClase:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'SistemaDePagoVisa'</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> urlDependencia:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span> nombreClase+<span style="color: #ff0000;">'.swf'</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">urlDependencia.<span style="color: #006600;">applicationDomain</span> = <span style="color: #000000; font-weight: bold;">new</span> ApplicationDomain<span style="color: #66cc66;">&#40;</span>ApplicationDomain.<span style="color: #006600;">currentDomain</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dependencia = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dependencia.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>EventType.<span style="color: #006600;">COMPLETE</span>, dependenciaCargada<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dependencia.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> urlDependencia <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> dependenciaCargada<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> referenciaISistemaDePago:<span style="color: #000000; font-weight: bold;">Class</span> = dependencia.<span style="color: #006600;">loaderInfo</span>.<span style="color: #006600;">applicationDomain</span>.<span style="color: #006600;">getClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'com.tienda.'</span>+nombreClase<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> sistemaDePago:ISistemaDePago = <span style="color: #000000; font-weight: bold;">new</span> referenciaISistemaDePago<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ISistemaDePago;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tienda.<span style="color: #006600;">addSistemaDePago</span><span style="color: #66cc66;">&#40;</span> sistemaDePago <span style="color: #66cc66;">&#41;</span>;<span style="color: #808080; font-style: italic;">// supongamos que TiendaVirtual tiene este método de inyección de sistemas de pago</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2 id="toc-conclusion">Conclusión</h2>
<p>En cualquiera de los dos casos el beneficio es claro, por un lado no hay necesidad de tocar el corazón de nuestra aplicación con el consiguiente peligro de introducir nuevos bugs, por el otro añadir un punto de abstracción que permite dar flexibilidad a un aspecto potencialmente cambiante.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=443</wfw:commentRss>
		</item>
		<item>
		<title>Adapter pattern</title>
		<link>http://www.joangarnet.com/blog/?p=441</link>
		<comments>http://www.joangarnet.com/blog/?p=441#comments</comments>
		<pubDate>Tue, 12 Aug 2008 20:23:43 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[design patterns]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=441</guid>
		<description><![CDATA[El patrón de diseño Adapter es un sistema que nos permite que, en un momento dado en nuestra aplicación podamos utilizar una clase de un tipo incompatible como si fuera del tipo que realmente se requiere. Es decir, adapta una clase existente de tal forma que pueda ser utilizada en lugares dónde en principio no [...]]]></description>
			<content:encoded><![CDATA[<p>El patrón de diseño <a href="http://en.wikipedia.org/wiki/Wrapper_pattern"><strong>Adapter</strong></a> es un sistema que nos permite que, en un momento dado en nuestra aplicación podamos utilizar una clase de un tipo incompatible como si fuera del tipo que realmente se requiere. Es decir, adapta una clase existente de tal forma que pueda ser utilizada en lugares dónde en principio no debería poder utilizarse.<br />
Implementacionalmente el patrón es muy parecido al <a href="http://www.joangarnet.com/blog/?p=439">Decorator</a>, pero conceptualmente cada uno está muy diferenciado del otro, y como que los patrones tienen mucho de éso, de proporcionar un lenguaje común que nos permita entendernos cuándo hablamos del uno o del otro pues es importante saber ver la diferencia.</p>
<p>Siguiendo la tónica del post anterior he buscado un ejemplo muy básico y casi caricaturesco de lo que sería un Adapter.<br />
El ejemplo es el siguiente:</p>
<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showCodeTxt('actionscript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-6">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> ConductorIngles<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> drive<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> ConductorEspañol<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> conducir<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// éste el el Adapter</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> ConductorInglesAdaptadoAEspaña <span style="color: #0066CC;">extends</span> ConductorEspañol<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> conductorIngles:ConductorIngles = <span style="color: #000000; font-weight: bold;">new</span> ConductorIngles<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> conducir<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conductorIngles.<span style="color: #006600;">drive</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> CarreteraEspañola<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> nuevoConductor<span style="color: #66cc66;">&#40;</span> conductor:ConductorEspañol <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; conductor.<span style="color: #006600;">conducir</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> carretera:CarreteraEspañola = <span style="color: #000000; font-weight: bold;">new</span> CarreteraEspañola<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">carretera.<span style="color: #006600;">nuevoConductor</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> ConductorInglesAdaptadoAEspaña<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Igual es un poco drástico... pero supongamos que en las carreteras españolas solo pueden conducir <code>ConductorEspañol</code>(es). Si viene un británico de vacaciones y se trae el coche lo lleva crudo, porque las carreteras no están hechas para él. Entonces lo que tiene que hacer el individuo es ponerse un sombrero Mexicano ( si, en España suele pasar que la gente de fuera piensa que llevando uno de ésos se integra más en el folclore local :) ) y así hacerse pasar por un <code>ConductorEspañol</code>.<br />
El sombrero Mexicano en el ejemplo anterior equivale a la clase <code>ConductorInglesAdaptadoAEspaña</code> y nos permite adaptar <code>ConductorIngles</code> para que se pueda utilizar su lógica de conducción; el método <code>drive()</code>; a través del método homólogo en <code>ConductorEspañol</code>; el método <code>conducir()</code>.<br />
Solo de este modo podremos añadir un <code>ConductorIngles</code> en una <code>CarreteraEspañola</code>, ya que como se puede ver el método <code>nuevoConductor()</code> espera como parámetro un <code>ConductorEspañol</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=441</wfw:commentRss>
		</item>
		<item>
		<title>Decorator pattern</title>
		<link>http://www.joangarnet.com/blog/?p=439</link>
		<comments>http://www.joangarnet.com/blog/?p=439#comments</comments>
		<pubDate>Sat, 09 Aug 2008 00:26:30 +0000</pubDate>
		<dc:creator>Joan Garnet</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[design patterns]]></category>

		<guid isPermaLink="false">http://www.joangarnet.com/blog/?p=439</guid>
		<description><![CDATA[ActionScript no soporta herencia múltiple, si alguna vez te has visto en una situación en la que te hubiera gustado que así fuera es muy posible que hayas llegado a algún recurso donde se explica lo que es el patrón de diseño Decorator o, porque no, que lo hayas implementado sin saber que tenía un [...]]]></description>
			<content:encoded><![CDATA[<p>ActionScript no soporta herencia múltiple, si alguna vez te has visto en una situación en la que te hubiera gustado que así fuera es muy posible que hayas llegado a algún recurso donde se explica lo que es el patrón de diseño <strong><a href="http://es.wikipedia.org/wiki/Decorator_(patr%C3%B3n_de_dise%C3%B1o)">Decorator</a></strong> o, porque no, que lo hayas implementado sin saber que tenía un nombre.</p>
<p>Un Decorator es una clase con la que se puede ejecutar funcionalidad de varias clases a la vez. Si se utiliza bien es equivalente a disponer de herencia múltiple pero sin los dolores de cabeza que ésta conlleva.<br />
La idea básicamente pasa por componer una clase con funcionalidad de otra mediante la instanciación de ésta y la implementación de todos sus métodos.</p>
<p>Un ejemplo básico ( dedicado a mi suegra que escribe con las dos manos! ) para ilustrar una implementación:</p>
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showCodeTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Diestro<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaDerecha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Zurdo<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaIzquierda<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// ésta es la implementación de Decorator</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Ambidiestro <span style="color: #0066CC;">extends</span> Diestro<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> zurdo:Zurdo = <span style="color: #000000; font-weight: bold;">new</span> Zurdo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaIzquierda<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; zurdo.<span style="color: #006600;">escribeConLaIzquierda</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Aquí podemos claramente que la única forma de que un <code>Ambidiestro</code> pueda escribir con las dos manos es a través de la composición. Esto está bien si queremos adquirir la funcionalidad de un <code>Diestro</code> y de un <code>Zurdo</code> sin más, pero hay un pequeño fallo... podemos tratar a un <code>Ambidiestro</code> como un <code>Diestro</code> porque extiende de <code>Diestro</code>, pero en cambio si queremos tratar a un <code>Ambidiestro</code> como un <code>Zurdo</code> no vamos a poder porque no extiende de <code>Zurdo</code>.<br />
Dicho de otra forma...</p>
<p>podemos hacer:</p>
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showCodeTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> ambidiestroDeDiestro:Diestro = <span style="color: #000000; font-weight: bold;">new</span> AmbiDiestro<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>pero <strong>NO</strong> podemos hacer:</p>
<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showCodeTxt('actionscript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> ambidiestroDeZurdo:Zurdo = <span style="color: #000000; font-weight: bold;">new</span> AmbiDiestro<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Llegados a este punto la solución es utilizar una interfaz.<br />
El ejemplo completo sería este:</p>
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showCodeTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">interface</span> IZurdo<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaIzquierda<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">interface</span> IDiestro<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaDerecha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Diestro <span style="color: #0066CC;">implements</span> IDiestro<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaDerecha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Zurdo <span style="color: #0066CC;">implements</span> IZurdo<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaIzquierda<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// ésta es la implementación de Decorator</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> AmbiDiestro <span style="color: #0066CC;">extends</span> Diestro <span style="color: #0066CC;">implements</span> IZurdo<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> zurdo:Zurdo = <span style="color: #000000; font-weight: bold;">new</span> Zurdo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> escribeConLaIzquierda<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; zurdo.<span style="color: #006600;">escribeConLaIzquierda</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// ahora si, un ambidiestro es un IDiestro y un IZurdo:</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> ambidiestroDeDiestro:IDiestro = <span style="color: #000000; font-weight: bold;">new</span> AmbiDiestro<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ambidiestroDeDiestro.<span style="color: #006600;">escribeConLaDerecha</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> ambidiestroDeZurdo:IZurdo = <span style="color: #000000; font-weight: bold;">new</span> AmbiDiestro<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ambidiestroDeZurdo.<span style="color: #006600;">escribeConLaIzquierda</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora si podemos tratar a un <code>Ambidiestro</code> como un <code>Zurdo</code> y como un <code>Diestro</code> a través de <code>IZurdo</code> e <code>IDiestro</code> respectivamente.</p>
<p>Un ejemplo en la vida real y muy común de una implementación del patrón Decorator es cuando queremos que una clase sea un <code>EventDispatcher</code> cuando ya hereda de otra clase que no lo es. La clase <code>mx.rpc.AbstractService</code> de Flex es un ejemplo de ello. Esta clase extiende de <code>flash.utils.Proxy</code>, que no es un <code>EventDispatcher</code> y mediante composición de una instancia de <code>EventDispatcher</code> e implementando la interfaz <code>flash.events.IEventDispatcher</code> pasa a ser un <code>EventDispatcher</code> en toda regla.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joangarnet.com/blog/?feed=rss2&amp;p=439</wfw:commentRss>
		</item>
	</channel>
</rss>
