<?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>Scala-fr</title>
	<atom:link href="http://www.scala-fr.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scala-fr.org</link>
	<description>communauté francophone autour du langage Scala</description>
	<lastBuildDate>Sat, 10 Oct 2009 08:01:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Popularité de Scala (2/2) (TIOBE)</title>
		<link>http://www.scala-fr.org/popularite-de-scala-tiobe/</link>
		<comments>http://www.scala-fr.org/popularite-de-scala-tiobe/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 21:52:43 +0000</pubDate>
		<dc:creator>Laurent Mallet</dc:creator>
				<category><![CDATA[Méta]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=187</guid>
		<description><![CDATA[Après une analyse dans un précédent article réalisée avec l&#8217;aide de Google Trends et Job Trends, il peut être judicieux d&#8217;étudier les résultats du TIOBE Software Index de septembre 2009 pour en déduire quelques tendances sur Scala:

Scala est 32ème de ce classement avec 0.238%;
Scala est toute de même devant Erlang et Haskell;
Scala est devant groovy [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fpopularite-de-scala-tiobe%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fpopularite-de-scala-tiobe%2F" height="61" width="51" /></a></div><p>Après une analyse <a title="Google Trends" href="http://www.scala-fr.org/popularite-de-scala/">dans un précédent article</a> réalisée avec l&#8217;aide de <a href="http://www.google.com/trends">Google Trends</a> et <a href="http://www.indeed.com/jobtrends">Job Trends</a>, il peut être judicieux d&#8217;étudier les résultats du <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE Software Index de septembre 2009</a> pour en déduire quelques tendances sur Scala:</p>
<ul>
<li>Scala est 32ème de ce classement avec 0.238%;</li>
<li>Scala est toute de même devant Erlang et Haskell;</li>
<li>Scala est devant groovy et clojure;</li>
<li>Ruby et Python sont loin devant (jruby et jpython sont inclus dans Ruby et Python);</li>
<li>Java est premier;</li>
</ul>
<p>Autre élément intéressant, les langages fonctionnels ont le vent en poupe avec une progression de 0.7% par rapport à 2008. Le typage dynamique ou statique n&#8217;a quant à lui quasiment pas évolué.</p>
<p>Historique de Scala dans TIOBE:</p>
<ul>
<li>2004 : Scala n&#8217;apparait pas;</li>
<li>2005 : Scala apparait entre la 50 et la 100ème place ( resultat &lt; 0,07%)</li>
<li>2006 : Scala entre la 50 et la 100ème place (langage fonctionnel 1% et langages typés statiques  65%)</li>
<li>2007 : toujours entre 50 et 100 (langage fonctionnel 0.9% et langages typés statiques 59%)</li>
<li>jan 2008 : Scala 45ème avec 0.1% (langage fonctionnel 1.8% et langages typés statiques 57%)</li>
<li>aujourd&#8217;hui Scala 32ème avec 0.238% (langage fonctionnel 2.9% et langages typés statiques 58%)</li>
</ul>
<p>Lentement mais surement Scala progresse.</p>
<p>Détails :</p>
<ul>
<li><a title="TIOBE Index" href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE Programming community Index </a>(September 2009);</li>
</ul>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/popularite-de-scala-tiobe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complétion maven pour zsh</title>
		<link>http://www.scala-fr.org/completion-maven-pour-zsh/</link>
		<comments>http://www.scala-fr.org/completion-maven-pour-zsh/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 13:12:07 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Compilation]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[outils]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=172</guid>
		<description><![CDATA[A ma grande déception zsh ne complète pas la commande maven. A force de taper des commandes mvn qqhcose, j&#8217;en avais assez, j&#8217;ai donc fait un petit script pour compléter les commandes que j&#8217;utilise le plus souvent avec maven et le plugin Scala :

function mainClasses &#123;
    if &#91; -d ./src &#93; ; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fcompletion-maven-pour-zsh%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fcompletion-maven-pour-zsh%2F" height="61" width="51" /></a></div><p>A ma grande déception zsh ne complète pas la commande maven. A force de taper des commandes <code>mvn qqhcose</code>, j&#8217;en avais assez, j&#8217;ai donc fait un petit script pour compléter les commandes que j&#8217;utilise le plus souvent avec maven et le plugin Scala :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> mainClasses <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> .<span style="color: #000000; font-weight: bold;">/</span>src <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>main <span style="color: #660033;">-type</span> f <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.scala&quot;</span>  <span style="color: #660033;">-o</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.java&quot;</span> \
             <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s?.*src/main/[^/]*/\(.*\)\..*?-DmainClass=\1?'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s+/+.+g'</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> mainTests <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> .<span style="color: #000000; font-weight: bold;">/</span>src <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*test*.scala&quot;</span>  <span style="color: #660033;">-o</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*test*.java&quot;</span>  \
             <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s?.*src/test/[^/]*/\(.*\)\..*?-Dtest=\1?'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s+/+.+g'</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> listMavenCompletions <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">reply</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>archetype:generate compile clean package <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #7a0874; font-weight: bold;">test</span>
    test-compile deploy release scala:run scala:<span style="color: #c20cb9; font-weight: bold;">cc</span>
    -Dmaven.test.skip=<span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #660033;">-DarchetypeCatalog</span>=http:<span style="color: #000000; font-weight: bold;">//</span>www.scala-tools.org<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #000000; font-weight: bold;">`</span>mainClasses<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">`</span>mainTests<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #660033;">-q</span> <span style="color: #660033;">-o</span>
    <span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
compctl <span style="color: #660033;">-K</span> listMavenCompletions mvn<span style="color: #000000; font-weight: bold;">%</span></pre></div></div>

<p>Le script n&#8217;est pas idéal mais il permet de compléter les commandes que j&#8217;utilise le plus souvent mais aussi les <code>-Dtest=</code> et <code>-DmainClass=</code> automatiquement en listant les fichiers de l&#8217;arborescence de votre projet. L&#8217;ideal serait d&#8217;avoir une option dans maven pour lister les commandes disponibles, mais ça n&#8217;existe pas à ma connaissance.</p>
<p>Si vous utilisez d&#8217;autres commandes maven, ajouter les dans la liste <code>reply</code> (séparer par des espaces ou saut de lignes).</p>
<p>Vous pouvez copier ce script dans votre <code>~/.zshrc</code>.</p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/completion-maven-pour-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interêt du Type Symbol en Scala</title>
		<link>http://www.scala-fr.org/interet-du-type-symbol-en-scala/</link>
		<comments>http://www.scala-fr.org/interet-du-type-symbol-en-scala/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 21:25:44 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[symbol]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=160</guid>
		<description><![CDATA[Présentation du type Symbol
La classe Symbol est une classe de la bibliothèque standard du langage Scala. Il permet de façon simple de créer un objet unique pour une chaîne de caractères donnée. La comparaison de 2 symbols est une simple comparaison de références. On dit que l&#8217;objet est interné.
Pour simplifier son usage, le compilateur Scala [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Finteret-du-type-symbol-en-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Finteret-du-type-symbol-en-scala%2F" height="61" width="51" /></a></div><h1>Présentation du type <code>Symbol</code></h1>
<p>La classe <code><a href="http://www.scala-lang.org/docu/files/api/scala/Symbol.html">Symbol</a></code> est une classe de la bibliothèque standard du langage Scala. Il permet de façon simple de créer un objet unique pour une chaîne de caractères donnée. La comparaison de 2 <code>symbols</code> est une simple comparaison de références. On dit que l&#8217;objet est interné.</p>
<p>Pour simplifier son usage, le compilateur Scala reconnait l&#8217;instanciation d&#8217;un Symbol pour tous les identifiants préfixés par un simple quote <code>'</code>.</p>
<p>Exemple d&#8217;utilisation :</p>

<div class="wp_syntax"><div class="code"><pre class="scala" style="font-family:monospace;">Symbol<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;test&quot;</span><span style="color: #F78811;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #6666FF;">'test</span></pre></div></div>

<h1>Interêt</h1>
<p>Les symbols sont des éléments indispensable pour un langage tel Lisp qui les utilise pour représenter toutes sortes d&#8217;objet : classe, méthodes, variables, etc&#8230; Lisp permet de mélanger code et donnée de façon totalement transparente et des manipuler les uns ou les autres de la même manière. En Lisp, Les symbols sont aussi utilisés par exemple pour imiter des énumérations.</p>
<p>En Scala il est impossible d&#8217;utiliser les symbols pour <em>identifier</em> une méthode par exemple (comme ce que l&#8217;on ferait en Lisp). Les symbols perdent donc pas mal de leur interêt&#8230;</p>
<p>On pourrait se dire qu&#8217;en utilisant des symbols comme identifiants, on peut gagner de la place par rapport à des chaînes de caractères, mais alors pourquoi ne pas utiliser directement un <code>enum</code>, ou dans des cas plus évolué une <code>case class</code> ? C&#8217;est peut être intéressant pour gagner du temps, cela évite de déclarer un <code>enum</code>. Ou bien une utilisation dans une table de hashage comme identifiants à la place de <code>string</code>, mais là encore même chose, les <code>strings</code> litérales (cad définies via le biais de double quote, <code>"ma chaine"</code>) sont internées (voir suite de l&#8217;article) et donc cela ne prend pas plus de mémoire et les comparaisons sont aussi rapides.</p>
<p>Et surtout si vous trouvez un avantage majeur à utiliser les Symbols, postez un commentaire, je suis curieux de trouver un vrai cas d&#8217;utilisation.</p>
<h1>Exemple décompilé</h1>
<p>La suite de l&#8217;article s&#8217;adresse à ceux qui cherchent à voir en détails ce qui se passe dans la machine virtuelle.  Le but est de comprendre comment est représenté une <em>string litteral</em> comment le compilateur les interne.</p>
<p>Source d&#8217;un exemple tout simple en scala</p>

<div class="wp_syntax"><div class="code"><pre class="scala" style="font-family:monospace;"><span style="color: #0000ff; font-weight: bold;">class</span> SymbolTest <span style="color: #F78811;">&#123;</span>
    <span style="color: #0000ff; font-weight: bold;">def</span> run <span style="color: #000080;">=</span> <span style="color: #F78811;">&#123;</span>
        <span style="color: #6666FF;">&quot;test&quot;</span> <span style="color: #000080;">==</span> <span style="color: #6666FF;">&quot;test&quot;</span>
    <span style="color: #F78811;">&#125;</span>
<span style="color: #F78811;">&#125;</span></pre></div></div>

<p>Décompilation avec la commande <code>javap</code></p>
<pre>$ javap -c -verbose scalafr.StringTest</pre>
<p>Cette commande produit la sortie suivante (j&#8217;ai supprimé les lignes qui ne sont pas pertinentes à la démonstration) :</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #339933;">//</span> Pool de constantes
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">7</span> = Asciz	java<span style="color: #339933;">/</span>lang<span style="color: #339933;">/</span>Object<span style="color: #666666; font-style: italic;">;</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">8</span> = class	#<span style="color: #0000ff;">7</span><span style="color: #666666; font-style: italic;">;	//  java/lang/Object</span>
<span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">13</span> = Asciz	<span style="color: #00007f; font-weight: bold;">test</span><span style="color: #666666; font-style: italic;">;</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">14</span> = String	#<span style="color: #0000ff;">13</span><span style="color: #666666; font-style: italic;">;	//  test</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">15</span> = Asciz	equals<span style="color: #666666; font-style: italic;">;</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">16</span> = Asciz	<span style="color: #009900; font-weight: bold;">&#40;</span>Ljava<span style="color: #339933;">/</span>lang<span style="color: #339933;">/</span>Object<span style="color: #666666; font-style: italic;">;)Z;</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">17</span> = NameAndType	#<span style="color: #0000ff;">15</span><span style="color: #339933;">:</span>#<span style="color: #0000ff;">16</span><span style="color: #666666; font-style: italic;">;//  equals:(Ljava/lang/Object;)Z</span>
<span style="color: #000000; font-weight: bold;">const</span> #<span style="color: #0000ff;">18</span> = Method	#<span style="color: #0000ff;">8.</span>#<span style="color: #0000ff;">17</span><span style="color: #666666; font-style: italic;">;	//  java/lang/Object.equals:(Ljava/lang/Object;)Z</span>
<span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #009900; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">public</span> scalafr<span style="color: #339933;">.</span>StringTest<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;">;</span>
<span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #339933;">//</span> <span style="color: #000000; font-weight: bold;">Code</span> de la méthode run<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> boolean run<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;">;</span>
  <span style="color: #000000; font-weight: bold;">Code</span><span style="color: #339933;">:</span>
   <span style="color: #0000ff;">0</span><span style="color: #339933;">:</span>	ldc	#<span style="color: #0000ff;">14</span><span style="color: #666666; font-style: italic;">; //String test</span>
   <span style="color: #0000ff;">2</span><span style="color: #339933;">:</span>	ldc	#<span style="color: #0000ff;">14</span><span style="color: #666666; font-style: italic;">; //String test</span>
   <span style="color: #0000ff;">4</span><span style="color: #339933;">:</span>	astore_1
   <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span>
   <span style="color: #0000ff;">17</span><span style="color: #339933;">:</span>	aload_1
   <span style="color: #0000ff;">18</span><span style="color: #339933;">:</span>	invokevirtual	#<span style="color: #0000ff;">18</span><span style="color: #666666; font-style: italic;">; //Method java/lang/Object.equals:(Ljava/lang/Object;)Z</span>
   <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #339933;">...</span><span style="color: #009900; font-weight: bold;">&#93;</span></pre></div></div>

<p>La commande <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc8.html#ldc">ldc</a> prend une référence du <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73272">pool de constantes</a> et la pose sur la pile d&#8217;opérande. Le pool de constantes est représenté au dessus du code, <code>ldc #14</code>va chercher <code>const #14</code> et la pose sur la pile. La ligne 18 invoque la méthode réprésenté par #18 (dans ce cas, java.lang.Object.equals()) en utilisant les 2 derniers éléments posés sur la pile (les <code>ldc</code> des lignes 19 et 20. On remarque que ces deux <code>ldc</code> charge la même réference de constante : #14 qui représente la chaîne de caractère &laquo;&nbsp;test&nbsp;&raquo;, c&#8217;est ça l&#8217;internement de string litérales.</p>
<p>Pour aller plus loin :</p>
<ul>
<li><a href="http://chable.developpez.com/tutoriel/java/binaire/">Comprendre le binaire Java</a></li>
<li><a href="http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html">The Java Virtual Machine Specification</a></li>
</ul>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/interet-du-type-symbol-en-scala/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Initialiser un nouveau projet Scala avec Maven 2</title>
		<link>http://www.scala-fr.org/initialiser-un-nouveau-projet-scala-avec-maven-2/</link>
		<comments>http://www.scala-fr.org/initialiser-un-nouveau-projet-scala-avec-maven-2/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 16:25:36 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Compilation]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=121</guid>
		<description><![CDATA[Introduction
Dans un précédent article, nous vous présentions sbt. Cette fois nous allons voir comment gérer un projet Scala avec maven.
Le plus simple, c&#8217;est de démarrer de zéro, et d&#8217;initialiser un projet en utilisant un archetype prédéfini. Cet archetype est un template de projet qui contient le minimum pour démarrer :

La structure de répertoire de projet
Le [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Finitialiser-un-nouveau-projet-scala-avec-maven-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Finitialiser-un-nouveau-projet-scala-avec-maven-2%2F" height="61" width="51" /></a></div><h1>Introduction</h1>
<p>Dans un <a href="http://www.scala-fr.org/sbt-scala-build-tool-ou-comment-compiler-son-projet-scala/">précédent article</a>, nous vous présentions sbt. Cette fois nous allons voir comment gérer un projet Scala avec <code>maven</code>.</p>
<p>Le plus simple, c&#8217;est de démarrer de zéro, et d&#8217;initialiser un projet en utilisant un archetype prédéfini. Cet archetype est un template de projet qui contient le minimum pour démarrer :</p>
<ul>
<li>La structure de répertoire de projet</li>
<li>Le pom.xml</li>
<li>Des fichiers sources quasiment vide (un main(), et un test pour scala-archetype-simple)</li>
</ul>
<h1>Initialisation d&#8217;un projet</h1>
<p>Pour l&#8217;initialisation d&#8217;un projet nous allons utiliser le plugin maven archetype (disponible dans le repository officiel de maven). Nous allons passer en paramètre de ce plugin, un lien vers une liste d&#8217;archetype : scala-tools (pour le moment, seul site à proposer des archetypes pour Scala).</p>
<pre>$ mvn archetype:generate -DarchetypeCatalog=http://scala-tools.org
    [...]
    Choose archetype:
    1: http://scala-tools.org -> scala-archetype-simple (A simple scala project)
    2: http://scala-tools.org -> lift-archetype-blank (A blank/empty liftweb project)
    3: http://scala-tools.org -> lift-archetype-basic (A basic liftweb project (with DB, css, ...))
    Choose a number:  (1/2/3): 1
</pre>
<p>Le plugin va ensuite vous posez quelques questions pour générer le pom.xml. Sélectionner le projet scala de base (1) à moins que vous soihaitiez faire du <a href="http://liftweb.net/">lift</a>.</p>
<p>Le projet ainsi initialisé contient déjà quelques dépendances et quelques plugins pratiques pour une bonne gestion d&#8217;un projet Scala :</p>
<ul>
<li>Un lien vers le repository maven de bibliothèques et de plugins Scala-tools: <a href="http://scala-tools.org/repo-releases">http://scala-tools.org/repo-releases</a></li>
<li>Une dépendance vers jUnit</li>
<li>Une dépendance vers <a href="http://code.google.com/p/specs/">specs</a></li>
<li>Le plugin <a href="http://www.scala-tools.org/mvnsites/maven-scala-plugin/">maven-scala-plugin</a></li>
</ul>
<h1>Quelques actions de maven-scala-plugin</h1>
<p>Les <em>goal</em> maven classiques sont biensûr fonctionnels (compile, package, release, &#8230;).</p>
<p>Le goal scala, propose différentes actions notamment :</p>
<ul>
<li>
<p>Lancer une application</p>
<pre>$ mvn scala:run -DmainClass=org.example.MyClass
</pre>
</li>
<li>
<p>Générer la documentation de l&#8217;API</p>
<pre>$ mvn scala:doc
</pre>
</li>
<li>
<p>Lancer le mode compilation continue (lance une boucle infinie qui compile toutes les sources qui sont sauvegardées, très pratique si vous développez avec un éditeur de texte simple type emacs ou vi)</p>
<pre>$ mvn scala:cc
</pre>
</li>
</ul>
<p><em>Note pour les utilisateurs d&#8217;emacs</em> : vous pouvez passer en compilation-mode avec <a href="http://vastusutra.blogspot.com/2007/06/getting-emacs-and-maven-2-to-play.html">cette astuce pour lancer maven</a>, puis lancer <code>mvn scala:cc</code>, je vous conseil aussi d&#8217;ajouter cette ligne dans votre .emacs.el : <code>(setq compilation-scroll-output t)</code> pour enclencher le scrolling automatique de la fenetre de compilation. Avec ça (et les ctags pour la complétion), vous pouvez jeter Eclipse et NetBeans <img src='http://www.scala-fr.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Vous pouvez aussi utiliser le flymake-mode beaucoup plus pratique mais malheuresement un peu lent à cause de l&#8217;utilisation de maven en arrière plan.</p>
<p>Je n&#8217;ai rien contre Eclipse ou Netbeans, mais mon process emacs ne dépasse jamais 30Mo de RAM et il ne s&#8217;arrête pas inopinément.</p>
<p>Plus de détails sur la page de <a href="http://www.scala-tools.org/mvnsites/maven-scala-plugin/usage.html">documentation de maven-scala-plugin</a>.</p>
<h1>Ajouter des dépendances</h1>
<p>C&#8217;est du maven classique. Pour ajouter une dépendance, éditer votre fichier <code>pom.xml</code> et ajouter les groupId / artifactId / version dont vous avez besoin dans <code>project->dependencies</code>. Si je veux par exemple ajouter la dépendance vers scalacheck, il me suffit d&#8217;ajouter :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
[...] 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.scala-tools.testing<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>scalacheck<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
[...]
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Note : ScalaCheck est disponible sur le repository maven scala-tools (ajouté par défaut à l&#8217;initiation du projet avec l&#8217;archetype scala-archetype-simple).</p>
<h1>Démonstration</h1>
<p>Une démonstration de l&#8217;utilisation de mvn dans emacs, en utilisant <code>mvn archetype:generate</code> pour initialiser un projet exemple.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/M9sFtoFzl3w&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/M9sFtoFzl3w&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/initialiser-un-nouveau-projet-scala-avec-maven-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sbt : Scala Build Tool ou comment compiler son projet Scala</title>
		<link>http://www.scala-fr.org/sbt-scala-build-tool-ou-comment-compiler-son-projet-scala/</link>
		<comments>http://www.scala-fr.org/sbt-scala-build-tool-ou-comment-compiler-son-projet-scala/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 16:50:34 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Compilation]]></category>
		<category><![CDATA[sbt]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=116</guid>
		<description><![CDATA[Introduction
sbt signifie Scala Build Tool. Encore un outils de compilation ? ant, maven ne suffisent pas ?
sbt se veut non intrusif : vous pouvez l&#8217;utiliser sans modifier la disposition de votre projet, uniquement en modifiant un descripteur (ce descripteur est écrit en Scala, un peu comme scons pour Python ou rake en Ruby). Pour cela [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fsbt-scala-build-tool-ou-comment-compiler-son-projet-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fsbt-scala-build-tool-ou-comment-compiler-son-projet-scala%2F" height="61" width="51" /></a></div><h1>Introduction</h1>
<p><code>sbt</code> signifie Scala Build Tool. Encore un outils de compilation ? <code>ant</code>, <code>maven</code> ne suffisent pas ?</p>
<p><code>sbt</code> se veut non intrusif : vous pouvez l&#8217;utiliser sans modifier la disposition de votre projet, uniquement en modifiant un descripteur (ce descripteur est écrit en Scala, un peu comme <code>scons</code> pour Python ou <code>rake</code> en Ruby). Pour cela il se base sur le même format de projet que <code>maven</code>.</p>
<pre>src/
  main/
    resources/  # Fichiers à inclure dans le jar principal
    scala/      # Sources Scala
    java/       # Sources Java
  test/
    resources   # Fichiers à inclire dans le jar de test
    scala/      # Sources de Test Scala
    java/       # Sources de Test Java
</pre>
<p>Son principal intérêt est d&#8217;intégrer des outils liés à Scala sans avoir besoin de configurer quoique ce soit:</p>
<ul>
<li>Génération de documentation avec scaladoc.</li>
<li>Tests unitaires avec ScalaTest.</li>
<li>Génération de tests unitaires avec ScalaCheck.</li>
<li>Intégration de specs, framework de <a href="http://fr.wikipedia.org/wiki/Behavior_Driven_Development">behavior driven development</a>.</li>
</ul>
<p>sbt se base sur maven par défaut pour gérer les dépendances.</p>
<h1>Installer sbt</h1>
<p>Malheuresement sbt n&#8217;est pas packagé dans <code>sbaz</code>. Il vous faudra le télécharger et l&#8217;installer à la main.</p>
<p>Pour cela, rien de plus simple, télécharger la dernière version de <em>sbt-launcher.jar</em> sur la <a href="http://code.google.com/p/simple-build-tool/downloads/list">page de téléchargement de sbt</a>.</p>
<p>Puis créer un script shell dans votre PATH, chez moi ça donne ça :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ echo $PATH
/sw/bin:/sw/sbin:/Users/max/dist/sbin
$ wget http://simple-build-tool.googlecode.com/files/sbt-launcher-0.5.4.jar -O /Users/max/dist/sbin/sbt-launcher.jar
$ echo 'java -Xmx512M -jar `dirname $0`/sbt-launcher.jar &quot;$@&quot;' &gt; /Users/max/dist/sbin/sbt
$ chmod +x /Users/max/dist/sbin/sbt</pre></div></div>

<p><code>sbt</code> est installé, vous pouvez le l&#8217;utiliser.</p>
<h1>Utiliser sbt</h1>
<p><code>sbt</code> se lance en mode interactif ou en mode batch. Le mode batch permet de lancer une suite de tâches les unes à la suite des autres. Le mode interactif lance un shell particulier vous permettant de taper des commandes particulières (tâches ou autres).</p>
<p>Lorsque vous lancer <code>sbt</code> dans un répertoire qui ne contient pas les descripteurs, il va vous proposer de créer une structure de projet.</p>
<h2>Créer un projet</h2>
<p>Lancer sbt sans arguments dans le répertoire où vous souhaitez créer votre projet:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ mkdir sbttest
$ sbt
Project does not exist, create new project? (y/N/s) : y
Name: SbtTest
Organization []: scala-fr
Version [1.0]: 
Scala version [2.7.5]: 
sbt version [0.5.3]: 
[...]
[success] Successfully initialized directory structure.</pre></div></div>

<p>Voilà, la structure de projet est créée, voici à quoi elle ressemble : </p>
<pre>$ \tree
|-- lib
|-- project
|   |-- boot
|   |   `-- scala-2.7.5
|   |       |-- lib
|   |       |   |-- scala-compiler.jar
|   |       |   `-- scala-library.jar
|   |       |-- sbt-0.5.3
|   |       |   |-- ivy-2.0.0.jar
|   |       |   |-- jsch-0.1.31.jar
|   |       |   `-- sbt_2.7.5-0.5.3.jar
|   |       `-- update.log
|   `-- build.properties
|-- src
|   |-- main
|   |   |-- resources
|   |   `-- scala
|   `-- test
|       |-- resources
|       `-- scala
`-- target
</pre>
<h2>Mode interactif</h2>
<p>Si vous le lancer sans arguments dans un répertoire projet, il démarre en mode interactif:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbt
[info] Building project xxx 0.1 using XXX
[info]    with sbt 0.4.6 and Scala 2.7.4
[info] No actions specified, interactive session started. Execute 'help' for more information.
&gt;</pre></div></div>

<p>Un shell sbt est ouvert, vous pouvez tapez vos commandes. </p>
<h2>Mode batch</h2>
<p>En mode batch vous lancer directement les tâches (Consulter <a href="http://code.google.com/p/simple-build-tool/wiki/RunningSbt">la liste exhaustive des tâches</a>)</p>
<p>Exemple, je viens d&#8217;écrire du code (un simple <code>println("hey !")</code>dans le fichier <code>src/main/scala/sbttest.scala</code>, je lance la tâche <code>run</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbt run
[info] Building project SbtTest 1.0 using sbt.DefaultProject
[info]    with sbt 0.5.3 and Scala 2.7.5
...
[info] == compile ==
...
[info] == run ==
[info] Running RunSbtTest ...
hey !
...
[info] Total build time: 1 s</pre></div></div>

<p>On s&#8217;aperçoit que la tâche <code>run</code> dépend de la tâche <code>compile</code>, et ça tombe bien <img src='http://www.scala-fr.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Vous venez de compiler et de lancer votre premier projet Scala avec sbt et son projet par défaut (sbt.DefaultProject).</p>
<h1>Conclusion</h1>
<p>Ca sera tout pour cet article, il y a pas mal de possibilités qui n&#8217;ont pas été abordées ici. Elles le seront sûrement un peu plus en détails dans les futurs articles.</p>
<p>En apparence <code>sbt</code> simplifie tout. Pour les projets Scala simple, il sera sûrement parfaitement adapté, mais dès que vous commencez à dévier du chemin classique, ça devient plus complexe et mal documenté; c&#8217;est là que les ennuis commencent.</p>
<p>Même si vous avez l&#8217;habitude, et préférez utiliser maven; si vous êtes développeur Scala, vous aurez sûrement besoin d&#8217;installer sbt pour compiler des projets tiers. Ce sera une bonne occasion pour apprendre quelques commandes, le tester et vous en faire votre opinion.</p>
<p>En savoir plus:</p>
<ul>
<li>Différents modes d&#8217;installation : <a href="http://code.google.com/p/simple-build-tool/wiki/Setup">How to setup sbt</a></li>
<li>Utilisation : <a href="http://code.google.com/p/simple-build-tool/wiki/RunningSbt">Basic usage</a></li>
<li>Aller plus loin dans la mise en place de vos propre option de build: <a href="http://code.google.com/p/simple-build-tool/wiki/BuildConfiguration">Build Configuration</a></li>
</ul>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/sbt-scala-build-tool-ou-comment-compiler-son-projet-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Popularité de Scala (1/2)</title>
		<link>http://www.scala-fr.org/popularite-de-scala/</link>
		<comments>http://www.scala-fr.org/popularite-de-scala/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 14:33:36 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Méta]]></category>
		<category><![CDATA[emploi]]></category>
		<category><![CDATA[popularité]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=103</guid>
		<description><![CDATA[Une question que je me pose en ce moment est de savoir si Scala est populaire, combien de développeurs l&#8217;utilisent au jour le jour, combien d&#8217;employés font du Scala dans leurs entreprises. Est-ce que la tendance grimpe ou tombe ?
Google trends permet de comparer des volumes de recherche sur un ensemble de mot clés. Les [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fpopularite-de-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fpopularite-de-scala%2F" height="61" width="51" /></a></div><p>Une question que je me pose en ce moment est de savoir si Scala est populaire, combien de développeurs l&#8217;utilisent au jour le jour, combien d&#8217;employés font du Scala dans leurs entreprises. Est-ce que la tendance grimpe ou tombe ?</p>
<p>Google trends permet de comparer des volumes de recherche sur un ensemble de mot clés. Les <a href="http://trends.google.com/trends?q=scala+java%2C+jython+java%2C+jruby+java%2C+clojure+java%2C+groovy+java&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0">résultats comparatifs</a> entre les principaux langages de JVM (parmis scala, jython, jrubyn clojure et groovy), donnent groovy en tête et scala en deuxième (le rapport entre groovy et scala est quasiment de 3 en moyenne sur les 12 derniers mois).</p>
<p><img class="alignnone size-full wp-image-104" title="Graphique comparant Scala, Clojure, Jython, Jruby et Groovy" src="http://www.scala-fr.org/wp-content/uploads/2009/09/scala-clojure-jython-jruby-groovy-comparison-chart.png" alt="Graphique comparant Scala, Clojure, Jython, Jruby et Groovy" width="591" height="242" /></p>
<p>D&#8217;après <a href="http://www.scala-lang.org/node/1658">le site officiel</a>, Scala est utilisé chez Twitter, EDF Trading, Siemens pour les plus gros. En ce qui concerne les offres d&#8217;emplois <a href="http://www.indeed.com/jobtrends?q=+jruby%2C+scala%2C+clojure%2C+jython%2C+groovy&amp;l=">jobtrends</a> nous montre que Scala reste très discret par rapport à Jython et Groovy</p>
<p><img class="alignnone size-full wp-image-105" title="scala clojure jython jruby groovy jobtrends comparison chart" src="http://www.scala-fr.org/wp-content/uploads/2009/09/scala-clojure-jython-jruby-groovy-jobtrends-comparison-chart.png" alt="scala clojure jython jruby groovy jobtrends comparison chart" width="571" height="309" /></p>
<p>Je ferais un autre article dans quelques mois pour voir s&#8217;il y a eut du changement.</p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/popularite-de-scala/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>sbaz : Scala Bazaar System, gestionnaire de paquets</title>
		<link>http://www.scala-fr.org/sbaz-scala-bazaar-system-gestionnaire-de-paquets/</link>
		<comments>http://www.scala-fr.org/sbaz-scala-bazaar-system-gestionnaire-de-paquets/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 17:16:16 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Méta]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[sbaz]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=52</guid>
		<description><![CDATA[Introduction
Le Scala Bazaar System, surnommé sbaz, est un gestionnaire de paquets permettant d&#8217;automatiser la tâche de maintenance d&#8217;une installation Scala. Cela permet:

De mettre à jour son installation et les dépendances
D&#8217;installer les bibliothèques enregistrées dans la base et leur dépendances
De partager vos propres bibliothèques

Quelques commandes
Après avoir installé Scala (voir la page télécharger), un environnement de base [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fsbaz-scala-bazaar-system-gestionnaire-de-paquets%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fsbaz-scala-bazaar-system-gestionnaire-de-paquets%2F" height="61" width="51" /></a></div><h1>Introduction</h1>
<p>Le Scala Bazaar System, surnommé <code>sbaz</code>, est un gestionnaire de paquets permettant d&#8217;automatiser la tâche de maintenance d&#8217;une installation Scala. Cela permet:</p>
<ul>
<li>De mettre à jour son installation et les dépendances</li>
<li>D&#8217;installer les bibliothèques enregistrées dans la base et leur dépendances</li>
<li>De partager vos propres bibliothèques</li>
</ul>
<h1>Quelques commandes</h1>
<p>Après avoir installé Scala (voir la page <a href="/telecharger">télécharger</a>), un environnement de base est installé, comprenant scalac (le compilateur Scala), la bibliothèque standard, sbaz et scalap (un inspecteur de fichiers class Scala permettant de lire les fichiers générés par le compilateur scalac). Pour vérifier votre installation vous pouvez taper la commande <code>sbaz installed</code></p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbaz installed
base/1.9
sbaz/1.25tmp
sbaz-setup/1.0
scala/2.7.5.final
scala-devel/2.7.5.final
scala-library/2.7.5.final
scala-tool-support/2.7.5.final
7 packages installed</pre></div></div>

<p><code>sbaz help</code> vous liste les possibilités offertes par sbaz. Parmis les commandes les plus souvent utilisées on trouve :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbaz help
available - list the available packages for installation
[...]
install - install a package
installed - list the packages that are installed
[...]
showuniverse - show the active universe
update - update the list of available packages
upgrade - upgrade all possible packages</pre></div></div>

<p>Par exemple, je viens de trouver <a href="http://code.google.com/p/scalacheck/">ScalaCheck</a>, une bibliothèque permettant de générer des tests unitaires (suivez le blog, un article devrait bientôt arriver à propos de ScalaCheck). Je lance la commande :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbaz available | grep check
scalacheck (1.5, 1.4, 1.3, ...)</pre></div></div>

<p>Parfait ! La bibliothèque est packagée dans scala-dev (l&#8217;univers par défaut), je peux l&#8217;installer directement en faisant :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo sbaz install scalacheck
planning to install: scalacheck/1.5
Installing...</pre></div></div>

<p>Et voilà, je peux maintenant utiliser scalacheck.</p>
<p>Pour mettre à jour son installation Scala, rien de plus simple. Il suffit de :</p>
<ol>
<li>Mettre à jour sa liste de paquets (update)</li>
<li>Mettre à jour sa distribution (upgrade)</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo sbaz update
Updated the list of available packages.
$ sudo sbaz upgrade
Refreshing list of available packages...
Planning to install scala/2.7.6.final...
Planning to install scala-devel/2.7.6.final...
Planning to install scala-library/2.7.6.final...
Planning to install scala-tool-support/2.7.6.final...
Installing...</pre></div></div>

<p>Je viens de passer en version 2.7.6.</p>
<h1>Les univers</h1>
<p>Les univers sont des lieux de dépôts (repository) de paquets. Ils doivent assurer que les dépendances entre les paquets et leurs versions sont consistantes. Chaque installation sbaz est lié à un univers actif duquel les paquets sont téléchargés. Il existe 2 univers officiels :</p>
<ul>
<li><a href="http://scala-webapps.epfl.ch/sbaz/scala-dev">http://scala-webapps.epfl.ch/sbaz/scala-dev</a> qui contient les versions stables de la distribution Scala et des logiciels et bibliothèques tiers. C&#8217;est l&#8217;univers par défaut.</li>
<li><a href="http://scala-webapps.epfl.ch/sbaz/lamp-rc">http://scala-webapps.epfl.ch/sbaz/lamp-rc</a> contient les release candidates de Scala.</li>
</ul>
<p>Pour connaître l&#8217;univers actif de votre installation taper la commande <code>sbaz showuniverse</code></p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sbaz showuniverse
SimpleUniverse &quot;scala-dev&quot; (http://scala-webapps.epfl.ch/sbaz/scala-dev)</pre></div></div>

<p>Dans mon cas, je suis sur la version stable.</p>
<p>Pour changer d&#8217;univers il faut utiliser la commande <code>sbaz setuniverse</code>. Commande à qui il faut donner en paramètre un fichier descripteur qui contient les informations de l&#8217;univers que vous souhaitez rendre actif. J&#8217;aurais aimé pouvoir lui donner directement une URL qui pointe vers ce descripteur, mais ce n&#8217;est à priori pas possible.</p>
<p>Example de fichier descripteur :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;simpleuniverse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>lamp-rc<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    Scala release candidates
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;location<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://scala-webapps.epfl.ch/sbaz/lamp-rc<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/location<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/simpleuniverse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Note : les descripteurs pour scala-dev et lamp-rc sont disponibles dans votre SCALA_HOME ($SCALA_HOME/misc/sbaz/descriptors/lamp-rc et $SCALA_HOME/misc/sbaz/descriptors/scala-dev).</p>
<p>Changement d&#8217;univers vers lamp-rc :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo sbaz setuniverse $SCALA_HOME/misc/sbaz/descriptors/lamp-rc
Password:
Universe established.
$ sbaz available
sudo sbaz available
scala (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-android (2.7.0-RC3, 2.7.0-RC2, 2.7.0-RC1, ...)
scala-cldc (2.7.0-RC3, 2.7.0-RC2, 2.7.0-RC1, ...)
scala-devel (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-devel-docs (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-documentation (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-library (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-msil (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-swing (0.1)
scala-test (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scala-tool-support (2.7.4.RC1, 2.7.3.RC2, 2.7.3.RC1, ...)
scalap (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
12 package names
145 total packages</pre></div></div>

<p>Pour revenir à l&#8217;univers stable:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo sbaz setuniverse $SCALA_HOME/misc/sbaz/descriptors/scala-dev
Password:
Universe established</pre></div></div>

<p>Plus d&#8217;informations sur le <a href="http://www.lexspoon.org/sbaz/">site de sbaz</a>.</p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/sbaz-scala-bazaar-system-gestionnaire-de-paquets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Environnement de développement Scala</title>
		<link>http://www.scala-fr.org/environnement-de-developpement-scala/</link>
		<comments>http://www.scala-fr.org/environnement-de-developpement-scala/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 11:03:22 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[environnement]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=28</guid>
		<description><![CDATA[Il existe des plugins Scala pour les Environnement de Développement Intégrés (IDE) les plus connus :

Plugin Eclipse : C&#8217;est à mon avis la moins mauvaise solution. Eclipse n&#8217;est pas un trop mauvais IDE mais le plugin Scala n&#8217;est pas très stable (complétion de code assez aléatoire).
Plugin NetBeans : Je suis un peu hermétique à NetBeans, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fenvironnement-de-developpement-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fenvironnement-de-developpement-scala%2F" height="61" width="51" /></a></div><p>Il existe des plugins Scala pour les Environnement de Développement Intégrés (IDE) les plus connus :</p>
<ul>
<li><a href="http://www.scala-lang.org/node/94">Plugin Eclipse</a> : C&#8217;est à mon avis la moins mauvaise solution. Eclipse n&#8217;est pas un trop mauvais IDE mais le plugin Scala n&#8217;est pas très stable (complétion de code assez aléatoire).</li>
<li><a href="http://wiki.netbeans.org/Scala">Plugin NetBeans</a> : Je suis un peu hermétique à NetBeans, j&#8217;ai du mal à m&#8217;y mettre, mais objectivement j&#8217;ai l&#8217;impression que le plugin Scala fonctionne mieux que celui d&#8217;Eclipse. Les utilisateurs de NetBeans seront sûrement séduit par cette solution. Vous pouvez suivre son développement sur le <a href="http://blogtrader.net/dcaoyuan/category/NetBeans">blog de Caoyuan</a>.</li>
<li><a href="http://plugins.intellij.net/plugin/?id=1347">Plugin Intellij IDEA</a> : Je n&#8217;ai pas testé mais il a de très mauvaises critiques <a href="http://dibblego.wordpress.com/2008/10/30/intellij-scala-it-is-with-great-regret/">ici</a> et <a href="http://blog.lostlake.org/index.php?/archives/90-IntelliJ-a-huge-dissapointment-for-Scala-development.html">là</a>.</li>
</ul>
<p>Pour ceux qui n&#8217;aiment pas les IDE, il existe des plugins de colorisation de code pour la plupart des éditeurs texte. TextMate et Emacs s&#8217;en sortent un peu mieux en offrant des Snippets (via <a href="http://code.google.com/p/yasnippet/">YASnippet</a> pour Emacs)  permettant de gagner un peu en productivité en laissant l&#8217;éditeur écrire pour soit. Pas de completion de code avancé ni pour l&#8217;un, ni pour l&#8217;autre.</p>
<ul>
<li><a href="http://gestalt.monoid.net/blog/2008/02/new-scala-bundle-for-textmate.html">Bundle TextMate pour Scala</a></li>
<li><a href="http://www.scala-lang.org/node/354">Scala + YASnippet pour Emacs</a></li>
</ul>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/environnement-de-developpement-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World en Scala</title>
		<link>http://www.scala-fr.org/hello-world-en-scala/</link>
		<comments>http://www.scala-fr.org/hello-world-en-scala/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 21:02:38 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[exemple]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=15</guid>
		<description><![CDATA[Un exemple de code Scala très simple:

 object HelloWorld extends Application &#123;
   println&#40;&#34;Hello, world!&#34;&#41;
 &#125;

Quelques détails:

object signifie que l&#8217;on souhaite créer une classe qui ne pourra être instanciée qu&#8217;une seule fois (une sorte de singleton)
extends Application permet d&#8217;hériter du trait Application (un trait est une classe virtuelle non pure, plus de détails dans [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fhello-world-en-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fhello-world-en-scala%2F" height="61" width="51" /></a></div><p>Un exemple de code Scala très simple:</p>

<div class="wp_syntax"><div class="code"><pre class="scala" style="font-family:monospace;"> <span style="color: #0000ff; font-weight: bold;">object</span> HelloWorld <span style="color: #0000ff; font-weight: bold;">extends</span> Application <span style="color: #F78811;">&#123;</span>
   println<span style="color: #F78811;">&#40;</span><span style="color: #6666FF;">&quot;Hello, world!&quot;</span><span style="color: #F78811;">&#41;</span>
 <span style="color: #F78811;">&#125;</span></pre></div></div>

<p>Quelques détails:</p>
<ul>
<li><code>object</code> signifie que l&#8217;on souhaite créer une classe qui ne pourra être instanciée qu&#8217;une seule fois (une sorte de singleton)</li>
<li><code>extends Application</code> permet d&#8217;hériter du <code>trait</code> <a href="http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk/src/library/scala/Application.scala">Application</a> (un trait est une classe virtuelle non pure, plus de détails dans un prochain post)</li>
</ul>
<p>Plus de détails dans la traduction du <a href="http://www.scala-fr.org/tutoriel-scala-pour-le-developpeur-java/">tutoriel Scala pour les développeurs Java</a>.</p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/hello-world-en-scala/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Présentation de Scala</title>
		<link>http://www.scala-fr.org/presentation-de-scala/</link>
		<comments>http://www.scala-fr.org/presentation-de-scala/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 22:56:58 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Méta]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=1</guid>
		<description><![CDATA[D&#8217;après l&#8217;article Wikipédia à propos de Scala:

Scala est un langage de programmation multi-paradigme conçu à l&#8217;EPFL pour exprimer les modèles de programmation courants dans une forme concise et élégante. Son nom vient de l&#8217;anglais Scalable language qui signifie à peu près « langage adaptable » ou « langage qui peut être mis à l&#8217;échelle ».
Scala intègre les paradigmes de programmation orientée objet [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fpresentation-de-scala%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fpresentation-de-scala%2F" height="61" width="51" /></a></div><p style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em;">D&#8217;après l&#8217;<a href="http://fr.wikipedia.org/wiki/Scala_(langage)">article Wikipédia à propos de Scala</a>:</p>
<blockquote>
<p style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em;"><strong>Scala</strong> est un <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Langage de programmation" href="http://fr.wikipedia.org/wiki/Langage_de_programmation">langage de programmation</a> <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Paradigme (programmation)" href="http://fr.wikipedia.org/wiki/Paradigme_(programmation)">multi-paradigme</a> conçu à l&#8217;<a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="EPFL" href="http://fr.wikipedia.org/wiki/EPFL">EPFL</a> pour exprimer les modèles de programmation courants dans une forme concise et élégante. Son nom vient de l&#8217;anglais <em>Scalable language</em> qui signifie à peu près « langage adaptable » ou « langage qui peut être mis à l&#8217;échelle ».</p>
<p style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em;">Scala intègre les paradigmes de <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Programmation orientée objet" href="http://fr.wikipedia.org/wiki/Programmation_orient%C3%A9e_objet">programmation orientée objet</a> et de <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Programmation fonctionnelle" href="http://fr.wikipedia.org/wiki/Programmation_fonctionnelle">programmation fonctionnelle</a>, avec un <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Typage statique" href="http://fr.wikipedia.org/wiki/Typage_statique">typage statique</a>. Il concilie ainsi ces deux paradigmes habituellement opposés (à de rares exceptions près, telle que le langage <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="OCaml" href="http://fr.wikipedia.org/wiki/OCaml">OCaml</a>) et offre au développeur la possibilité de choisir le paradigme le plus approprié à son problème.</p>
<p style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em;">Il est prévu pour être compilé en <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Bytecode" href="http://fr.wikipedia.org/wiki/Bytecode">bytecode</a> <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Java (langage)" href="http://fr.wikipedia.org/wiki/Java_(langage)">Java</a> (exécutable sur la <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title="Machine virtuelle Java" href="http://fr.wikipedia.org/wiki/Machine_virtuelle_Java">JVM</a>), ou <a style="text-decoration: none; color: #002bb8; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: initial initial;" title=".Net" href="http://fr.wikipedia.org/wiki/.Net">.Net</a>. Ces deux plateformes sont supportées officiellement, mais d&#8217;autres plateformes pourront potentiellement être supportées dans le futur.</p>
</blockquote>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/presentation-de-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
