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

<channel>
	<title>Yet Another [À Compléter] &#187; Design</title>
	<atom:link href="http://blog.neteril.org/category/programming/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.neteril.org</link>
	<description>Random thoughts of Jérémie Laval</description>
	<lastBuildDate>Mon, 19 Jul 2010 17:12:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Retour de Prologin x2</title>
		<link>http://blog.neteril.org/2008/05/18/retour-de-prologin-x2/</link>
		<comments>http://blog.neteril.org/2008/05/18/retour-de-prologin-x2/#comments</comments>
		<pubDate>Sun, 18 May 2008 19:57:55 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[French]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[finale]]></category>
		<category><![CDATA[paris]]></category>
		<category><![CDATA[prologin]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/?p=182</guid>
		<description><![CDATA[<p>Et voilà. Dimanche dernier c&#8217;est conclu l&#8217;édition 2008 de <a href="http://www.prologin.org">Prologin</a> qui fut également ma première participation à ce concours. Comment décrire ce long week-end ? 2 idées, je pense, suffisent : éprouvant physiquement et incroyablement fun (ha&#8230; et aussi, très diététique <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ). Chapeau bas aux organisateurs pour avoir eu la force de supporter ~90 geeks en mode hard-coding pendant ces 4 jours <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>Cette année la finale portait comme d&#8217;habitude sur un sujet d&#8217;IA. Apparemment on a été bien gâté puisqu&#8217;on a eu droit à un serveur de jeu *presque* sans bug ( <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) et des outils de test vraiment super (miam le launcher graphique). Le sujet complet sera probablement proposé sur le site plus tard mais en attendant voici la trame générale : chaque joueur contrôlait 3 hamsters sur une carte composé de case pouvant représentée une surface, un obstacle ou un trou. Sur certaines cases étaient disposés des pommes (je vous passe les détails cosmiques sur le pourquoi du comment du couple hamster-pomme) et le but était, bien entendu, de les ramener dans son camp (les deux lignes du haut de la carte). Bien sur il y&#8217;avait plus à faire que du simple pathfinding. Les hamsters était, entre autre, muni de grappin et pouvait projeter des trognons de pomme (stock limité) aux hamsters ennemis. Il était également possible de composer une stratégie pour faire coopérer les hamsters sur le passage d&#8217;une tranchée (assemblage de case trou) soit pour aller plus vite, soit parce que c&#8217;était la seule possibilité d&#8217;aller chercher des pommes (ce qui donnait lieu à des cartes tordus). La partie la plus dure de l&#8217;exercice était que, à chaque tour de jeu, on devait donner trois ordres à chacun de nos trois hamsters ce qui nécessitait de deviner les coups que pouvait réaliser l&#8217;adversaire pour nous barrer la route.</p>
<p>Au départ ma stratégie était d&#8217;aller chercher un stock de pomme suffisant pour gagner puis de le défendre farouchement contre l&#8217;adversaire mais, malgré les 36h, je n&#8217;ai pas pu mené la deuxième partie à bien. C&#8217;est pourquoi mon IA s&#8217;est borné à aller chercher les pommes de la meilleure manière possible. Néanmoins je suis assez satisfait de certains passage comme la détection des collisions et le système général de décision (bon, même si ca a été codé à l&#8217;arrache, je l&#8217;avoue). D&#8217;ailleurs, sur le point entre parenthèse, je précise que, comme on pouvait s&#8217;en douter, je n&#8217;ai pas eu accès à C# pendant la finale (bouh C++). Le point positif c&#8217;est que maintenant je peux cracher sur C++ en étant crédible <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  . Néanmoins je place beaucoup d&#8217;espoir sur la présence de C# à la prochaine édition vu que ça avait l&#8217;air de marcher pas trop mal sur le site d&#8217;entraînement (et que j&#8217;ai vu resortir un orga avec un livre C# sous le bras à la fin :-° ).</p>
<p> Pour conclure je dirai que j&#8217;ai été très heureux de participer, à la fois pour le plaisir de pousser mes limites mais également pour (re-)rencontrer des gens intéressants (folks de #sdz et les gens présent à Strasbourg). Notons également la bonne bouffe et le superbe tee-shirt (principe du &laquo;&nbsp;coding for the cotton&nbsp;&raquo; en application ici <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) .</p>
<p>Les <a href="http://www.prologin.org/archives/album.php?dir=Prologin%202008%2FFinale">photos</a> ont commencé à arriver sur le site et on devrait bientôt les avoir toutes disponibles ainsi que les résultats finaux dans quelques semaines.</p>
<p>PS: Ha et j&#8217;ai aussi atterri 3ème du concours de Poker organisé pendant la finale, poker qui a encore donné lieu à d&#8217;autres super moments. Merci à l&#8217;orga-maitre de jeu pour les parties endiablés <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>PS²: Avant de clore le billet, une petite pensée pour O&#8217;Reilly France, sponsor de Prologin, qui décidé de fermer juste après la fin de la finale. C&#8217;est une grande perte pour la littérature informatique française.</p>
]]></description>
			<content:encoded><![CDATA[<p>Et voilà. Dimanche dernier c&#8217;est conclu l&#8217;édition 2008 de <a href="http://www.prologin.org">Prologin</a> qui fut également ma première participation à ce concours. Comment décrire ce long week-end ? 2 idées, je pense, suffisent : éprouvant physiquement et incroyablement fun (ha&#8230; et aussi, très diététique <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ). Chapeau bas aux organisateurs pour avoir eu la force de supporter ~90 geeks en mode hard-coding pendant ces 4 jours <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>Cette année la finale portait comme d&#8217;habitude sur un sujet d&#8217;IA. Apparemment on a été bien gâté puisqu&#8217;on a eu droit à un serveur de jeu *presque* sans bug ( <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) et des outils de test vraiment super (miam le launcher graphique). Le sujet complet sera probablement proposé sur le site plus tard mais en attendant voici la trame générale : chaque joueur contrôlait 3 hamsters sur une carte composé de case pouvant représentée une surface, un obstacle ou un trou. Sur certaines cases étaient disposés des pommes (je vous passe les détails cosmiques sur le pourquoi du comment du couple hamster-pomme) et le but était, bien entendu, de les ramener dans son camp (les deux lignes du haut de la carte). Bien sur il y&#8217;avait plus à faire que du simple pathfinding. Les hamsters était, entre autre, muni de grappin et pouvait projeter des trognons de pomme (stock limité) aux hamsters ennemis. Il était également possible de composer une stratégie pour faire coopérer les hamsters sur le passage d&#8217;une tranchée (assemblage de case trou) soit pour aller plus vite, soit parce que c&#8217;était la seule possibilité d&#8217;aller chercher des pommes (ce qui donnait lieu à des cartes tordus). La partie la plus dure de l&#8217;exercice était que, à chaque tour de jeu, on devait donner trois ordres à chacun de nos trois hamsters ce qui nécessitait de deviner les coups que pouvait réaliser l&#8217;adversaire pour nous barrer la route.</p>
<p>Au départ ma stratégie était d&#8217;aller chercher un stock de pomme suffisant pour gagner puis de le défendre farouchement contre l&#8217;adversaire mais, malgré les 36h, je n&#8217;ai pas pu mené la deuxième partie à bien. C&#8217;est pourquoi mon IA s&#8217;est borné à aller chercher les pommes de la meilleure manière possible. Néanmoins je suis assez satisfait de certains passage comme la détection des collisions et le système général de décision (bon, même si ca a été codé à l&#8217;arrache, je l&#8217;avoue). D&#8217;ailleurs, sur le point entre parenthèse, je précise que, comme on pouvait s&#8217;en douter, je n&#8217;ai pas eu accès à C# pendant la finale (bouh C++). Le point positif c&#8217;est que maintenant je peux cracher sur C++ en étant crédible <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  . Néanmoins je place beaucoup d&#8217;espoir sur la présence de C# à la prochaine édition vu que ça avait l&#8217;air de marcher pas trop mal sur le site d&#8217;entraînement (et que j&#8217;ai vu resortir un orga avec un livre C# sous le bras à la fin :-° ).</p>
<p> Pour conclure je dirai que j&#8217;ai été très heureux de participer, à la fois pour le plaisir de pousser mes limites mais également pour (re-)rencontrer des gens intéressants (folks de #sdz et les gens présent à Strasbourg). Notons également la bonne bouffe et le superbe tee-shirt (principe du &laquo;&nbsp;coding for the cotton&nbsp;&raquo; en application ici <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) .</p>
<p>Les <a href="http://www.prologin.org/archives/album.php?dir=Prologin%202008%2FFinale">photos</a> ont commencé à arriver sur le site et on devrait bientôt les avoir toutes disponibles ainsi que les résultats finaux dans quelques semaines.</p>
<p>PS: Ha et j&#8217;ai aussi atterri 3ème du concours de Poker organisé pendant la finale, poker qui a encore donné lieu à d&#8217;autres super moments. Merci à l&#8217;orga-maitre de jeu pour les parties endiablés <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>PS²: Avant de clore le billet, une petite pensée pour O&#8217;Reilly France, sponsor de Prologin, qui décidé de fermer juste après la fin de la finale. C&#8217;est une grande perte pour la littérature informatique française.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2008/05/18/retour-de-prologin-x2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# vs. Python</title>
		<link>http://blog.neteril.org/2008/02/12/c-vs-python/</link>
		<comments>http://blog.neteril.org/2008/02/12/c-vs-python/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 12:36:04 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/?p=143</guid>
		<description><![CDATA[<p>That post isn&#8217;t a in-depth comparison of the two languages because it would require lot of time and, in the end, I don&#8217;t find that sort of thing particularly pertinent. It&#8217;s just a side-by-side presentation of the same script, written in both languages, assorted with my &laquo;&nbsp;it&#8217;s just my opinion&nbsp;&raquo;-type of comments.</p>
<p>Without further introduction, here is the Python version :</p>
<pre class="brush: python;">#!/usr/bin/env python

import dbus, gobject, dbus.glib

NICK = &quot;Kiri&quot;
CHAN = &quot;#riverotte&quot;

bus = dbus.SessionBus()

obj = bus.get_object(&quot;im.pidgin.purple.PurpleService&quot;, &quot;/im/pidgin/purple/PurpleObject&quot;)
purple = dbus.Interface(obj, &quot;im.pidgin.purple.PurpleInterface&quot;)

obj = bus.get_object (&quot;org.xchat.service&quot;, &quot;/org/xchat/Remote&quot;)
xchat = dbus.Interface(obj, &quot;org.xchat.plugin&quot;)

away = False

def statuschangementCallback(acctID, old, new):
	global away
	cur_status = purple.PurpleSavedstatusGetCurrent()
	message = purple.PurpleSavedstatusGetMessage(cur_status)

	if (purple.PurpleSavedstatusIsIdleaway() == 1):
		message = &quot;aw&quot;

	message = message.replace(&quot; &quot;, &quot;_&quot;)
	if (len(message) &gt; 8):
		return
	serv_id = xchat.FindContext(&quot;&quot;, CHAN)
	xchat.SetContext(serv_id)
	xchat.Command(&quot;nick &quot;+NICK+&quot;`&quot;+message)
	if (purple.PurpleSavedstatusGetType(cur_status) == 5):
		xchat.Command(&quot;away&quot;)
		away = True
	elif (away):
		xchat.Command(&quot;back&quot;)
		away = False

bus.add_signal_receiver(statuschangementCallback, dbus_interface=&quot;im.pidgin.purple.PurpleInterface&quot;, signal_name=&quot;AccountStatusChanged&quot;)

gobject.MainLoop().run()</pre>
<p>And here is the C# version :</p>
<p>using System;<br />
using GLib;<br />
using NDesk.DBus;</p>
<p>[Interface("im.pidgin.purple.PurpleInterface")]<br />
public interface PurpleInterface<br />
{<br />
	int PurpleSavedstatusIsIdleaway();<br />
	int PurpleSavedstatusGetCurrent();<br />
	string PurpleSavedstatusGetMessage(int status);<br />
	int PurpleSavedstatusGetType(int status);<br />
	event StatusChangedEventHandler AccountStatusChanged;<br />
}</p>
<p>[Interface("org.xchat.plugin")]<br />
public interface XChatInterface<br />
{<br />
	uint FindContext(string serv, string channel);<br />
	void SetContext(uint cont);<br />
	void Command(string cmd);<br />
}</p>
<p>public delegate void StatusChangedEventHandler();</p>
<p>class Plugin<br />
{<br />
	const string Nick = &laquo;&nbsp;Kiri&nbsp;&raquo;;<br />
	const string Chan = &laquo;&nbsp;#riverotte&nbsp;&raquo;;</p>
<p>	static bool away;</p>
<p>	public static void Main()<br />
	{<br />
		MainLoop ml = new MainLoop();<br />
		BusG.Init();</p>
<p>		XChatInterface xchat = Bus.Session.GetObject<xchatInterface>(&laquo;&nbsp;org.xchat.service&nbsp;&raquo;, new ObjectPath(&laquo;&nbsp;/org/xchat/Remote&nbsp;&raquo;));<br />
		PurpleInterface purple = Bus.Session.GetObject
<purpleInterface>(&laquo;&nbsp;im.pidgin.purple.PurpleService&nbsp;&raquo;, new ObjectPath(&laquo;&nbsp;/im/pidgin/purple/PurpleObject&nbsp;&raquo;));</p>
<p>		purple.AccountStatusChanged += delegate {<br />
			int cur_status = purple.PurpleSavedstatusGetCurrent();<br />
			string message = purple.PurpleSavedstatusGetMessage(cur_status);</p>
<p>			if (purple.PurpleSavedstatusIsIdleaway() == 1) {<br />
				message = &laquo;&nbsp;aw&nbsp;&raquo;;<br />
			}</p>
<p>			message = message.Replace(&nbsp;&raquo; &laquo;&nbsp;, &laquo;&nbsp;_&nbsp;&raquo;);<br />
			if (message.Length > <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> 				return;</p>
<p>			xchat.SetContext(xchat.FindContext(&laquo;&nbsp;&nbsp;&raquo;, Chan));<br />
			xchat.Command(&laquo;&nbsp;nick &nbsp;&raquo; + Nick + &laquo;&nbsp;`&nbsp;&raquo; + message);</p>
<p>			if (purple.PurpleSavedstatusGetType(cur_status) == 5) {<br />
				xchat.Command(&laquo;&nbsp;away&nbsp;&raquo;);<br />
				away = true;<br />
			} else if (away) {<br />
				xchat.Command(&laquo;&nbsp;back&nbsp;&raquo;);<br />
				away = false;<br />
			}<br />
		};</p>
<p>		ml.Run();<br />
	}<br />
}</p>
<h2>Preliminary</h2>
<p>First of all, one may find that the Python code is shorter. But if you remove the boilerplate code (the interfaces and delegate), which could be both autogenerated with a future release of <a href="http://www.ndesk.org/DBusExplorer">D-Bus Explorer</a> anyway (ad inside <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), the overhead is about 3-4 lines ({ } included). So no real advantage there.</p>
<h2>Readability != Conciseness</h2>
<p>Now for readability. Python has always been praised for being concise and all. Why do I say &#8216;concise&#8217; there ? Because IMHO conciseness and readability aren&#8217;t the same things at all.</p>
<p>When friends show me a OCaml sexy hack, the first thing I reply is &laquo;&nbsp;and what does it do ?&nbsp;&raquo;. Don&#8217;t mistake me, I don&#8217;t use OCaml that much and sure these things come with habit, but nonetheless, I&#8217;m not completely alien to the programming style and, even with that knowledge, I can&#8217;t tell what a &laquo;&nbsp;concise&nbsp;&raquo; 20 lines OCaml program do. You can call me dumbass but I&#8217;m pretty sure I&#8217;m not the only one in this case. Anyway, all of this to illustrate that, at least for some people (which I&#8217;m part of), these two concepts of readability and conciseness are not equivalent.</p>
<p>Returning to our matter, I think the previous story illustrate the case of the C# example. Indeed, it may not be shorter at first sight but (and I&#8217;m convinced about that) even if you never programmed in C#, you know, with a quick glance, <strong>what</strong> it does. Verbosity is not a bad thing if it&#8217;s not extreme (read, VB). Complain about that in comments, with arguments, if you disagree.</p>
<p>Of course, it can hold true for the Python snippet too. This first part was just to clear the idea that conciseness ⇔ readability.</p>
<h2>Tackling the binding problems</h2>
<p>Now there is another important aspect to take care (in my sense) : <em>language integration</em>. I won&#8217;t talk about the &#8216;global away&#8217; line and the inherent block semantic which I find strange in a &laquo;&nbsp;Python is the C programmer best friend&nbsp;&raquo; context as it&#8217;s more a personal preference. However, since we are talking about C, I just can&#8217;t see the design difference between the Python snippet and an equivalent C one coded with libdbus so what&#8217;s the advantage to use Python over C for D-Bus ? In fact, what I want to point out is that having binding is good and all, but, IMHO, having <b>integrated</b> binding is better. What do I mean by integrated ? Well, look at the C# code and you will see several things which make Managed D-Bus &laquo;&nbsp;integrated&nbsp;&raquo; compared to dbus-python :</p>
<ul>
<li>Real polymorphism with interface and genericity (What GetObject is doing ? I don&#8217;t care, I have my interface definition for reference purpose).</li>
<li>No dbus.Interface, everything is handled thanks to attribute and reflection.</li>
<li>Integrated events, not a silly bus.add_signal_receiver() C-ism.</li>
</ul>
<p>All of that allow D-Bus specific calls to blend more nicely in the rest of the application. To the contrary, I often see Python scripts which look more like a patchwork of different paradigm and convention style.</p>
<p>Having an interface-based way to access DBus&#8217; methods also provides type safety (provided that you don&#8217;t <a href="http://www.natulte.net/index.php/blog/524">fight with your keyboard</a> or that you use the kind of autogenerating tool I described before) and I&#8217;m pretty sure your computer <a href="http://xkcd.com/371/">who-doesn&#8217;t-like-runtime-error</a> will also be happier. And with a tool like <a href="http://www.ndesk.org/DBusExplorer">D-Bus Explorer</a> you don&#8217;t have to search tons of docs for type informations (still ad inside).</p>
<p>This last point is more debatable since it touches the more general philosophy of dynamic typing against static typing. My general stance on that is that, even if dynamic typing simplifies the process of writing the first code, it&#8217;s very damageable at the end for several points (which are also valid in our test case) :</p>
<ul>
<li>Type information is &laquo;&nbsp;volatile&nbsp;&raquo; meaning that, even if you know what that function of yours is supposed to return when you write it down, chances are that you will have to re-read the whole thing (or check the doc, or take a look at the unit testsn or something else time-consuming) later to remember what it does because, well, time and coffee do their job. Whereas in static typing langage, if the API is well made and if you have some sort of auto-completion, you can pretty most always deduce things from the full prototype.</li>
<li>Continuing from point 1, it&#8217;s even worse for those guys who have to understand what you did before writing their own code.</li>
<li>It&#8217;s not robust by default : you have to write unit tests to make sure no one is going to screw that part of the code with type mismatch (who said shortness ?).</li>
</ul>
<h2>Conclusion</h2>
<p>So, to conclude, even if this post looks like a monologue against Python, it&#8217;s not. I understand Python advantages over traditional typed language and, as the first script shows, I even use it to test my ideas. What I wanted to highlight is that I consider Python *not* suited to large applications where several people have to collaborate (especially if there are no strong policy or rigor inside the team). Python as a powerful Bash replacement, yes. Python as a nice framework for testing and prototyping ideas, good, why not. Python as en embeddable scripting language, sure, it&#8217;s made for that in a sense.  But Python for a large and maintainable application ? No, not for me.</p>
<p>NB: this post is what some might call a (badly hidden) troll. Instead of that, I would like to present this post as an invitation to discuss in comments, so feel free to drop your thoughts.</p>
]]></description>
			<content:encoded><![CDATA[<p>That post isn&#8217;t a in-depth comparison of the two languages because it would require lot of time and, in the end, I don&#8217;t find that sort of thing particularly pertinent. It&#8217;s just a side-by-side presentation of the same script, written in both languages, assorted with my &laquo;&nbsp;it&#8217;s just my opinion&nbsp;&raquo;-type of comments.</p>
<p>Without further introduction, here is the Python version :</p>
<pre class="brush: python;">#!/usr/bin/env python

import dbus, gobject, dbus.glib

NICK = &quot;Kiri&quot;
CHAN = &quot;#riverotte&quot;

bus = dbus.SessionBus()

obj = bus.get_object(&quot;im.pidgin.purple.PurpleService&quot;, &quot;/im/pidgin/purple/PurpleObject&quot;)
purple = dbus.Interface(obj, &quot;im.pidgin.purple.PurpleInterface&quot;)

obj = bus.get_object (&quot;org.xchat.service&quot;, &quot;/org/xchat/Remote&quot;)
xchat = dbus.Interface(obj, &quot;org.xchat.plugin&quot;)

away = False

def statuschangementCallback(acctID, old, new):
	global away
	cur_status = purple.PurpleSavedstatusGetCurrent()
	message = purple.PurpleSavedstatusGetMessage(cur_status)

	if (purple.PurpleSavedstatusIsIdleaway() == 1):
		message = &quot;aw&quot;

	message = message.replace(&quot; &quot;, &quot;_&quot;)
	if (len(message) &gt; 8):
		return
	serv_id = xchat.FindContext(&quot;&quot;, CHAN)
	xchat.SetContext(serv_id)
	xchat.Command(&quot;nick &quot;+NICK+&quot;`&quot;+message)
	if (purple.PurpleSavedstatusGetType(cur_status) == 5):
		xchat.Command(&quot;away&quot;)
		away = True
	elif (away):
		xchat.Command(&quot;back&quot;)
		away = False

bus.add_signal_receiver(statuschangementCallback, dbus_interface=&quot;im.pidgin.purple.PurpleInterface&quot;, signal_name=&quot;AccountStatusChanged&quot;)

gobject.MainLoop().run()</pre>
<p>And here is the C# version :</p>
<p>using System;<br />
using GLib;<br />
using NDesk.DBus;</p>
<p>[Interface("im.pidgin.purple.PurpleInterface")]<br />
public interface PurpleInterface<br />
{<br />
	int PurpleSavedstatusIsIdleaway();<br />
	int PurpleSavedstatusGetCurrent();<br />
	string PurpleSavedstatusGetMessage(int status);<br />
	int PurpleSavedstatusGetType(int status);<br />
	event StatusChangedEventHandler AccountStatusChanged;<br />
}</p>
<p>[Interface("org.xchat.plugin")]<br />
public interface XChatInterface<br />
{<br />
	uint FindContext(string serv, string channel);<br />
	void SetContext(uint cont);<br />
	void Command(string cmd);<br />
}</p>
<p>public delegate void StatusChangedEventHandler();</p>
<p>class Plugin<br />
{<br />
	const string Nick = &laquo;&nbsp;Kiri&nbsp;&raquo;;<br />
	const string Chan = &laquo;&nbsp;#riverotte&nbsp;&raquo;;</p>
<p>	static bool away;</p>
<p>	public static void Main()<br />
	{<br />
		MainLoop ml = new MainLoop();<br />
		BusG.Init();</p>
<p>		XChatInterface xchat = Bus.Session.GetObject<xchatInterface>(&laquo;&nbsp;org.xchat.service&nbsp;&raquo;, new ObjectPath(&laquo;&nbsp;/org/xchat/Remote&nbsp;&raquo;));<br />
		PurpleInterface purple = Bus.Session.GetObject
<purpleInterface>(&laquo;&nbsp;im.pidgin.purple.PurpleService&nbsp;&raquo;, new ObjectPath(&laquo;&nbsp;/im/pidgin/purple/PurpleObject&nbsp;&raquo;));</p>
<p>		purple.AccountStatusChanged += delegate {<br />
			int cur_status = purple.PurpleSavedstatusGetCurrent();<br />
			string message = purple.PurpleSavedstatusGetMessage(cur_status);</p>
<p>			if (purple.PurpleSavedstatusIsIdleaway() == 1) {<br />
				message = &laquo;&nbsp;aw&nbsp;&raquo;;<br />
			}</p>
<p>			message = message.Replace(&nbsp;&raquo; &laquo;&nbsp;, &laquo;&nbsp;_&nbsp;&raquo;);<br />
			if (message.Length > <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> 				return;</p>
<p>			xchat.SetContext(xchat.FindContext(&laquo;&nbsp;&nbsp;&raquo;, Chan));<br />
			xchat.Command(&laquo;&nbsp;nick &nbsp;&raquo; + Nick + &laquo;&nbsp;`&nbsp;&raquo; + message);</p>
<p>			if (purple.PurpleSavedstatusGetType(cur_status) == 5) {<br />
				xchat.Command(&laquo;&nbsp;away&nbsp;&raquo;);<br />
				away = true;<br />
			} else if (away) {<br />
				xchat.Command(&laquo;&nbsp;back&nbsp;&raquo;);<br />
				away = false;<br />
			}<br />
		};</p>
<p>		ml.Run();<br />
	}<br />
}</p>
<h2>Preliminary</h2>
<p>First of all, one may find that the Python code is shorter. But if you remove the boilerplate code (the interfaces and delegate), which could be both autogenerated with a future release of <a href="http://www.ndesk.org/DBusExplorer">D-Bus Explorer</a> anyway (ad inside <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), the overhead is about 3-4 lines ({ } included). So no real advantage there.</p>
<h2>Readability != Conciseness</h2>
<p>Now for readability. Python has always been praised for being concise and all. Why do I say &#8216;concise&#8217; there ? Because IMHO conciseness and readability aren&#8217;t the same things at all.</p>
<p>When friends show me a OCaml sexy hack, the first thing I reply is &laquo;&nbsp;and what does it do ?&nbsp;&raquo;. Don&#8217;t mistake me, I don&#8217;t use OCaml that much and sure these things come with habit, but nonetheless, I&#8217;m not completely alien to the programming style and, even with that knowledge, I can&#8217;t tell what a &laquo;&nbsp;concise&nbsp;&raquo; 20 lines OCaml program do. You can call me dumbass but I&#8217;m pretty sure I&#8217;m not the only one in this case. Anyway, all of this to illustrate that, at least for some people (which I&#8217;m part of), these two concepts of readability and conciseness are not equivalent.</p>
<p>Returning to our matter, I think the previous story illustrate the case of the C# example. Indeed, it may not be shorter at first sight but (and I&#8217;m convinced about that) even if you never programmed in C#, you know, with a quick glance, <strong>what</strong> it does. Verbosity is not a bad thing if it&#8217;s not extreme (read, VB). Complain about that in comments, with arguments, if you disagree.</p>
<p>Of course, it can hold true for the Python snippet too. This first part was just to clear the idea that conciseness ⇔ readability.</p>
<h2>Tackling the binding problems</h2>
<p>Now there is another important aspect to take care (in my sense) : <em>language integration</em>. I won&#8217;t talk about the &#8216;global away&#8217; line and the inherent block semantic which I find strange in a &laquo;&nbsp;Python is the C programmer best friend&nbsp;&raquo; context as it&#8217;s more a personal preference. However, since we are talking about C, I just can&#8217;t see the design difference between the Python snippet and an equivalent C one coded with libdbus so what&#8217;s the advantage to use Python over C for D-Bus ? In fact, what I want to point out is that having binding is good and all, but, IMHO, having <b>integrated</b> binding is better. What do I mean by integrated ? Well, look at the C# code and you will see several things which make Managed D-Bus &laquo;&nbsp;integrated&nbsp;&raquo; compared to dbus-python :</p>
<ul>
<li>Real polymorphism with interface and genericity (What GetObject is doing ? I don&#8217;t care, I have my interface definition for reference purpose).</li>
<li>No dbus.Interface, everything is handled thanks to attribute and reflection.</li>
<li>Integrated events, not a silly bus.add_signal_receiver() C-ism.</li>
</ul>
<p>All of that allow D-Bus specific calls to blend more nicely in the rest of the application. To the contrary, I often see Python scripts which look more like a patchwork of different paradigm and convention style.</p>
<p>Having an interface-based way to access DBus&#8217; methods also provides type safety (provided that you don&#8217;t <a href="http://www.natulte.net/index.php/blog/524">fight with your keyboard</a> or that you use the kind of autogenerating tool I described before) and I&#8217;m pretty sure your computer <a href="http://xkcd.com/371/">who-doesn&#8217;t-like-runtime-error</a> will also be happier. And with a tool like <a href="http://www.ndesk.org/DBusExplorer">D-Bus Explorer</a> you don&#8217;t have to search tons of docs for type informations (still ad inside).</p>
<p>This last point is more debatable since it touches the more general philosophy of dynamic typing against static typing. My general stance on that is that, even if dynamic typing simplifies the process of writing the first code, it&#8217;s very damageable at the end for several points (which are also valid in our test case) :</p>
<ul>
<li>Type information is &laquo;&nbsp;volatile&nbsp;&raquo; meaning that, even if you know what that function of yours is supposed to return when you write it down, chances are that you will have to re-read the whole thing (or check the doc, or take a look at the unit testsn or something else time-consuming) later to remember what it does because, well, time and coffee do their job. Whereas in static typing langage, if the API is well made and if you have some sort of auto-completion, you can pretty most always deduce things from the full prototype.</li>
<li>Continuing from point 1, it&#8217;s even worse for those guys who have to understand what you did before writing their own code.</li>
<li>It&#8217;s not robust by default : you have to write unit tests to make sure no one is going to screw that part of the code with type mismatch (who said shortness ?).</li>
</ul>
<h2>Conclusion</h2>
<p>So, to conclude, even if this post looks like a monologue against Python, it&#8217;s not. I understand Python advantages over traditional typed language and, as the first script shows, I even use it to test my ideas. What I wanted to highlight is that I consider Python *not* suited to large applications where several people have to collaborate (especially if there are no strong policy or rigor inside the team). Python as a powerful Bash replacement, yes. Python as a nice framework for testing and prototyping ideas, good, why not. Python as en embeddable scripting language, sure, it&#8217;s made for that in a sense.  But Python for a large and maintainable application ? No, not for me.</p>
<p>NB: this post is what some might call a (badly hidden) troll. Instead of that, I would like to present this post as an invitation to discuss in comments, so feel free to drop your thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2008/02/12/c-vs-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Anonymous methods make elegant proxies</title>
		<link>http://blog.neteril.org/2007/08/25/anonymous-methods-make-elegant-proxies/</link>
		<comments>http://blog.neteril.org/2007/08/25/anonymous-methods-make-elegant-proxies/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 18:02:49 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/2007/08/25/anonymous-methods-make-elegant-proxies/</guid>
		<description><![CDATA[<p>Just stumbled on that fact some times ago.</p>
<p>Well at first some background, with C# 2.0 appeared a new usage of the keyword <strong>delegate</strong> in form of anonymous functions or <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">closure</a> (although they aren&#8217;t really new in themselves).</p>
<p>One of the most useful feature of anonymous method is the concept of &#8216;variable capture&#8217; but even though it proves useful here it&#8217;s not the main part of the pattern.</p>
<p>Together with this C# 2.0&#8242;s anonymous method feature, the compiler also get enhanced to allow delegate type inference for variable and parameter. Indeed before C# 2.0 you had to explicitly initialize a delegate in order to use it :</p>
<pre class="brush: csharp;">
private delegate void Func(int someInt);
Func func = new Func(MyMethod);
</pre>
<p>With C# 2.0 this dummy syntax is removed and one can write the more concise :</p>
<pre class="brush: csharp;">
private delegate void Func(int someInt);
Func func = MyMethod;
</pre>
<p>But what this had to do with our subject ? Well you may know it or not but when you create anonymous method using only the <strong>delegate</strong> keyword (i.e. without any definition of parameters) the compiler automatically adapt the signature of the anonymous method to the underlying delegate. In other word it&#8217;s a cheap way to make Proxy (where Proxy refers to <a href="http://en.wikipedia.org/wiki/Proxy_pattern">the design pattern</a> that might be described as : &laquo;&nbsp;Providing an interface to a class which doesn&#8217;t implement it natively&nbsp;&raquo;).</p>
<p>How can we use this feature then ? Say you want to run a method on a dedicated thread (like the target toolkit&#8217;s mainloop in Circ) then this method (that we will call StartPresentation) might want some information to initialize the presentation like, for example, a reference to the main controller, the title for the Window etc&#8230; (which used to be the case in previous version of Circ).</p>
<p>Problem : the Thread class allow only a method which signature correspond to the ThreadStart delegate (defined as <em>public delegate void ThreadStart();</em>) in its constructor. Unfortunately, in our case, it doesn&#8217;t correspond the signature of our StartPresentation method. Nonetheless, thanks to some <strong>delegate</strong> magic, you can circumvent this limitation with this pattern :</p>
<pre class="brush: csharp;">
public void InitializePresentation()
{
    // Well usually the MainControl isn't defined
    // there but it shows closure's ability to
    // capture outer variables
    MainControl ctrl = new MainControl();
    Thread thread = new Thread(delegate {
            StartPresentation(ctrl, &quot;Window's Title);
    });
    thread.Start();
}
</pre>
<p>And here you go ! The anonymous method signature is automatically mapped to the one of the ThreadStart&#8217;s delegate by the compiler without any developer intervention.</p>
]]></description>
			<content:encoded><![CDATA[<p>Just stumbled on that fact some times ago.</p>
<p>Well at first some background, with C# 2.0 appeared a new usage of the keyword <strong>delegate</strong> in form of anonymous functions or <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">closure</a> (although they aren&#8217;t really new in themselves).</p>
<p>One of the most useful feature of anonymous method is the concept of &#8216;variable capture&#8217; but even though it proves useful here it&#8217;s not the main part of the pattern.</p>
<p>Together with this C# 2.0&#8242;s anonymous method feature, the compiler also get enhanced to allow delegate type inference for variable and parameter. Indeed before C# 2.0 you had to explicitly initialize a delegate in order to use it :</p>
<pre class="brush: csharp;">
private delegate void Func(int someInt);
Func func = new Func(MyMethod);
</pre>
<p>With C# 2.0 this dummy syntax is removed and one can write the more concise :</p>
<pre class="brush: csharp;">
private delegate void Func(int someInt);
Func func = MyMethod;
</pre>
<p>But what this had to do with our subject ? Well you may know it or not but when you create anonymous method using only the <strong>delegate</strong> keyword (i.e. without any definition of parameters) the compiler automatically adapt the signature of the anonymous method to the underlying delegate. In other word it&#8217;s a cheap way to make Proxy (where Proxy refers to <a href="http://en.wikipedia.org/wiki/Proxy_pattern">the design pattern</a> that might be described as : &laquo;&nbsp;Providing an interface to a class which doesn&#8217;t implement it natively&nbsp;&raquo;).</p>
<p>How can we use this feature then ? Say you want to run a method on a dedicated thread (like the target toolkit&#8217;s mainloop in Circ) then this method (that we will call StartPresentation) might want some information to initialize the presentation like, for example, a reference to the main controller, the title for the Window etc&#8230; (which used to be the case in previous version of Circ).</p>
<p>Problem : the Thread class allow only a method which signature correspond to the ThreadStart delegate (defined as <em>public delegate void ThreadStart();</em>) in its constructor. Unfortunately, in our case, it doesn&#8217;t correspond the signature of our StartPresentation method. Nonetheless, thanks to some <strong>delegate</strong> magic, you can circumvent this limitation with this pattern :</p>
<pre class="brush: csharp;">
public void InitializePresentation()
{
    // Well usually the MainControl isn't defined
    // there but it shows closure's ability to
    // capture outer variables
    MainControl ctrl = new MainControl();
    Thread thread = new Thread(delegate {
            StartPresentation(ctrl, &quot;Window's Title);
    });
    thread.Start();
}
</pre>
<p>And here you go ! The anonymous method signature is automatically mapped to the one of the ThreadStart&#8217;s delegate by the compiler without any developer intervention.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2007/08/25/anonymous-methods-make-elegant-proxies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mono.Xna&#039;s follow up</title>
		<link>http://blog.neteril.org/2007/04/23/monoxnas-follow-up/</link>
		<comments>http://blog.neteril.org/2007/04/23/monoxnas-follow-up/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 18:30:19 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Mono.Xna]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/2007/04/23/monoxnas-follow-up/</guid>
		<description><![CDATA[<p>Hey I don&#8217;t know why I wouldn&#8217;t also blog about Mono.Xna since things there are also moving on.</p>
<p>So as Miguel said <a href="http://tirania.org/blog/archive/2007/Apr-22.html">on his blog</a>, Mono.Xna is now &laquo;&nbsp;mature&nbsp;&raquo; enough to run Rob&#8217;s Pong. </p>
<p>As the &nbsp;&raquo; &nbsp;&raquo; suggests, I&#8217;m not comfortable anymore with the idea that Mono.Xna is getting more and more mature. In fact it&#8217;s totally the contrary : I&#8217;m more and more suspicious towards Mono.Xna. Even though there are great people behind it (Antti, Alan, David Hudson&#8230;) the project lack a consistence IMHO. Still now I don&#8217;t really know who is the &laquo;&nbsp;Game Master&nbsp;&raquo; behind Mono.Xna nor did I see the skeleton of a real organization behind it. Actually Mono.Xna appears to me more like a big mess than a shiny piece of code. Things are quickly (doesn&#8217;t influence the patch length though <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )&nbsp; hacked upon the stubs without a common talk or a design plan from the team. What I fear is that all this work will ultimately result in nothing because of its crappiness (writing unit tests isn&#8217;t sufficient). Maybe at some point we will be able to just stop the &laquo;&nbsp;hackers folly&nbsp;&raquo;, design a correct infrastructure and fork the existing code where possible in the new design.</p>
<p>For the moment things are still easy because SDL.NET helps a lot (I&#8217;m still unconvinced that tying Mono.Xna so deeply in SDL.NET is a good idea but that&#8217;s another matter). But things will get exponentially harder when the Content Pipeline, for example, will need to be implemented.</p>
]]></description>
			<content:encoded><![CDATA[<p>Hey I don&#8217;t know why I wouldn&#8217;t also blog about Mono.Xna since things there are also moving on.</p>
<p>So as Miguel said <a href="http://tirania.org/blog/archive/2007/Apr-22.html">on his blog</a>, Mono.Xna is now &laquo;&nbsp;mature&nbsp;&raquo; enough to run Rob&#8217;s Pong. </p>
<p>As the &nbsp;&raquo; &nbsp;&raquo; suggests, I&#8217;m not comfortable anymore with the idea that Mono.Xna is getting more and more mature. In fact it&#8217;s totally the contrary : I&#8217;m more and more suspicious towards Mono.Xna. Even though there are great people behind it (Antti, Alan, David Hudson&#8230;) the project lack a consistence IMHO. Still now I don&#8217;t really know who is the &laquo;&nbsp;Game Master&nbsp;&raquo; behind Mono.Xna nor did I see the skeleton of a real organization behind it. Actually Mono.Xna appears to me more like a big mess than a shiny piece of code. Things are quickly (doesn&#8217;t influence the patch length though <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )&nbsp; hacked upon the stubs without a common talk or a design plan from the team. What I fear is that all this work will ultimately result in nothing because of its crappiness (writing unit tests isn&#8217;t sufficient). Maybe at some point we will be able to just stop the &laquo;&nbsp;hackers folly&nbsp;&raquo;, design a correct infrastructure and fork the existing code where possible in the new design.</p>
<p>For the moment things are still easy because SDL.NET helps a lot (I&#8217;m still unconvinced that tying Mono.Xna so deeply in SDL.NET is a good idea but that&#8217;s another matter). But things will get exponentially harder when the Content Pipeline, for example, will need to be implemented.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2007/04/23/monoxnas-follow-up/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Circ&#039;s followup</title>
		<link>http://blog.neteril.org/2007/04/23/circs-followup/</link>
		<comments>http://blog.neteril.org/2007/04/23/circs-followup/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 18:18:59 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Circ]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/2007/04/23/circs-followup/</guid>
		<description><![CDATA[<p>I have done a little more work on Circ. First of all I added the missing LGPL headers in the main git branch. I have also refractored a little the Presentation part doing a UI redesign of the GTK# frontend. In fact I&#8217;m redesigning it to follow as closely as possible the <a href="http://developer.gnome.org/projects/gup/hig/2.0/">Gnome HIG</a>.</p>
<p>Reading the HIG made me realize that today, with all this 3D interfaces buzz, things are getting a lot less accessible for people who suffers from some deficiency. That&#8217;s why I want to implement some stuff from <a href="http://www.go-mono.com/docs/index.aspx?tlink=5@N%3aAtk">ATK</a> in order to provide maximum accessibility for these people who deserve to be able to communicate on IRC like any other geek. I may also use <a href="http://en.wikipedia.org/wiki/AT-SPI">AT-SPI</a> but the main interface to it seems to be only Corbra/Bonobo ATM which is far from being efficient in C# code even though there is apparently some work to get a D-Bus binding which would be better and simpler for me to implement.</p>
<p>Definitely, I think that Accessibility must be one of the key feature of Circ. Integrating libcontrast in contrast was already a smallish step towards that goal but there is more work to be done before telling that Circ is accessible.</p>
]]></description>
			<content:encoded><![CDATA[<p>I have done a little more work on Circ. First of all I added the missing LGPL headers in the main git branch. I have also refractored a little the Presentation part doing a UI redesign of the GTK# frontend. In fact I&#8217;m redesigning it to follow as closely as possible the <a href="http://developer.gnome.org/projects/gup/hig/2.0/">Gnome HIG</a>.</p>
<p>Reading the HIG made me realize that today, with all this 3D interfaces buzz, things are getting a lot less accessible for people who suffers from some deficiency. That&#8217;s why I want to implement some stuff from <a href="http://www.go-mono.com/docs/index.aspx?tlink=5@N%3aAtk">ATK</a> in order to provide maximum accessibility for these people who deserve to be able to communicate on IRC like any other geek. I may also use <a href="http://en.wikipedia.org/wiki/AT-SPI">AT-SPI</a> but the main interface to it seems to be only Corbra/Bonobo ATM which is far from being efficient in C# code even though there is apparently some work to get a D-Bus binding which would be better and simpler for me to implement.</p>
<p>Definitely, I think that Accessibility must be one of the key feature of Circ. Integrating libcontrast in contrast was already a smallish step towards that goal but there is more work to be done before telling that Circ is accessible.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2007/04/23/circs-followup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toying with Dia: what CirC will look like</title>
		<link>http://blog.neteril.org/2007/03/01/toying-with-dia-what-circ-will-look-like/</link>
		<comments>http://blog.neteril.org/2007/03/01/toying-with-dia-what-circ-will-look-like/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 09:58:45 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Circ]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[SharpWidgets]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/2007/03/01/toying-with-dia-what-circ-will-look-like/</guid>
		<description><![CDATA[<p>As I was a little bored today I decided to draw on Dia the sketch I had already made on a paper that describes the architecture of CirC and how everything fit together, so here it is (click on it to see it fullsize) :</p>
<p><a href="http://netherilshade.free.fr/Modele.png"><img src="http://netherilshade.free.fr/Modele.png" alt="Circ" align="middle" height="222" width="500" /></a></p>
]]></description>
			<content:encoded><![CDATA[<p>As I was a little bored today I decided to draw on Dia the sketch I had already made on a paper that describes the architecture of CirC and how everything fit together, so here it is (click on it to see it fullsize) :</p>
<p><a href="http://netherilshade.free.fr/Modele.png"><img src="http://netherilshade.free.fr/Modele.png" alt="Circ" align="middle" height="222" width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2007/03/01/toying-with-dia-what-circ-will-look-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dia, un modéliseur UML simple et efficace</title>
		<link>http://blog.neteril.org/2007/02/05/dia-un-modeliseur-uml-simple-et-efficace/</link>
		<comments>http://blog.neteril.org/2007/02/05/dia-un-modeliseur-uml-simple-et-efficace/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 19:30:27 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/2007/02/05/dia-un-modeliseur-uml-simple-et-efficace/</guid>
		<description><![CDATA[<p>J&#8217;ai récemment (re)découvert <a href="http://live.gnome.org/Dia">Dia</a>, un éditeur de diagramme sous Linux écrit avec le toolkit GTK. Il fait apparemment très bien les diagrammes classiques mais ce n&#8217;est pas pour ça que je l&#8217;utilise. En effet la particularité de la bestiole est de proposer un module pour faire de l&#8217;UML <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Pour ceux qui ne connaissent pas UML (Unified Modeling Language) vous pouvez allez voir <a href="http://fr.wikipedia.org/wiki/Unified_Modeling_Language">Wikipédia</a>), basiquement UML est un langage de modélisation objet qui organise les classes comme des rectangles reliés entre eux par des flèches qui représentent différente relations qu&#8217;on retrouve en POO (héritage, agrégation&#8230;). Son utilisation intervient dans ce qu&#8217;on nomme l&#8217;étape de design qui situe bien avant le codage pur et dur. Son but ? Permettre de tester des idées via un support écrit normalisé et à la fin de la période de design avoir une hiérarchie de classe clair et net. La plupart du temps le code de base est ensuite généré à partir du graphe UML final.</p>
<p>Les IDE comme Visual ou Borland Turbo propose des modules pour faire de l&#8217;UML et ainsi assuré une forte relation entre le design et le coding. Sous Linux cependant l&#8217;éditeur qui est de facto standard (Monodevelop) ne propose pas d&#8217;éditer directement de l&#8217;UML (je crois me souvenir de quelque qui s&#8217;appelait MonoUML mais ça a du tomber aux oubliettes). Pour en revenir à Dia je l&#8217;ai utilisé afin de remettre a plat quelques idées que j&#8217;avais pour Circ et j&#8217;avoue que je trouve l&#8217;utilisation très agréable même si a priori il n&#8217;est pas fait pour ça à la base (a contrario <a href="http://argouml.tigris.org/">ArgoUML</a> m&#8217;a rebuté presque instantanément <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>Les avantages de Dia à mon sens sont : indépendance du langage de prog sous-jacent (sous ArgoUML on est quasiment obligé d&#8217;utiliser des Java-ismes), les options d&#8217;export du diagramme (même si le module SVG merde un peu chez moi <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ), la possibilité d&#8217;écrire des générateurs de code (il n&#8217;y en a pas encore pour C# mais pourquoi pas un jour <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) et globalement l&#8217;utilisation intuitive et rapide (Gnome powaaa <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ).</p>
]]></description>
			<content:encoded><![CDATA[<p>J&#8217;ai récemment (re)découvert <a href="http://live.gnome.org/Dia">Dia</a>, un éditeur de diagramme sous Linux écrit avec le toolkit GTK. Il fait apparemment très bien les diagrammes classiques mais ce n&#8217;est pas pour ça que je l&#8217;utilise. En effet la particularité de la bestiole est de proposer un module pour faire de l&#8217;UML <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Pour ceux qui ne connaissent pas UML (Unified Modeling Language) vous pouvez allez voir <a href="http://fr.wikipedia.org/wiki/Unified_Modeling_Language">Wikipédia</a>), basiquement UML est un langage de modélisation objet qui organise les classes comme des rectangles reliés entre eux par des flèches qui représentent différente relations qu&#8217;on retrouve en POO (héritage, agrégation&#8230;). Son utilisation intervient dans ce qu&#8217;on nomme l&#8217;étape de design qui situe bien avant le codage pur et dur. Son but ? Permettre de tester des idées via un support écrit normalisé et à la fin de la période de design avoir une hiérarchie de classe clair et net. La plupart du temps le code de base est ensuite généré à partir du graphe UML final.</p>
<p>Les IDE comme Visual ou Borland Turbo propose des modules pour faire de l&#8217;UML et ainsi assuré une forte relation entre le design et le coding. Sous Linux cependant l&#8217;éditeur qui est de facto standard (Monodevelop) ne propose pas d&#8217;éditer directement de l&#8217;UML (je crois me souvenir de quelque qui s&#8217;appelait MonoUML mais ça a du tomber aux oubliettes). Pour en revenir à Dia je l&#8217;ai utilisé afin de remettre a plat quelques idées que j&#8217;avais pour Circ et j&#8217;avoue que je trouve l&#8217;utilisation très agréable même si a priori il n&#8217;est pas fait pour ça à la base (a contrario <a href="http://argouml.tigris.org/">ArgoUML</a> m&#8217;a rebuté presque instantanément <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>Les avantages de Dia à mon sens sont : indépendance du langage de prog sous-jacent (sous ArgoUML on est quasiment obligé d&#8217;utiliser des Java-ismes), les options d&#8217;export du diagramme (même si le module SVG merde un peu chez moi <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ), la possibilité d&#8217;écrire des générateurs de code (il n&#8217;y en a pas encore pour C# mais pourquoi pas un jour <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) et globalement l&#8217;utilisation intuitive et rapide (Gnome powaaa <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2007/02/05/dia-un-modeliseur-uml-simple-et-efficace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
