<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>infoPiiaf</title>
    <description>Outillons les initiatives locales et solidaires, en ligne avec notre vision affichée d&apos;un internet libre et respectueux de l&apos;autonomie de ses utilisateurs.
</description>
    <link>/</link>
    <atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 23 Feb 2026 16:04:28 +0000</pubDate>
    <lastBuildDate>Mon, 23 Feb 2026 16:04:28 +0000</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>Données de test lisibles avec `trait` et `transient` de FactoryBot</title>
        <description>&lt;p&gt;Les &lt;em&gt;test-data factories&lt;/em&gt; ont remplacé depuis longtemps les données de test figées dans des fichiers de configuration difficiles à garder cohérents. FactoryBot est une bibliothèque plébiscitée dans le monde Ruby par la légèreté de sa syntaxe, que l’on peut rendre encore plus expressive en combinant &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;traits&lt;/code&gt; et attributs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transient&lt;/code&gt;. Attention, cet article n’est pas une introduction à FactoryBot, loin de là…&lt;/p&gt;

&lt;p&gt;Mais mettons-nous en situation. Disons que votre application permet de définir une programmation &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Schedule&lt;/code&gt; d’événements hebdomadaires &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Event&lt;/code&gt;, par exemple tous les mardis de 15h30 à 17h, et les jeudis de 10h30 à 12h. Est appelée occurrence &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Occurrence&lt;/code&gt; l’instance concrète d’une semaine donnée, par exemple le mardi 17 février de 15h30 à 17h pour l’événement du mardi en semaine &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2026W08&lt;/code&gt; (la semaine ISO8601 qui va du lundi 16 au dimanche 22 février 2026).&lt;/p&gt;

&lt;p&gt;Pour administrer ces événements et occurrences, certaines personnes ont le rôle de gestionnaire &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Manager&lt;/code&gt; sur la programmation, qui peut être limité dans le temps. En effet, une personne gestionnaire en 2025 ne le sera peut-être pas l’année suivante, et ne l’était peut-être pas l’année précédente. Nos tests doivent pouvoir créer facilement des personnes gestionnaires autorisées ou non pour une occurrence donnée.&lt;/p&gt;

&lt;h2 id=&quot;version-spontanée-avec-factorybot&quot;&gt;Version spontanée avec &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FactoryBot&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Partons de ce cas de test :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Cancel an occurrence&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# FactoryBot crée le compte avec le bon rôle&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# FactoryBot crée toute la chaîne&lt;/span&gt;
                                          &lt;span class=&quot;c1&quot;&gt;# de l’occurrence à la programmation&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;before&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;ScheduleManagement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;schedule: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;schedule&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;role: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;enabled_at: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;disabled_at: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;visit_as&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m a manager&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m not a manager yet&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;not_to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m not a manager anymore&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:management_ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;not_to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ce test reste assez lisible, même s’il y a encore beaucoup de détails du domaine-métier qui créent plus de bruit que de signal. Sans compter que tout ce bruit sera à répéter dans les autres cas de test, quand nous voudrons vérifier la présence ou non d’actions pour envoyer les courriels de présence, faire l’appel, etc. Nous devons trouver le moyen de rendre ces tests moins verbeux et la logique plus facile à partager.&lt;/p&gt;

&lt;h2 id=&quot;trait-et-transient-pour-nous-servir&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trait&lt;/code&gt; et &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transient&lt;/code&gt; pour nous servir&lt;/h2&gt;

&lt;p&gt;Nous préférons effectivement lire quelque chose comme cela :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Cancel an occurrence&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# FactoryBot crée toute la chaîne&lt;/span&gt;
                                          &lt;span class=&quot;c1&quot;&gt;# de l’occurrence à la programmation&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;visit_as&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m a manager&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m not a manager yet&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;not_to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;when I’m not a manager anymore&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;not_to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_css&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;text: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Mais quelle est cette sorcellerie ? Ou se cache la magie ? Nous vous le donnons en mille : dans la définition de nos &lt;em&gt;factories&lt;/em&gt;.&lt;/p&gt;

&lt;h3 id=&quot;premier-mécanisme-les-attributs-transient&quot;&gt;Premier mécanisme, les attributs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transient&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Ces attributs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transient&lt;/code&gt; permettent de passer des arguments à la création de nos &lt;em&gt;factories&lt;/em&gt;, comme nous le faisons pour les attributs persistés ou les relations. Ils sont disponibles au sein de la définition de la &lt;em&gt;factory&lt;/em&gt;, dans les blocs d’initialisation des attributs persistés ou les &lt;em&gt;callbacks&lt;/em&gt;. Et c’est justement dans ces derniers que nous allons nous en servir.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;FactoryBot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;factory&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;transient&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;occurrence&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:schedule_management&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;schedule: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;schedule&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Désormais, nous pouvons &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;create(:manager, occurrence: some_occurrence)&lt;/code&gt; et la relation entre la personne gestionnaire et la programmation dont l’occurrence est issue sera établie automagiquement.&lt;/p&gt;

&lt;h3 id=&quot;deuxième-mécanisme-les-trait&quot;&gt;Deuxième mécanisme, les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trait&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Maintenant que la relation est créée, il va falloir en personnaliser les attributs pour gérer les périodes d’activation/désactivation de la personne gestionnaire. Pour ce faire, nous allons définir des variantes de notre &lt;em&gt;factory&lt;/em&gt; à l’aide de &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trait&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;FactoryBot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;factory&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_before&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_before&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Les attributs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;management_starts_at&lt;/code&gt; et &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;management_ends_at&lt;/code&gt; ne sont pas des attributs persistés de &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Manager&lt;/code&gt;, mais bien deux nouveaux attributs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transient&lt;/code&gt;. Ils nous permettent de nommer une notion importante de cette &lt;em&gt;factory&lt;/em&gt; et de mutualiser le code de notre &lt;em&gt;callback&lt;/em&gt;. En voici la version finale :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;FactoryBot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;factory&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;transient&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_before&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_starts_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_before&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;trait&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;management_ends_at&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;occurrence&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:schedule_management&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt;
          &lt;span class=&quot;ss&quot;&gt;schedule: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;schedule&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;ss&quot;&gt;enabled_at: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;management_starts_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;ss&quot;&gt;disabled_at: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;management_ends_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;une-api-de-test-à-limage-de-votre-domaine-métier&quot;&gt;Une API de test à l’image de votre domaine-métier&lt;/h2&gt;

&lt;p&gt;Traiter son code de test avec le même soin que son code de production procure les mêmes atouts : plus facile à lire, plus facile à comprendre, plus facile à corriger et faire évoluer. Vous tirez des bénéfices à l’écriture de nouveaux tests, surtout quand votre métier devient plus complexe. Imaginons un test qui vérifie la liste des destinataires d’un courriel de relance ; constatez par vous-même sa limpidité :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Send a reminder&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;let!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:managers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active_managers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;disabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;enabled_after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:active_managers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create_list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:disabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:disabled_before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:enabled_after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:enabled_after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;send_reminder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;occurrence&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;have_been_sent_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;active_managers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p class=&quot;follow-up&quot;&gt;Notre utilisation avancée de FactoryBot ne s’arrête pas là. Découvrez bientôt comment nous l’utilisons pour fabriquer des réponses d’API externes en JSON.&lt;/p&gt;
</description>
        <pubDate>Mon, 23 Feb 2026 00:00:00 +0000</pubDate>
        <link>/blog/2026/02/23/donnees-de-test-lisibles-avec-trait-et-transient-de-factory-bot.html</link>
        <guid isPermaLink="true">/blog/2026/02/23/donnees-de-test-lisibles-avec-trait-et-transient-de-factory-bot.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Hotwire et ViewComponent sont dans un bateau… Épisode 3 : pourquoi ?</title>
        <description>&lt;p&gt;Parce que la &lt;abbr title=&quot;single-page application&quot;&gt;SPA&lt;/abbr&gt; est réellement tombée à l’eau. Après plus de cinq ans de développement et exploitation agiles d’un projet &lt;em&gt;Rails API + EmberJS&lt;/em&gt;, nous avons décidé d’abandonner le cadriciel JavaScript pour revenir à une application &lt;em&gt;fullstack Rails&lt;/em&gt;.
Mais comment faire sans renoncer aux interfaces dynamiques et rechargements partiels qui plaisent tant à nos utilisatrices et utilisateurs ? Retour sur 609 jours de réusinage.&lt;/p&gt;

&lt;p&gt;Mais avant, un peu de contexte : pourquoi partir sur une &lt;abbr title=&quot;single-page application&quot;&gt;SPA&lt;/abbr&gt; en premier lieu malgré des années d’expérience en &lt;em&gt;fullstack Rails&lt;/em&gt; ? Un peu pour découvrir le paradigme qui perçait à l’époque, et surtout pour satisfaire aux besoins d’utilisation hors-ligne. En effet, &lt;a href=&quot;https://www.filae.app/&quot;&gt;Filaé&lt;/a&gt; est une application amenée à être utilisée en zone blanche, sans données cellulaires, comme les cellules de garde-à-vue ou les talus les plus reculés de la forêt de Rambouillet par exemple. Une application Rails seule ne pouvait rendre ce service, alors qu’une &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Offline_and_background_operation&quot;&gt;PWA en JavaScript&lt;/a&gt; oui.&lt;/p&gt;

&lt;h2 id=&quot;un-dolmen-bien-ancré&quot;&gt;Un dolmen bien ancré&lt;/h2&gt;

&lt;p&gt;Dolmen signifie « table de pierre » : un bloc de pierre horizontal formant un plateau, sur deux blocs verticaux formant les pieds. Dans notre cas, notre dolmen logiciel reposait sur deux menhirs particulièrement solides :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;une application Rails, dans l’écosystème Ruby que nous connaissons très bien ;&lt;/li&gt;
  &lt;li&gt;le vaste espace de communication entre client et serveur, sous la forme d’une API JSON conventionnelle.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Habitué aux alignements verticaux, il nous fallait désormais composer avec l’horizontalité du plateau, pour servir tout cela à nos utilisatrices et utilisateurs : une application &lt;a href=&quot;https://emberjs.com/&quot;&gt;EmberJS&lt;/a&gt;, dans l’écosystème NodeJS que nous devions apprivoiser.&lt;/p&gt;

&lt;p&gt;Un petit mot concernant le choix de EmberJS. Il s’agissait d’un choix de philosophie plus que de fonctionnalités offertes par les différents cadriciels JavaScript. Nous aurions pu construire cette SPA avec React par exemple, et nous avons même tenté &lt;a href=&quot;https://elm-lang.org/&quot;&gt;Elm&lt;/a&gt;… Mais imaginez &lt;em&gt;JavaScript on Rails&lt;/em&gt;, et vous avez EmberJS : du &lt;em&gt;fullstack SPA development&lt;/em&gt;, avec routage des URL vers des contrôleurs qui récupèrent leurs données avec un &lt;abbr title=&quot;Object-Relational Mapping&quot;&gt;ORM&lt;/abbr&gt; sur une &lt;a href=&quot;https://jsonapi.org/&quot;&gt;JSON:API&lt;/a&gt;, le tout aiguillé par des conventions de nommage et assisté par des générateurs de fichier en ligne de commande… Bref, &lt;em&gt;JavaScript on Rails&lt;/em&gt;&lt;sup id=&quot;fnref:yehuda&quot;&gt;&lt;a href=&quot;#fn:yehuda&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Intégrer un nouvel écosystème entier dans notre équipe de deux personnes n’était pas une mince affaire. Nous connaissions évidemment déjà JavaScript, et suivions les versions de NodeJS grâce (ou à cause) de l’&lt;em&gt;asset pipeline&lt;/em&gt; de Rails notamment. Mais désormais, c’était tout un nouveau pan de gestion de dépendances qui tombait dans notre escarcelle : versions de NodeJS, EmberJS, bibliothèques EmberJS… Et à la longue, nous avons fini par décrocher. Nous avons bien tenté de faire les montées de version EmberJS, et notamment l’arrivée des éditions et leur première mouture Octane, mais le mode &lt;em&gt;best effort&lt;/em&gt; a ses limites&lt;sup id=&quot;fnref:essaimage&quot;&gt;&lt;a href=&quot;#fn:essaimage&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Le plateau de notre dolmen commençait à vaciller… Et les fonctionnalités spécifiquement hors-ligne n’étaient toujours pas en haut de pile, quatre ans après le lancement de ce projet agile.&lt;/p&gt;

&lt;p&gt;Avant que ce dolmen ne forme notre tumulus, nous avons &lt;a href=&quot;https://framagit.org/filae/src/-/blob/62a3debcba629037019a9dc9fa67a8a97d7470bb/doc/00%20RFCs/01%20-%20Migration%20IHM%20de%20EmberJS%20vers%20Ruby%20on%20Rails%20-%20accept%C3%A9e.md&quot;&gt;décidé d’un commun accord&lt;/a&gt; de nous concentrer sur la partie Rails, la plus critique d’un point de vue sécurité, et d’abandonner la SPA pour revenir à un simple monolithe taillé pour l’énergie que nous pouvions y consacrer.&lt;/p&gt;

&lt;p class=&quot;nota-bene&quot;&gt;Supprimer la SPA supprimait aussi le besoin d’une API JSON documentée. Nous avons eu une bonne expérience de développement avec &lt;a href=&quot;https://pact.io/&quot;&gt;Pact&lt;/a&gt; et ses tests auto-documentants auto-hébergés avec &lt;a href=&quot;https://github.com/pact-foundation/pact_broker&quot;&gt;Pact Broker&lt;/a&gt;. Cela avait également un coût de mise en place et de maintenance, mais la transparence apportée avait beaucoup de valeur.&lt;/p&gt;

&lt;h2 id=&quot;un-bon-vieux-menhir-mais-avec-ornements&quot;&gt;Un bon vieux menhir, mais avec ornements&lt;/h2&gt;

&lt;p&gt;Le chantier était de taille (de pierre ?) : réécrire toute l’&lt;abbr title=&quot;Interface Homme-Machine&quot;&gt;IHM&lt;/abbr&gt; de Filaé en Rails, côté serveur. Ceci dit, nous étions (et nos utilisatrices et utilisateurs aussi) bien habitués aux affichages dynamiques offerts par la navigation côté navigateur, sans rechargement complet de page comme on en a l’habitude côté serveur. Nous partions donc de notre menhir déjà en place, et rajoutions de quoi véhiculer élégamment de l’information, un peu à l’image des &lt;a href=&quot;https://fr.wikipedia.org/wiki/P%C3%A9troglyphe&quot;&gt;pétroglyphes&lt;/a&gt;. Nous avions alors besoin de nouveaux outils.&lt;/p&gt;

&lt;p&gt;Nous n’avons pas eu besoin d’aller chercher très loin : accompagnant notre monolithe habituel se trouvait désormais &lt;a href=&quot;https://hotwired.dev/&quot;&gt;Hotwire&lt;/a&gt;, avec ses briques Turbo et Stimulus. La première nous a permis de maîtriser plus finement la dynamique de nos pages et de la navigation, avec du morphisme de DOM et du chargement partiel et asynchrone. La deuxième brique apportait la réactivité aux événements-utilisateurs sans avoir à écrire de JavaScript ou presque. Adoptant l’approche &lt;a href=&quot;https://world.hey.com/dhh/you-can-t-get-faster-than-no-build-7a44131c&quot;&gt;#NoBuild&lt;/a&gt;, nous avons même supprimé toute dépendance à NodeJS dans le projet !&lt;/p&gt;

&lt;p&gt;Au milieu des autres projets, il nous aura fallu plus de six cents jours calendaires pour mener à bien ce vaste chantier. Nous en avons profité pour améliorer considérablement notre harnais de test et par la même occasion notre couverture de code. Nous avons aussi pris le parti d’améliorer quelques fonctionnalités en passant, outrepassant le cadre du simple réusinage iso-fonctionnel ; mais quand on peut faire plaisir…&lt;/p&gt;

&lt;p&gt;Aujourd’hui, Filaé ne présente plus aucun cadriciel obsolète se laissant éroder par les assauts du temps à défaut d’énergie disponible. Les montées de versions sont moins nombreuses, mieux maîtrisées, plus fréquentes et sûres.&lt;/p&gt;

&lt;h2 id=&quot;des-pétroglyphes-aux-bas-reliefs&quot;&gt;Des pétroglyphes aux bas-reliefs&lt;/h2&gt;

&lt;p&gt;Un nouveau projet nous a permis de mettre à l’épreuve ces pratiques depuis une feuille blanche. Nous en avons tiré de nombreux enseignements qui nous ont mené à &lt;a href=&quot;https://viewcomponent.org/&quot;&gt;ViewComponent&lt;/a&gt; pour limiter la duplication de code et de &lt;em&gt;magic strings&lt;/em&gt; (entre autres avantages). Nous vous renvoyons aux épisodes &lt;a href=&quot;/blog/2025/12/03/hotwire-view-component-conventions-turbo-stream.html&quot;&gt;1&lt;/a&gt; et &lt;a href=&quot;/blog/2025/12/04/hotwire-view-component-conventions-stimulus.html&quot;&gt;2&lt;/a&gt; de cette série pour plus de détails.&lt;/p&gt;

&lt;p&gt;Après avoir cédé aux chants de sirènes beaucoup trop énergivores, nous sommes revenus à bon port. Nous allons poursuivre nos explorations, pour offrir de nouvelles capacités techniques et fonctionnelles, mais toujours dans le giron de notre environnement proche, comme &lt;a href=&quot;https://native.hotwired.dev/&quot;&gt;Hotwire Native&lt;/a&gt;.&lt;/p&gt;

&lt;p class=&quot;follow-up&quot;&gt;Construisons des pratiques à la hauteur de notre équipage, capable de livrer nos réalisations rapidement, en toute sérénité et pour longtemps.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:yehuda&quot;&gt;
      &lt;p&gt;Rien d’étonnant quand on sait que &lt;a href=&quot;https://yehudakatz.com/about/&quot;&gt;Yehuda Katz&lt;/a&gt; a fortement contribué à Rails et EmberJS. &lt;a href=&quot;#fnref:yehuda&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:essaimage&quot;&gt;
      &lt;p&gt;Cela aurait pu être différent si l’essaimage avait pris dans d’autres hôpitaux, et que les financements avait pu nous éviter de multiplier les projets. &lt;a href=&quot;#fnref:essaimage&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 15 Dec 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/12/15/hotwire-view-component-conventions-pourquoi.html</link>
        <guid isPermaLink="true">/blog/2025/12/15/hotwire-view-component-conventions-pourquoi.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Hotwire et ViewComponent sont dans un bateau… Épisode 2 : Stimulus</title>
        <description>&lt;p&gt;La &lt;abbr title=&quot;single-page application&quot;&gt;SPA&lt;/abbr&gt; tombe à l’eau, encore ! Dans la continuité du &lt;a href=&quot;/blog/2025/12/03/hotwire-view-component-conventions-turbo-stream.html&quot;&gt;précédent article sur Turbo Stream&lt;/a&gt;, nous allons poursuivre avec Stimulus. Découvrez comment nous associons Hotwire et ViewComponent  pour une écriture épurée de composants dynamiques, avec conventions et sans fautes de frappe.&lt;/p&gt;

&lt;p&gt;Si vous ne l’avez pas encore fait, nous vous invitons à lire &lt;em&gt;a minima&lt;/em&gt; l’introduction de l’article précédent, sus-mentionné. Cela vous apportera le contexte et la structure du code que nous utiliserons dans la suite de cet article.&lt;/p&gt;

&lt;h2 id=&quot;stimulus-ses-signaux-sans-le-bruit&quot;&gt;Stimulus, ses signaux sans le bruit&lt;/h2&gt;

&lt;p&gt;Pour vous mettre l’eau à la bouche, voici le niveau de concision que nous avons obtenu dans la vue de notre composant-exemple :&lt;/p&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data-controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_controller&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_value&lt;/span&gt;(&quot;submittable&quot;,&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;submittable)
  &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;simple_form_for&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@attendance&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;input_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;status&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;deep_merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;statusDidChange&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;input_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;commentInput&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;label_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;commentLabel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;submit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pour obtenir ce résultat, nous profitons encore une fois des conventions de ViewComponent pour calculer automagiquement l’identifiant Stimulus du contrôleur JavaScript et le réutiliser pour les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;values&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;targets&lt;/code&gt; et &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actions&lt;/code&gt; de Stimulus. Mais avant, allons indiquer à &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;importmap-rails&lt;/code&gt; où trouver ces contrôleurs générés en &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--sidecar&lt;/code&gt; (merci &lt;a href=&quot;https://blog.theamazingrando.com/posts/rails-propshaft-stimulus-viewcomponent.html&quot;&gt;Paul Sadauskas&lt;/a&gt;) :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# config/initializers/assets.rb&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;paths&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;app/components&quot;&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;importmap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cache_sweepers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;app/components&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# config/importmap.rb&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pin_all_from&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;app/components&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;under: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;controllers&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;to: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;La hiérarchie de fichiers imposée par le générateur ViewComponent va, soyez prévenu·es, produire des identifiants de contrôleur à rallonge, du style &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;occurrences--call-lists--attendances--form-component--form-component&lt;/code&gt;. Vous pouvez trouver un &lt;a href=&quot;https://gist.github.com/AnalyzePlatypus/3305d91593a0146a8ea23953c76a8949&quot;&gt;&lt;em&gt;custom loader&lt;/em&gt;&lt;/a&gt; pour limiter les répétitions, mais comme nous n’écrirons jamais cela à la main, nous nous en passons. C’est l’&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ApplicationComponent&lt;/code&gt; qui va se charger de calculer cet identifiant Stimulus et le réutiliser pour les autres attributs.&lt;/p&gt;

&lt;h3 id=&quot;le-contrôleur&quot;&gt;Le contrôleur&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ViewComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stimulus_controller&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lineage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;underscore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dasherize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lineage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lineage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;--&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ce qui nous permet de brancher notre vue avec notre contrôleur Stimulus aussi simplement que :&lt;/p&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data-controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_controller&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ce qui produira ce HTML :&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-controller=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;occurrences--call-lists--attendances--form-component--form-component&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;les-values&quot;&gt;Les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;values&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ViewComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;#[…]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stimulus_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;data: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;stimulus_controller&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;value: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_value&lt;/span&gt;(&quot;submittable&quot;,&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;submittable)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-occurrences--call-lists--attendances--form-component--form-component-submittable-value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;[&quot;absent&quot;, &quot;present&quot;]&apos;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;les-targets&quot;&gt;Les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;targets&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ViewComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;data: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_controller&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-target&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;input_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;status&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-occurrences--call-lists--attendances--form-component--form-component-target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;status&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;les-actions&quot;&gt;Les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actions&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ViewComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# […]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stimulus_action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;function_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;trigger: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;data: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;ss&quot;&gt;action: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;trigger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;stimulus_controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;function_name&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;compact&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;input_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;statusDidChange&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;occurrences--call-lists--attendances--form-component--form-component#statusDidChange&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Avec cette méthode, vous avez droit également à une petite subtilité : le &lt;em&gt;keyword argument&lt;/em&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trigger&lt;/code&gt; optionnel. Dans l’exemple ci-dessus, on ne le spécifie pas, la syntaxe est donc celle utilisant &lt;a href=&quot;https://stimulus.hotwired.dev/reference/actions#event-shorthand&quot;&gt;le &lt;em&gt;trigger&lt;/em&gt; par défaut de Stimulus&lt;/a&gt;. Vous pouvez néanmoins préciser l’événement scruté :&lt;/p&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;input_html: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;commentWillChange&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;trigger: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;keypress&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;keypress-&amp;gt;occurrences--call-lists--attendances--form-component--form-component#commentWillChange&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;les-points-de-vigilance&quot;&gt;Les points de vigilance&lt;/h3&gt;

&lt;p&gt;Les quelques méthodes présentées ci-dessus ne couvrent pas toutes les possibilités de Stimulus, loin de là. Il n’y a par exemple pas les &lt;em&gt;actions parameters&lt;/em&gt; ou les &lt;em&gt;outlets&lt;/em&gt;. Mais ces premiers usages pavent la voie vers des vues à la fois plus faciles à lire et moins exposées aux fautes de frappe et erreurs de syntaxe. Et ce n’est pas une mince affaire dans ce monde très « &lt;em&gt;stringly-typed&lt;/em&gt; » des attributs Stimulus.&lt;/p&gt;

&lt;p&gt;Prêtez également une attention toute particulière aux traitements faits par vos &lt;em&gt;gems&lt;/em&gt; aux arguments qui leur sont passés. Autant Slim gère très bien les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hash&lt;/code&gt; imbriqués pour la génération des noms des &lt;em&gt;data-attributes&lt;/em&gt; (cf &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#stimulus_value&lt;/code&gt;), autant SimpleForm nous a obligé à utiliser l’interpolation de chaîne de caractère, ne supportant pas les &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hash&lt;/code&gt; de plus de deux niveaux (cf. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#stimulus_target&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Et pour terminer, soyez à l’aise avec vos &lt;a href=&quot;https://thelinuxcode.com/demystifying-rubys-splat-and-double-splat-operators/&quot;&gt;&lt;em&gt;splat operators&lt;/em&gt;&lt;/a&gt; pour satisfaire aux exigences de votre moteur de &lt;em&gt;templating&lt;/em&gt; (Slim ici pour nous) et aux signatures de méthode de vos bibliothèques. Vous allez retrouver des syntaxes somme toute particulières mais le jeu en vaut la chandelle&lt;sup id=&quot;fnref:chandelle&quot;&gt;&lt;a href=&quot;#fn:chandelle&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Voyez par vous même :&lt;/p&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;submit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stimulus_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;submit&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-occurrences--call-lists--attendances--form-component--form-component-target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;submit&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;quelle-différence&quot;&gt;Quelle différence ?&lt;/h2&gt;

&lt;div class=&quot;language-diff highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gd&quot;&gt;-div.attendance data-controller=&quot;occurrences--call-lists--attendances--form-component--form-component&quot; data-occurrences--call-lists--attendances--form-component--form-component-submittable-value=submittable
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+div.attendance data-controller=stimulus_controller *stimulus_value(&quot;submittable&quot;, submittable)
&lt;/span&gt;   = simple_form_for @attendance do |f|
&lt;span class=&quot;gd&quot;&gt;-    = f.input :status, input_html: { data: { &quot;occurrences--call-lists--attendances--form-component--form-component-target&quot;: &quot;status&quot;, action: &quot;occurrences--call-lists--attendances--form-component--form-component#statusDidChange&quot; } }
-    = f.input :comment, input_html: { data: { &quot;occurrences--call-lists--attendances--form-component--form-component-target&quot;: &quot;commentInput&quot; } }, label_html: { data: { &quot;occurrences--call-lists--attendances--form-component--form-component-target&quot;: &quot;commentLabel&quot; } }
-    = f.submit data: { &quot;occurrences--call-lists--attendances--form-component--form-component-target&quot;: &quot;submit&quot; }
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+    = f.input :status, input_html: stimulus_target(&quot;status&quot;).deep_merge(stimulus_action(&quot;statusDidChange&quot;))
+    = f.input :comment, input_html: stimulus_target(&quot;commentInput&quot;), label_html: stimulus_target(&quot;commentLabel&quot;)
+    = f.submit **stimulus_target(&quot;submit&quot;)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Bruit versus signal 😌&lt;/p&gt;

&lt;p class=&quot;follow-up&quot;&gt;Mais pourquoi donc avons-nous eu besoin d’explorer et &lt;a href=&quot;/blog/2025/12/15/hotwire-view-component-conventions-pourquoi.html&quot;&gt;construire ces pratiques Rails ?&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:chandelle&quot;&gt;
      &lt;p&gt;En plus de gagner en expertise sur les subtilités de votre langage de programmation. &lt;a href=&quot;#fnref:chandelle&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/12/04/hotwire-view-component-conventions-stimulus.html</link>
        <guid isPermaLink="true">/blog/2025/12/04/hotwire-view-component-conventions-stimulus.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Hotwire et ViewComponent sont dans un bateau… Épisode 1 : Turbo Stream</title>
        <description>&lt;p&gt;La &lt;abbr title=&quot;single-page application&quot;&gt;SPA&lt;/abbr&gt; tombe à l’eau ! Un nouveau projet nous a donné l’occasion de faire émerger une belle articulation entre &lt;a href=&quot;https://hotwired.dev/&quot;&gt;Hotwire&lt;/a&gt; et &lt;a href=&quot;https://viewcomponent.org/&quot;&gt;ViewComponent&lt;/a&gt; pour apporter la fluidité d’une &lt;em&gt;front-end application&lt;/em&gt; sans tirer toute la complexité d’un cadriciel JavaScript et de son écosystème, avec des conventions mutualisées pour favoriser le &lt;abbr title=&quot;Don’t Repeat Yourself&quot;&gt;DRY&lt;/abbr&gt;. Commençons par &lt;em&gt;Turbo Stream&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Nous ne détaillerons pas ici le fonctionnement de Hotwire (et plus spécifiquement de son versant Turbo Stream) ni de ViewComponent. Leurs guides respectifs sont de qualité et vous offriront une bonne introduction si vous n’y êtes pas familiers. Cet article se concentrera sur les mécanismes que nous avons mis en place pour fiabiliser notre routine de développement avec ces deux bibliothèques. Pour illustrer nos propos, considérons le composant-exemple ci-dessous :&lt;/p&gt;

&lt;div class=&quot;language-terminal highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;bundle &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;rails g component occurrences/call_lists/attendances/form_component attendance &lt;span class=&quot;nt&quot;&gt;--sidecar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--stimulus&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;      create  app/components/occurrences/call_lists/attendances/form_component.rb
      invoke  rspec
      create    spec/components/occurrences/call_lists/attendances/form_component_spec.rb
      invoke  stimulus
      create    app/components/occurrences/call_lists/attendances/form_component/form_component_controller.js
      invoke  locale
      create    app/components/occurrences/call_lists/attendances/form_component/form_component.yml
      invoke  slim
      create    app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Vous découvrirez dans cet article comment nous facilitons l’usage de &lt;strong&gt;composants remplaçables atomiquement avec Turbo Stream&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;une-méthode-pour-les-gouverner-tous&quot;&gt;Une méthode pour les gouverner tous&lt;/h2&gt;

&lt;p&gt;Peut-être connaissez-vous déjà la méthode &lt;a href=&quot;https://api.rubyonrails.org/classes/ActionView/RecordIdentifier.html#method-i-dom_id&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#dom_id&lt;/code&gt;&lt;/a&gt; ? Elle est généralement utilisée avec des &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ActiveRecord&lt;/code&gt; pour générer par convention un identifiant unique compatible avec la spécification HTML. La documentation de Rails donne les exemples ci-après :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;             &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; &quot;new_post&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; &quot;new_post&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; &quot;post_42&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ce que l’on sait moins, c’est que n’importe quel objet peut être passé à &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#dom_id&lt;/code&gt;, sous réserve de répondre à deux méthodes :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#model_name&lt;/code&gt;, qui retourne un objet qui répond à &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#param_key&lt;/code&gt;, pour la première partie du &lt;em&gt;DOM ID&lt;/em&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post&lt;/code&gt; dans l’exemple ci-dessus) ;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#to_key&lt;/code&gt;, qui retourne :
    &lt;ul&gt;
      &lt;li&gt;un tableau de valeur unique, pour la seconde partie du &lt;em&gt;DOM ID&lt;/em&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;42&lt;/code&gt; dans l’exemple ci-dessus) ;&lt;/li&gt;
      &lt;li&gt;ou &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nil&lt;/code&gt; quand on ne peut pas déterminer de valeur unique, générant le préfixe &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;new_&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nous allons donc nous servir de cela pour générer un &lt;em&gt;DOM ID&lt;/em&gt; pour chacun de nos &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ViewComponent&lt;/code&gt; ; avec force convention, évidemment.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ostruct&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ViewComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;model_name&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;OpenStruct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;param_key: &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;gsub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;::&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;to_key&lt;/span&gt;
    &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Prenons donc notre composant-exemple et redéfinissons &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#to_key&lt;/code&gt; ainsi :&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Occurrences::CallLists::Attendances::FormComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ApplicationComponent&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attendance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@attendance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attendance&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;to_key&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@attendance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Chaque instance de composant sait désormais calculer un identifiant unique en fonction du contexte avec lequel il est construit :&lt;/p&gt;

&lt;div class=&quot;language-irb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;irb&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Occurrences&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CallLists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Attendances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;FormComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;attendance: &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Attendance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&quot;Occurrences--CallLists--Attendances--FormComponent_5&quot;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;irb&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Occurrences&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CallLists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Attendances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;FormComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;attendance: &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Attendance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&quot;new_Occurrences--CallLists--Attendances--FormComponent&quot;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;et-dans-les-turbo-stream-les-lier&quot;&gt;Et dans les &lt;em&gt;Turbo Stream&lt;/em&gt; les lier.&lt;/h3&gt;

&lt;p&gt;À partir de là, une belle opportunité s’offre à nous, que nous allons résumer en trois lignes de code :&lt;/p&gt;

&lt;div class=&quot;language-slim highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;/ app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dom_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;/ […]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# Dans une action de contrôleur quelconque&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Occurrences&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;CallLists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Attendances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;FormComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;attendance: &lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@attendance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;turbo_stream: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;turbo_stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Et un résultat dans votre navigateur :&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;turbo-stream&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;replace&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Occurrences--CallLists--Attendances--FormComponent_5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- BEGIN app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim --&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Occurrences--CallLists--Attendances--FormComponent_5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;[…]&lt;span class=&quot;nt&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- END app/components/occurrences/call_lists/attendances/form_component/form_component.html.slim --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/turbo-stream&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Regardez attentivement, la valeur &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;turbo-stream target&amp;gt;&lt;/code&gt; est identique à la valeur &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;div id&amp;gt;&lt;/code&gt; : un composant remplaçable par lui-même, avec un &lt;em&gt;DOM ID&lt;/em&gt; calculé automagiquement. Cette convention codée joue un rôle central dans la cohérence entre vue et contrôleur, grâce à l’appel implicite de &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#dom_id&lt;/code&gt; par les méthodes de Turbo Stream comme &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#replace&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;quelle-différence&quot;&gt;Quelle différence ?&lt;/h2&gt;

&lt;div class=&quot;language-diff highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   def update
     if @attendance.update(attendance_params)
       call_list = @attendance.call_list
&lt;span class=&quot;gd&quot;&gt;-      call_list_id = &quot;Occurrences--CallList_#{@call_list.id}&quot;
-      render turbo_stream: turbo_stream.replace(call_list_id, partial: &quot;occurrences/call_list&quot;, locals: { call_list: })
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+      whole_call_list = Occurrences::CallListComponent.new(call_list:)
+      render turbo_stream: turbo_stream.replace(whole_call_list)
&lt;/span&gt;     else
&lt;span class=&quot;gd&quot;&gt;-      form_id = &quot;Occurrences--CallLists--Attendances--FormComponent_#{@attendance.id}&quot;
-      render turbo_stream: turbo_stream.replace(form_id, partial: &quot;occurrences/call_lists/attendances/form&quot;, locals: { attendance: @attendance }), status: :unprocessable_content
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+      form = Occurrences::CallLists::Attendances::FormComponent.new(attendance: @attendance)
+      render turbo_stream: turbo_stream.replace(form), status: :unprocessable_content
&lt;/span&gt;    end
  end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Vous remarquerez que, dans l’ancienne version, il était nécessaire de savoir reconstruire les &lt;em&gt;DOM ID&lt;/em&gt; des éléments qui devaient être remplacés ? Tout comme il fallait connaître le chemin vers le bon &lt;em&gt;partial&lt;/em&gt; à regénérer, et identifier les variables locales à passer ? Dans la nouvelle version, vous avez juste à instancier le bon composant avec les arguments auto-documentés dans son &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initialize&lt;/code&gt; et à le passer à &lt;em&gt;Turbo Stream&lt;/em&gt;. Merci &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#dom_id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Nous savons maintenant mettre à jour très localement des bouts de notre interface en nous protégeant d’un écueil récurrent avec Turbo Stream : la duplication et dispersion des &lt;em&gt;DOM ID&lt;/em&gt; entre vues et contrôleurs. Plus jamais nous ne casserons nos tests (ou pire, notre application) à cause d’une faute de frappe dans un &lt;em&gt;DOM ID&lt;/em&gt; mal tapé ou modifié d’un côté mais pas de l’autre&lt;sup id=&quot;fnref:conventions-outillees&quot;&gt;&lt;a href=&quot;#fn:conventions-outillees&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Et nous pouvons aller plus loin grâce à la mise en place de ces conventions, pour apporter encore plus de dynamisme dans nos applications grâce à Stimulus, en limitant là-encore les erreurs liées à la saisie multiple des identifiants.&lt;/p&gt;

&lt;p class=&quot;follow-up&quot;&gt;Découvrez comment nous épurons l’écriture de &lt;a href=&quot;/blog/2025/12/04/hotwire-view-component-conventions-stimulus.html&quot;&gt;composants dynamiques avec Stimulus&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:conventions-outillees&quot;&gt;
      &lt;p&gt;Sans parler du fait qu’il n’y a plus à réfléchir à comment nommer ses DOM ID, partager et documenter les standards d’équipe, les conventions étant maintenant outillées par le code lui-même. &lt;a href=&quot;#fnref:conventions-outillees&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Wed, 03 Dec 2025 00:00:00 +0000</pubDate>
        <link>/blog/2025/12/03/hotwire-view-component-conventions-turbo-stream.html</link>
        <guid isPermaLink="true">/blog/2025/12/03/hotwire-view-component-conventions-turbo-stream.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Filaé au Congrès International Francophone de Médecine Légale</title>
        <description>&lt;p&gt;Filaé est publiquement un &lt;a href=&quot;https://filae.frama.io/blog/2021/10/05/filae-libre-au-congres-international-francophone.html&quot;&gt;logiciel libre depuis quelques jours&lt;/a&gt;. Rapide retour sur ce que cela change dans le paysage du logiciel médico-judiciaire.&lt;/p&gt;

&lt;h2 id=&quot;logiciel-umj-avec-pignon-sur-rue&quot;&gt;Logiciel UMJ avec pignon sur rue&lt;/h2&gt;

&lt;p&gt;Filé est un logiciel libre de dématérialisation du parcours-patient, du premier appel téléphonique à la délivrance de certificats médicaux. Ce n’est pas la seule initiative qui cherche à proposer un poste de travail sûr et transparent pour nos données de santé à caractère personnel, loin de là. Ceci dit, son développement amorcé par une équipe confrontée sur le terrain au double enjeu médico-judiciaire et son engagement à en faire profiter librement le plus grand nombre est la mise en acte de la démarche d’essaimage que nous promouvons et expérimentons depuis des années au sein d’infoPiiaf.&lt;/p&gt;

&lt;p&gt;Un tout autre défi nous attend désormais.&lt;/p&gt;

&lt;h2 id=&quot;faciliter-le-quotidien-dautres-umj&quot;&gt;Faciliter le quotidien d’autres UMJ&lt;/h2&gt;

&lt;p&gt;Filaé est loin d’être un produit fini. Filaé ne répond pas au quart de ce qui avait été imaginé par ses instigateurs. Il reste pas mal de chemin à parcourir pour satisfaire l’UMJ78. N’est-ce pas prendre le risque de rajouter des demandes à cette longue liste que de faire participer d’autres UMJ ? Si, évidemment, mais nous voulons valider ainsi que leurs pratiques divergent bien moins qu’elles ne convergent. C’est le &lt;em&gt;credo&lt;/em&gt; de l’essaimage : outiller une équipe volontaire pour répondre concrètement à un besoin globalement partagé par leurs pairs.&lt;/p&gt;

&lt;p&gt;Ce qu’il nous manque aujourd’hui, c’est ce delta entre les fonctionnalités fournies par Filaé et celles à disposition des autres UMJ de France. Cela rejoint la genèse d’infoPiiaf : combler les disparités territoriales par la mutualisation des efforts locaux jusque-là disparates. Peut-être est-il temps de faire un état des lieux du paysage logiciel en usage au sein de la médecine légale française… 📋&lt;/p&gt;

&lt;p&gt;Affaire à suivre !&lt;/p&gt;
</description>
        <pubDate>Tue, 05 Oct 2021 00:00:00 +0000</pubDate>
        <link>/blog/2021/10/05/liberation-filae-congres-medecine-legale.html</link>
        <guid isPermaLink="true">/blog/2021/10/05/liberation-filae-congres-medecine-legale.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Cultivons notre potager logiciel</title>
        <description>&lt;p&gt;&lt;em&gt;Software&lt;/em&gt;. Malgré un terme très explicite en anglais, le logiciel a longtemps été construit comme quelque chose de figé et pérenne, souvent à l’image du &lt;abbr title=&quot;Bâtiments et Travaux Publics&quot;&gt;BTP&lt;/abbr&gt;. Pourtant, s’il y a bien un levier dont il faut absolument tirer parti, c’est son côté &lt;em&gt;soft&lt;/em&gt;, malléable à merci dans l’espace et dans le temps ; bref, &lt;a href=&quot;/blog/2015/05/18/methodes-agiles.html&quot;&gt;agile&lt;/a&gt;. En prenant du recul sur l’écosystème logiciel, nous l’abordons désormais à travers le prisme de la culture potagère.&lt;/p&gt;

&lt;h2 id=&quot;une-attention-quotidienne&quot;&gt;Une attention quotidienne&lt;/h2&gt;

&lt;p&gt;Un potager est un écosystème vivant où il y a du nouveau tous les jours. Nos courgettes fleurissent, nos fraises rougissent, nos radis sortent de terre… À propos de croissance, nous avons semé nos salades un peu trop près de nos carottes. Elles profitent vraiment bien, il est tant de les &lt;strong&gt;repiquer&lt;/strong&gt;… Comme cette fonctionnalité que nous avons développée qui plaît vraiment à nos utilisateurs et que nous allons encore améliorer. Et améliorer. Et améliorer. Le code devient vraiment dense… Il est temps de prendre un peu de recul et de le &lt;strong&gt;réusiner&lt;/strong&gt; pour qu’elle se développe encore mieux. Rien ne change pour l’utilisateur, il y aura toujours les mêmes fonctionnalités, comme il y aura toujours le même nombre de salades après repiquage. Mais le réusinage offrira une base de code plus pérenne pour permettre à l’application de grandir plus sereinement.&lt;/p&gt;

&lt;p&gt;D’ailleurs, il n’y a pas que nos semis qui grandissent. Il y a aussi des adventices. Vous savez, ces plantes qui poussent dans nos plates-bandes sans y avoir été invitées. Autant que faire se peut, nous préférons que ces herbes jouent leur rôle bien au chaud dans notre bac à compost (et oui, l’activité bactérienne génère de la chaleur). Ces petits empêcheurs de tourner en rond trouvent aussi leur équivalent en développement logiciel : les bogues. Survenant un peu partout, et notamment dans les bibliothèques logicielles que nous utilisons, ils doivent être retirés dès que possible. Ils peuvent être anodins comme exposer de &lt;strong&gt;véritables vulnérabilités&lt;/strong&gt; en matière de sécurité. Il est donc essentiel de maintenir ses &lt;strong&gt;dépendances à jour&lt;/strong&gt; tout au long de l’exploitation du logiciel, et pas seulement pendant son développement.&lt;/p&gt;

&lt;h2 id=&quot;un-développement-sans-raccourcis-productivistes&quot;&gt;Un développement sans raccourcis productivistes&lt;/h2&gt;

&lt;p&gt;Gaver la terre d’intrants chimiques pour augmenter la productivité est une vision très court-termiste de l’agriculture. Elle rend notre alimentation dépendante de l’industrie pétrochimique tout en détruisant ses capacités naturelles de régénération des sols. Prendre le temps de préserver un terrain naturellement fertile permet de développer une production &lt;a href=&quot;https://www.inrae.fr/actualites/ferme-du-bec-hellouin-beaute-rend-productif&quot;&gt;riche, soutenable et résiliente&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Il en va de même pour les &lt;strong&gt;tests logiciels automatisés&lt;/strong&gt;. Leur mise en place et leur écriture demande effectivement du temps que l’on ne passe pas à développer de nouvelles fonctionnalités, mais préservent une base de code naturellement fertile. Une base de code fertile est une base de code que l’on peut faire évoluer sans avoir peur des régressions : nous en serons avertis en moins de temps qu’il n’en faut pour se faire un café.&lt;/p&gt;

&lt;p&gt;Qu’un cahier de tests automatisés puisse être joué en moins de cinq minutes et parcourt les parties cruciales de l’application, du plus petit test unitaire à la navigation de bout en bout dans le navigateur, est un harnais de sécurité essentiel pour tout projet au long-court. Ces tests sont un investissement qui apporte de plus en plus de valeur dans le temps, au fur et à mesure que l’application grossit, au fur et mesure que l’équipe évolue, au fur et à mesure que ses dépendances bougent.&lt;/p&gt;

&lt;p&gt;Comme tous les organismes qui interagissent dans un sol vivant, animaux, végétaux, champignons, bactéries, et préservent sa fertilité, ces tests automatisés tourneront sans que vous ayez besoin d’intervenir et sauveront votre &lt;strong&gt;productivité à long-terme&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;cas-décole--un-fournisseur-qui-périclite&quot;&gt;Cas d’école : un fournisseur qui périclite&lt;/h2&gt;

&lt;p&gt;Lorsque vous cultivez votre potager, vous utilisez toutes sortes d’outils plus ou moins sophistiqués, de la simple pelle au semoir de précision Coleman. Plus l’outil est sophistiqué, plus votre &lt;strong&gt;dépendance à son fournisseur&lt;/strong&gt; est grande en cas de souci. Si ce fournisseur disparaît, plus aucune assistance en cas de doute, plus aucune pièce détachée en cas de casse. Remplacer une pelle par une autre, rien de plus simple. Trouver une alternative à la Campagnole à ressorts, c’est une autre paire de manches.&lt;/p&gt;

&lt;p&gt;Imaginez maintenant que la bibliothèque d’interface graphique que vous avez choisie il y a trois ans au début de votre projet donne des signes de fin de vie : peu de mises à jour récentes, une réactivité aux remontées d’anomalie qui diminue visiblement… Il est alors temps de changer de fournisseur, et dans ce cas précis, il ne s’agit pas d’une simple pelle ! C’est dans ces situations que l’on est reconnaissant à l’équipe d’avoir gardé les composants logiciels à jour au fil du temps, et d’avoir des tests automatisés qui pourront nous rassurer quant au bon fonctionnement de l’application une fois le changement de bibliothèque mené à bien.&lt;/p&gt;

&lt;p&gt;Toute ressemblance avec ce qui arrive à Filaé en ce moment n’est pas du tout fortuite. Nous sommes confrontés à la décrépitude de &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ember-paper&lt;/code&gt;, bibliothèque de composants graphiques, et œuvrons à son remplacement par &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ember-bootstrap&lt;/code&gt;. Ce n’est pas une mince affaire, mais nos tests &lt;a href=&quot;https://gweninterpreter.org/&quot;&gt;Gwen&lt;/a&gt; sont là pour nous faire gagner temps et confiance dans notre réfection complète de l’interface graphique de Filaé.&lt;/p&gt;

&lt;h2 id=&quot;limprédicitibilité-de-lenvironnement&quot;&gt;L’imprédicitibilité de l’environnement&lt;/h2&gt;

&lt;p&gt;Tout est impermanent et rien n’est prévisible à coup sûr. Quel temps fera-t-il dans deux mois ? Quels petits insectes prendront leur quartier sur notre plant d’artichaut ? Comment le sol répondra à ce nouveau paillage cette année ? Ces bibliothèques logicielles seront-t-elles maintenues assez longtemps ? Pourrais-je les mettre à jour aisément ? Pourrais-je en changer en toute sérénité le cas échéant ? En développement logiciel aussi, il est bon d’avoir un plan, il est encore mieux d’être en capacité de l’ajuster en fonction de la réalité du terrain.&lt;/p&gt;

&lt;p&gt;À ce titre, nous nous voyons plus comme des &lt;a href=&quot;https://medium.com/@cmaitchison/are-you-a-software-gardener-f79eba5b7fb7&quot;&gt;jardiniers du logiciel&lt;/a&gt; : nous semons des graines et veillons bien à suivre leur évolution dans un environnement en mouvement. Parce que, quoi que nous fassions, un jour ou l’autre, un oiseau déposera une fiente avec une belle petite graine d’adventice qui se fera une petite place au soleil dans notre petit pré carré 🌱&lt;/p&gt;
</description>
        <pubDate>Wed, 26 May 2021 00:00:00 +0000</pubDate>
        <link>/blog/2021/05/26/cultivons-notre-potager-logiciel.html</link>
        <guid isPermaLink="true">/blog/2021/05/26/cultivons-notre-potager-logiciel.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>FILAÉ, logiciel libre pour &lt;abbr title=&apos;Unité Médico-Judiciaire&apos;&gt;UMJ&lt;/abbr&gt;</title>
        <description>&lt;p&gt;Ces dernières années ont été consacrées à une réalisation pleine de belles perspectives d’&lt;a href=&quot;/blog/2015/07/07/libre-et-agile-un-dessin-d-essaim.html&quot;&gt;essaimage&lt;/a&gt;. Sollicités à l’occasion d’un appel d’offres par l’unité médico-judiciaire des Yvelines (&lt;a href=&quot;https://www.ch-versailles.fr/UMJ/5/5/43&quot;&gt;UMJ78&lt;/a&gt;), nous avons le plaisir de vous annoncer la libération prochaine du fruit de notre collaboration : &lt;a href=&quot;https://filae.frama.io&quot;&gt;FILAÉ&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;du-papier-crayon-à-lapplication-web&quot;&gt;Du papier-crayon à l’application web&lt;/h2&gt;

&lt;h3 id=&quot;une-idée-longuement-mûrie&quot;&gt;Une idée longuement mûrie…&lt;/h3&gt;

&lt;p&gt;Depuis de nombreuses années, l’équipe de l’&lt;abbr title=&quot;Unité Médico-Judiciaire des Yvelines&quot;&gt;UMJ78&lt;/abbr&gt; imaginait de meilleures façons de collaborer au sein de leur service, sans pouvoir les mettre en œuvre jusqu’à présent, n’ayant pas trouvé de solution logicielle vraiment adaptée à leurs besoins. Ils ont donc envisagé le développement d’un logiciel :&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Spécifique&lt;/strong&gt;, en parfaite adéquation avec les exigences de leurs activités d’aujourd’hui, et évolutif, pour celles de demain ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Robuste et performant&lt;/strong&gt;, capable de gérer les milliers de rendez-vous et dossiers traités au fil des ans ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fiable et sûr&lt;/strong&gt;, eu égard à la criticité des données manipulées, à caractère médical et judiciaire.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;À l’époque, leurs modes de fonctionnement reposaient essentiellement sur :&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Des outils disparates (papier et crayons compris) qui généraient de nombreuses
&lt;strong&gt;saisies multiples&lt;/strong&gt;, avec la perte de temps et les risques d’erreur inhérents ;&lt;/li&gt;
  &lt;li&gt;Des données faiblement structurées et difficilement indexables telles que des
documents Word ou des tableaux Excel.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ils souhaitaient un véritable outil de travail les aidant au quotidien à :&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Coordonner&lt;/strong&gt; leurs activités, de la prise de rendez-vous à l’envoi et stockage des
dossiers ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Parcourir&lt;/strong&gt; les dossiers et médias à des fins documentaires ou statistiques ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Accueillir&lt;/strong&gt; de nouvelles personnes dans leur service, rapidement opérationnelles.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;une-réalisation-en-étroite-collaboration&quot;&gt;Une réalisation en étroite collaboration.&lt;/h3&gt;

&lt;p&gt;Nous avons ainsi répondu à leur sollicitation, pour les accompagner dans la réalisation de cet outil sur-mesure :&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;établissement des &lt;strong&gt;lignes directrices&lt;/strong&gt; de l’application cible ;&lt;/li&gt;
  &lt;li&gt;développement des &lt;strong&gt;fonctionnalités prioritaires&lt;/strong&gt; de ladite application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Plutôt qu’un logiciel à installer sur tous les postes, nous avons recommandé le développement d’une application Web :&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Accessible simplement&lt;/strong&gt; grâce à un navigateur Internet (y compris en situation de mobilité), et toujours à jour sans action de leur part ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Pérenne&lt;/strong&gt;, puisque indépendante du parc informatique du service, risques d’incompatibilité future extrêmement faible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pour bénéficier au plus tôt des apports de la solution logicielle, les méthodes agiles étaient idéales :&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Incrémentales&lt;/strong&gt; : ajouter progressivement de nouvelles fonctionnalités dans un logiciel déjà utilisable au quotiden ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Itératives&lt;/strong&gt; : améliorer ce qui existe pour s’adapter aux éléments nouveaux et aux retours du terrain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dans ce contexte non-marchant, nous leur avons proposé enfin de libérer ce logiciel, dans une démarche d’&lt;a href=&quot;/blog/2015/07/07/libre-et-agile-un-dessin-d-essaim.html&quot;&gt;essaimage&lt;/a&gt;. Leur enthousiasme à ce sujet a fini de nous convaincre que cette collaboration pourrait être &lt;strong&gt;des plus fructueuses&lt;/strong&gt;… Et elle le fût !&lt;/p&gt;

&lt;h3 id=&quot;des-débuts-prometteurs-&quot;&gt;Des débuts prometteurs !&lt;/h3&gt;

&lt;p&gt;Nous ne nous attarderons pas dans ce billet sur la liste des fonctionnalités développées, une &lt;a href=&quot;/realisations/filae-logiciel-libre-pour-umj.html&quot;&gt;page y est consacrée&lt;/a&gt;. Nous souhaitons plutôt revenir sur les grandes lignes de sa réalisation. Nous avons consacré plus de deux ans à ce projet, financièrement amorcé par l’&lt;abbr title=&quot;unité médico-légale des Yvelines&quot;&gt;UMJ78&lt;/abbr&gt;, et poursuivi sur nos fonds propres ; une histoire habituelle de forfait sous-estimé, mais passons… Car ce projet en vaut largement la chandelle :&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;humainement&lt;/strong&gt;, construisant une relation de pairs à pairs avec nos interlocuteurs des services médicaux et informatiques du centre hospitalier de Versailles ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;philosophiquement&lt;/strong&gt;, avec la concrétisation potentielle de la démarche d’essaimage que nous promouvons depuis des années ;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;sociétalement&lt;/strong&gt;, pour améliorer l’expérience du service public, pour toutes les parties prenantes : personnel médical, judiciaire, patients… Sans compromis sur la sécurité et la souveraineté des données de santé à caractère personnel.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Nous avons également pu mettre en œuvre tous les bienfaits des méthodes agiles, avec une mise en production rapide des premières fonctionnalités et des déploiements au fil de l’eau des nouveautés, évolutions et corrections. Nous avons également souffert de leur plus gros risque : adapter le périmètre en fonction du retour-terrain sans pour autant se mettre en capacité d’absorber l’impact financier de ces changements. Néophyte en matière de marché public, notre société a failli en subir la plus définitive des conséquences… Mais grâce à cette relation de pairs à pairs avec le &lt;abbr title=&quot;centre hospitalier de Versailles&quot;&gt;CHV&lt;/abbr&gt;, nous avons su trouver de salvateurs compromis.&lt;/p&gt;

&lt;p&gt;À ce jour, FILAÉ est utilisé quotidiennement depuis plus de deux ans, fluidifiant la communication entre le personnel médical et judiciaire. Par extension, c’est le parcours de milliers de patients par an qui s’en trouve facilité. Grâce à la libération prochaine de ce logiciel, nous espérons que cela pourra durer encore longtemps !&lt;/p&gt;

&lt;h2 id=&quot;encore-du-chemin-à-parcourir-ensemble-&quot;&gt;Encore du chemin à parcourir… Ensemble ?&lt;/h2&gt;

&lt;p&gt;Ce projet va maintenant être lâché dans la nature. Ce qui lui arrivera dépend en partie de l’effervescence de la communauté que nous tenterons, conjointement, d’amorcer. Le secteur hospitalier se prête tout particulièrement à ce mode de fonctionnement vertueux qu’est l’&lt;a href=&quot;/blog/2015/07/07/libre-et-agile-un-dessin-d-essaim.html&quot;&gt;essaimage&lt;/a&gt;. À nous maintenant de susciter l’intérêt des homologues de l’&lt;abbr title=&quot;Unité Médico-Judiciaire des Yvelines&quot;&gt;UMJ78&lt;/abbr&gt; pour mutualiser les énergies disponibles !&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Tout seul, on va plus vite. Ensemble, on va plus loin.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Si vous souhaitez en savoir plus, voire contribuer à cette belle aventure, n’hésitez pas à &lt;a href=&quot;#contact-us&quot;&gt;nous contacter &lt;i class=&quot;fa fa-arrow-circle-down&quot;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Wed, 24 Mar 2021 00:00:00 +0000</pubDate>
        <link>/blog/2021/03/24/filae-logiciel-libre-pour-umj.html</link>
        <guid isPermaLink="true">/blog/2021/03/24/filae-logiciel-libre-pour-umj.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Besoins et outils de collaboration numérique - 2/2</title>
        <description>&lt;p&gt;La question des outils numériques est une constante au sein des initiatives collectives. Comment échanger sur les sujets du moment ? Comment savoir quand Sylvie et Jean-Michel seront disponibles pour cette réunion ? Comment rédiger ce rapport d’activité à plusieurs mains ? Ne cherchez pas de réponse absolue dans ce billet, vous ne la trouverez pas ;-)&lt;/p&gt;

&lt;p&gt;Rien d’étonnant une fois que l’on sait que :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Nous ne connaissons ni Sylvie ni Jean-Michel ;&lt;/li&gt;
  &lt;li&gt;Il n’y a pas de réponse absolue à la question initiale &lt;em&gt;quel serait le meilleur mode de fonctionnement pour nous ?&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;La réponse à cette question est nécessairement le fruit de discussions et expérimentations au sein de chaque structure, les individus et leurs interactions étant propres à chacune. Notre objectif avec ce billet est de vous donner les clés pour ouvrir le champ de ces discussions et expérimentations, et finalement &lt;strong&gt;faire vos choix en connaissance de cause&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;étude-de-vos-besoins&quot;&gt;Étude de vos besoins&lt;/h2&gt;

&lt;p&gt;Point de départ de tout choix : le besoin. Quel manque souhaitons-nous combler ? Amorcer cette discussion est essentielle avant de commencer à chercher des solutions…&lt;/p&gt;

&lt;p&gt;Permettez-nous de reprendre ici la pyramide introduite dans &lt;a href=&quot;/blog/2016/05/30/besoins-outils-collaboration-numerique-1-sur-2.html&quot;&gt;le billet précédent&lt;/a&gt;, nous y ferons référence dans la suite de cet article.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   /_\    &amp;lt;- Spécialisation              Avec cet ASCII-art en lieu et
  /___\   &amp;lt;- Orchestration                  place d&apos;une image, nous
 /_____\  &amp;lt;- Mutualisation               réduisons l&apos;empreinte carbone
/_______\ &amp;lt;- Communication                 de cet article, aussi ;-)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;les-fournisseurs-de-services&quot;&gt;Les fournisseurs de services&lt;/h2&gt;

&lt;p&gt;Une fois ce bel exercice d’étude de vos besoins entamé, il va falloir trouver comment les satisfaire. Comment mettre à disposition de chacun une adresse électronique, des calendriers, des documents, se les partager, etc. Là encore, rien d’immédiat, le marché varié de fournisseurs de ce type de services n’étant pas toujours simple à déchiffrer.&lt;/p&gt;

&lt;h3 id=&quot;offres-propriétaires-clés-en-main&quot;&gt;Offres propriétaires clés en main&lt;/h3&gt;

&lt;p&gt;Les solutions les plus complètes et les plus rapides à mettre en place sont celle de Google et dans une moindre mesure celle de Microsoft, respectivement &lt;em&gt;Google Apps for Work&lt;/em&gt; et &lt;em&gt;Office 365&lt;/em&gt;. Moyennant le paiement de quelques euros par mois par utilisateur, vous mettez à disposition de votre structure de nombreux outils qui couvrent les trois premiers étages de la pyramide présentée plus tôt.&lt;/p&gt;

&lt;p&gt;Ces deux fournisseurs requièrent la possession d’un nom de domaine. Cela reste un investissement raisonnable avec de nombreux avantages, vous ne devriez pas hésiter. Nous ne vous parlerons d’ailleurs pas ici de l’option « comptes Gmail gratuits pour chaque collaborateur », qui n’atteint pas le troisième étage de la pyramide, et est donc un véritable casse-tête au quotidien&lt;sup id=&quot;fnref:domain&quot;&gt;&lt;a href=&quot;#fn:domain&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;L’aspect rédhibitoire à nos yeux (et c’est un euphémisme) est la perte de maitrise de vos données. Vous envoyez tout cela à un tiers on ne sait où et vous ne savez pas exactement ce qui en sera fait. À titre d’exemple, vous aurez sans doute remarqué que Gmail affiche quelques publicités à côté de vos courriels, et plutôt pertinentes qui plus est ; simple quand on se permet de &lt;a href=&quot;https://www.google.com/intl/fr/policies/privacy/#infouse&quot;&gt;lire le contenu de la conversation&lt;/a&gt;…&lt;/p&gt;

&lt;h3 id=&quot;outils-libres-à-héberger&quot;&gt;Outils libres à héberger&lt;/h3&gt;

&lt;p&gt;À l’opposé du spectre des libertés se trouvent les logiciels libres. Ici, la transparence est de mise : tout le code source est consultable, utilisable et modifiable à loisir. Aucune surprise pour qui sait le lire ou se fait assister pour. Le moindre écart éthique pourra être décelé et discuté ; il l’est d’ailleurs bien avant que le logiciel arrive tout bien empaqueté sur votre système, grâce à la veille des communautés d’utilisateurs.&lt;/p&gt;

&lt;p&gt;Comme aucune solution n’est idéale, il existe bien quelques inconvénients. L’un d’entre eux participe tout particulièrement à la faible adoption de ces solutions : les offres clés en main restent très confidentielles. La dynamique entourant ces logiciels promeut l’auto-hébergement, avec les compétences techniques que cela implique, afin de garantir la fameuse maitrise des données évoquée plus tôt. Il convient donc de s’entourer de personnes de confiance ayant ces compétences, et ce n’est pas toujours aisé et/ou accessible, en fonction de la nature de votre structure.&lt;/p&gt;

&lt;p&gt;Ainsi, vous pourrez trouver quelques offres commerciales mettant à disposition des outils libres en quelques clics, mais peu garantissent la localisation des données en France. Nous ne manquerons pas de citer par ailleurs l’initiative de Framasoft qui, souhaitant &lt;a href=&quot;http://degooglisons-internet.org/&quot;&gt;dégoogliser Internet&lt;/a&gt;, héberge &lt;strong&gt;gratuitement&lt;/strong&gt; une &lt;a href=&quot;http://degooglisons-internet.org/liste&quot;&gt;liste de plus en plus longue de services&lt;/a&gt; disponibles en quelques secondes. Ainsi, vous pourrez satisfaire nombre de besoins des deux premiers étages à moindre frais&lt;sup id=&quot;fnref:soutien&quot;&gt;&lt;a href=&quot;#fn:soutien&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Malheureusement, le troisième étage ne fait pas partie des plans de l’association.&lt;/p&gt;

&lt;h2 id=&quot;les-interfaces-dinteraction&quot;&gt;Les interfaces d’interaction&lt;/h2&gt;

&lt;p&gt;Si nous faisons le point avant d’attaquer le dernier composant de cette problématique, nous avons :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;d’un côté vos besoins (communication électronique, calendriers partagés…)&lt;/li&gt;
  &lt;li&gt;de l’autre des fournisseurs de services qui mettent à disposition l’infrastructure nécessaire pour les satisfaire (serveurs de courriels, de calendriers, de fichiers…).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Le lien entre les deux se fait par l’intermédiaire des interfaces mises à disposition ou non par le fournisseur de services. Et sur ce point encore, différentes stratégies vous sont proposées…&lt;/p&gt;

&lt;h3 id=&quot;le-tout-en-un-de-google&quot;&gt;Le tout-en-un de Google&lt;/h3&gt;

&lt;p&gt;Google est le champion de l’expérience utilisateur homogène et riche. En plus des infrastructures de services, leurs équipes ont développé des interfaces propriétaires avec un accent tout particulier mis sur leur cohérence. Que vous soyez dans l’interface de communication par courriel &lt;em&gt;Inbox&lt;/em&gt;, dans l’outil de cartographie &lt;em&gt;Maps&lt;/em&gt; ou dans le gestionnaire de fichiers &lt;em&gt;Drive&lt;/em&gt;, l’agencement des contenus, les codes couleurs, les iconographies et les autres éléments d’UX seront identiques.&lt;/p&gt;

&lt;p class=&quot;nota-bene&quot;&gt;UX est l’abbréviation de l’anglais « User eXperience », expérience utilisateur. Cette notion regroupe les caractéristiques d’un produit qui ont une influence sur le ressenti d’une personne quant à l’utilisation dudit produit. Il s’agit évidemment des éléments visuels (positions, formes, couleurs) mais également des comportements en réaction aux actions de l’utilisateur. Cette notion s’applique à toute sorte de produits, qu’ils soient matériels ou non. On peut ainsi parler de l’UX de Firefox, le navigateur, comme de l’UX de Starbucks, la chaine de cafés.&lt;/p&gt;

&lt;p&gt;Google pousse le curseur très loin dans cette démarche. Par exemple :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ces interfaces spécifiques ont pour beaucoup été développées initialement pour un accès via votre navigateur et ont désormais leur variante iOS et Android. Et ce tout en respectant les &lt;a href=&quot;https://www.google.com/design/spec/material-design/introduction.html&quot;&gt;lignes directrices maison&lt;/a&gt;. Vous avez donc une expérience homogène quel que soit le périphérique par lequel vous accédez à vos informations ;&lt;/li&gt;
  &lt;li&gt;si vous mettez le lien d’un document présent dans votre &lt;em&gt;Drive&lt;/em&gt; dans un courriel, l’interface de communication par courriel &lt;em&gt;Gmail&lt;/em&gt; vérifiera en arrière-plan que les destinataires du courriel ont bien le droit d’accéder au document. Si tel n’est pas le cas, vous en serez averti et &lt;em&gt;Gmail&lt;/em&gt; vous offrira la possibilité de corriger cela directement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nous nous rendons bien compte qu’en vous détaillant tout cela, nous pouvons susciter de l’intérêt pour leur plateforme, alors que nous faisons tout pour en sortir. D’un autre côté, si vous êtes ici, c’est que les problématiques autour du logiciel libre vous interpellent, voire vous intéressent. Disons alors qu’il s’agit de dépeindre de façon un tant soit peu objective le spectre des possibilités offertes, tout en ne manquant pas d’y glisser notre avis. Et puis, qui sait, cela peut être aussi une source d’inspiration pour un futur projet ;-)&lt;/p&gt;

&lt;h3 id=&quot;patchwork-doutils-reposant-sur-des-standards&quot;&gt;Patchwork d’outils reposant sur des standards&lt;/h3&gt;

&lt;p&gt;Pour répondre aux mêmes besoins qu’avec la nébuleuse Google, il est nécessaire dans le monde libre de combiner différents outils. Les choses se compliquent alors pour les utilisateurs. Chacun de ces outils a sa propre interface, avec son identité visuelle, et devoir naviguer de l’une à l’autre peut être déroutant. Il est important de bien identifier les responsabilités de chaque outil pour que cela soit clair dans l’esprit de tous. D’autant plus que les périmètres de certains d’entre eux peuvent se recouper, par exemple :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;vous utilisez &lt;em&gt;SOGo&lt;/em&gt; pour la gestion de vos calendriers et contacts pour la qualité de son interface ;&lt;/li&gt;
  &lt;li&gt;vous utilisez &lt;em&gt;ownCloud&lt;/em&gt; pour le stockage partagé de fichiers, sachant que cet outil permet aussi de gérer calendriers et contacts, mais moins adapté à votre façon de fonctionner ;&lt;/li&gt;
  &lt;li&gt;il faudra donc prendre soin de désactiver ces deux derniers modules afin d’éviter que des calendriers ou contacts ne se retrouvent dans des outils différents…&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Heureusement, des &lt;strong&gt;standards&lt;/strong&gt; ont vu le jour, permettant aux outils de discuter entre eux, et avec les utilisateurs. En combinant judicieusement ces standards, il est possible de simplifier la vie des utilisateurs.&lt;/p&gt;

&lt;p&gt;Sans vous inonder de jargon technico-technique, il est important de savoir que l’interopérabilité des systèmes est un enjeu majeur de toute technologie, laissant l’utilisateur libre de choisir ses outils. Ainsi, pour les courriels, le protocole standard le plus répandu désormais porte le doux nom d’IMAP, successeur du non moins connu POP3&lt;sup id=&quot;fnref:pop3&quot;&gt;&lt;a href=&quot;#fn:pop3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;. Et ce sera CalDAV pour les calendriers, CardDAV pour les contacts, XMPP pour la messagerie instantanée, entre autres. Grâce à la définition de ces standards, de nombreuses interfaces ont vu le jour, reposant chacune sur une philosophie, une technologie ou un modèle économique propre, mais toutes capables de vous aider à gérer vos courriels et/ou calendriers et/ou contacts, etc. À vous de choisir celui qui vous convient le mieux.&lt;/p&gt;

&lt;p&gt;Petite mise en situation, pour ne pas perdre les bonnes habitudes. &lt;a href=&quot;https://www.mozilla.org/fr/thunderbird/&quot;&gt;&lt;em&gt;Thunderbird&lt;/em&gt;&lt;/a&gt; est une application libre permettant la gestion des courriels, contacts et calendriers. Grâce à ses différents connecteurs standards, il est tout à fait possible d’y configurer un serveur de courriels hébergé par Gandi, un serveur de contacts &lt;em&gt;ownCloud&lt;/em&gt; et un serveur de calendriers &lt;em&gt;SOGo&lt;/em&gt;. Ainsi, à travers une seule interface, vous utiliserez de façon tout à fait transparente trois fournisseurs de services ; et ce sans jamais voir les trois interfaces, largement différentes, de chaque service.&lt;/p&gt;

&lt;h2 id=&quot;nos-envies-de-catalyse&quot;&gt;Nos envies de catalyse&lt;/h2&gt;

&lt;p&gt;Si vous avez eu le courage de lire jusque là, vous arriverez peut-être à la même conclusion que nous : les outils libres existent pour satisfaire les besoins de collaboration, mais l’expérience utilisateur globale n’atteint pas la fluidité des offres propriétaires proposées par les géants du Web. Entre les compétences nécessaires à leur mise en place et les efforts d’intégration à demander aux utilisateurs, il est aisé de comprendre pourquoi la plupart des structures ne choisiront pas la voie libre.&lt;/p&gt;

&lt;p&gt;Maintenant que les difficultés sont exposées, l’essentiel n’est pas de rester sur ce simple constat, mais d’agir pour influer sur la tendance.&lt;/p&gt;

&lt;h3 id=&quot;catalyseur-dinteractions-libres&quot;&gt;Catalyseur d’interactions libres&lt;/h3&gt;

&lt;p&gt;En chimie, un catalyseur est une molécule qui favorise la réaction entre d’autres molécules. Elle n’en modifie pas le résultat, elle accélère simplement le processus. Voilà le rôle que nous aimerions jouer.&lt;/p&gt;

&lt;p&gt;Un travail incroyable a été réalisé depuis des décennies, pour proposer des outils libres gérant des courriels, des calendriers, des contacts… Ce travail de qualité, testé et approuvé par une poignée (à l’échelle de l’humanité) de privilégiés&lt;sup id=&quot;fnref:privileges&quot;&gt;&lt;a href=&quot;#fn:privileges&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;, devrait pouvoir profiter à tous. L’idée n’est pas de réinventer le métier à tisser, mais bien de construire un &lt;em&gt;patchwork&lt;/em&gt; de solutions existantes, avec juste les bonnes coutures pour présenter une étoffe cohérente.&lt;/p&gt;

&lt;p&gt;Nous rêvons d’un formulaire où renseigner une adresse électronique et un nom de domaine, qui, après validations, rend disponibles tous ces outils comme s’ils n’en faisaient qu’un… Connectez-vous une seule fois, et vous voilà connecté à tous. Ajoutez un collaborateur à votre structure, et voilà qu’il apparait dans le carnet d’adresses de tous les autres, sur tous leurs périphériques. Envoyez un message instantané à votre coéquipier, et lui le reçoit par courriel car il n’est pas connecté pour le moment… Et tout ça derrière un simple formulaire avec deux champs texte ;-)&lt;/p&gt;

&lt;p&gt;Mais n’oublions pas : la cohérence de l’expérience utilisateur est un enjeu majeur. Notre ambition n’est pas de juxtaposer pléthore de services, mais de faire comme si ceux proposés n’étaient qu’un, du point de vue de la personne derrière l’écran. Cela est pour nous une des clés de la réussite d’une telle épopée. Tout le monde n’a pas la patience d’assimiler que pour les courriels, c’est le &lt;em&gt;RoundCube&lt;/em&gt; de Gandi, pour les calendriers et les courriels, c’est un &lt;em&gt;SOGo&lt;/em&gt; maison, et la discussion instantanée, c’est le &lt;em&gt;Mattermost&lt;/em&gt; de Framasoft…&lt;/p&gt;

&lt;h3 id=&quot;prenez-part-à-la-construction&quot;&gt;Prenez part à la construction&lt;/h3&gt;

&lt;p&gt;Le terme « épopée » n’a pas été choisi au hasard dans le paragraphe précédent. Bien que sacrément dense, cet article est de loin la partie la plus simple. Nous n’avons aucune idée du temps que peut prendre la mise à disposition d’une première version qui se contenterait de courriels, calendriers et contacts. Et pourquoi pas courriels et discussions instantanées, plutôt, pour commencer ? Vous voyez, nous avons besoin de coups de main ;-)&lt;/p&gt;

&lt;p&gt;Si le sujet vous intéresse et que vous avez envie de partager, n’hésitez pas à nous &lt;a href=&quot;#contact-us&quot;&gt;glisser un petit mot&lt;/a&gt;. Comme on le dit dans &lt;a href=&quot;https://git.framasoft.org/CDSA33/OLIGAA#comment-contribuer-&quot;&gt;le README&lt;/a&gt; de chacun de nos projets, le code n’est pas la seule contribution qui ait de la valeur : les retours du terrain, des personnes qui ont besoin de ces outils, sont primordiaux pour s’assurer d’offrir les bonnes fonctionnalités au bon moment.&lt;/p&gt;

&lt;p&gt;Sur ce, nous avons quelques hébergeurs français à comparer, quelques solutions techniques à éprouver et quelques hypothèses à vérifier pour transformer cette intuition en conviction. Nous vous laissons avec nos réflexions embryonnaires, en espérant que nous pourrons en discuter ensemble si cela fait écho chez vous.&lt;/p&gt;

&lt;p&gt;Au plaisir !&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:domain&quot;&gt;
      &lt;p&gt;Vraiment, les adresses Orange ou Gmail, ça fait moins sérieux… Et entre 10 et 50 € l’année, ce serait dommage de s’en priver. &lt;a href=&quot;#fnref:domain&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:soutien&quot;&gt;
      &lt;p&gt;Un &lt;a href=&quot;https://soutenir.framasoft.org/&quot;&gt;petit don&lt;/a&gt; doit toujours leur faire plaisir, ceci dit. &lt;a href=&quot;#fnref:soutien&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:pop3&quot;&gt;
      &lt;p&gt;Si vous utilisez encore du POP3 alors que votre fournisseur de service vous propose de l’IMAP, reconfigurez votre client pour utiliser ce dernier. &lt;a href=&quot;#fnref:pop3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:privileges&quot;&gt;
      &lt;p&gt;Oui, nous considérons que des gens qui ont le choix et peuvent garantir leurs libertés sont des privilégiés. &lt;a href=&quot;#fnref:privileges&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Tue, 31 May 2016 00:00:00 +0000</pubDate>
        <link>/blog/2016/05/31/besoins-outils-collaboration-numerique-2-sur-2.html</link>
        <guid isPermaLink="true">/blog/2016/05/31/besoins-outils-collaboration-numerique-2-sur-2.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Besoins et outils de collaboration numérique - 1/2</title>
        <description>&lt;p&gt;Plongés au cœur d’associations et de collectifs cherchant à collaborer efficacement au quotidien, la question des outils numériques revient sans cesse. Par le présent article, nous tentons de vous offrir une grille de lecture des besoins récurrents des structures collaboratives, afin de vous aider à faire le point sur votre situation propre.&lt;/p&gt;

&lt;h2 id=&quot;la-hiérarchie-des-besoins&quot;&gt;La hiérarchie des besoins&lt;/h2&gt;

&lt;p&gt;Forts de moult années de tentatives de collaboration électronique, nous nous sommes essayés à imaginer la pyramide de Maslow représentant la hiérarchie des besoins en outils numériques.&lt;/p&gt;

&lt;p class=&quot;nota-bene&quot;&gt;La &lt;a href=&quot;https://fr.wikipedia.org/wiki/Pyramide_des_besoins&quot;&gt;pyramide de Maslow&lt;/a&gt; est un modèle qui atteint rapidement ses limites quand on rentre dans le détail, mais qui a l’avantage d’être très synthétique pour une vision d’ensemble. Et de toute façon, comme disait George Box, « tous les modèles sont faux, mais certains sont utiles » ;-)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   /_\    &amp;lt;- Spécialisation              Avec cet ASCII-art en lieu et
  /___\   &amp;lt;- Orchestration                  place d&apos;une image, nous
 /_____\  &amp;lt;- Mutualisation               réduisons l&apos;empreinte carbone
/_______\ &amp;lt;- Communication                    de cet article ;-)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Abraham Maslow indique que la recherche de l’assouvissement des besoins de plus haut niveau passe par l’assouvissement des besoins plus primaires. Et nous pensons que cela est globalement vrai. Détaillons un peu plus chaque étage de cette pyramide pour vous aider à vous situer.&lt;/p&gt;

&lt;h3 id=&quot;communication&quot;&gt;Communication&lt;/h3&gt;

&lt;p&gt;Nous n’allons pas faire trois cents mots sur ce premier étage concernant la communication. Les concepts de courriel, de messagerie instantanée et de liste de discussion sont assez répandus. Synthétisons tout ça rapidement dans un tableau à double entrée : nombre d’interlocuteurs et délai de réponse.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;th&gt;Échange en quelques minutes&lt;/th&gt;
      &lt;th&gt;Échange en quelques heures&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;2 interlocuteurs&lt;/th&gt;
      &lt;td&gt;Message instantanée&lt;/td&gt;
      &lt;td&gt;Courriel&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3 interlocuteurs et plus&lt;/th&gt;
      &lt;td&gt;Salon de discussion&lt;/td&gt;
      &lt;td&gt;Liste de diffusion, forum&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;À vous de considérer maintenant vos besoins et le reste à faire pour satisfaire ce premier niveau d’exigence.&lt;/p&gt;

&lt;h3 id=&quot;mutualisation&quot;&gt;Mutualisation&lt;/h3&gt;

&lt;p&gt;Maintenant que les bons canaux de communication sont ouverts, il est aisé de discuter des sujets du moment, et de se partager des informations. Seul souci, toutes ces informations vont circuler dans des contenants très éphémères, rapidement obsolètes :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;le créneau horaire disponible de Sylvie évoqué dans un échange instantané la semaine dernière est finalement occupé par une réunion d’information ;&lt;/li&gt;
  &lt;li&gt;l’adresse électronique de Guy demandée sur la liste de discussion dédiée aux partenariats a changé depuis que son employeur a investi dans un nom de domaine&lt;sup id=&quot;fnref:domain&quot;&gt;&lt;a href=&quot;#fn:domain&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; ;&lt;/li&gt;
  &lt;li&gt;la dernière version du rapport d’activité est-elle celle envoyée par Saïd mercredi ou celle envoyée par Sylvie jeudi, toutes les deux en réponse à celle de Marjorie ? À moins que ce soit celle de Jean-Michel, qui devait travailler dessus avant de partir en congés. Attendons qu’il revienne…&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Vous l’aurez compris, sans référentiel collectif, unique, l’information circule mais sa fraîcheur est toujours à vérifier. De nombreuses données sont pourtant aisées à partager, avec un contrôle très fin de ce qui l’est ou non :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;calendriers : planifiez vos réunions plus simplement, fluidifiez la réservation de ressources communes comme les salles de réunion ou les véhicules de service…&lt;/li&gt;
  &lt;li&gt;contacts : disposez d’un annuaire de tous les collaborateurs et partenaires, toujours à jour et accessible ;&lt;/li&gt;
  &lt;li&gt;documents : stockez vos fichiers en un lieu unique, où chaque mise à jour sera automatiquement transférée à tous.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Voila l’essentiel des informations de base que nombre d’organisations gagneraient à partager en leur sein. D’autres peuvent avoir du sens chez vous, cette liste n’est pas exhaustive, mais cela nous semble un bon pied à l’étrier !&lt;/p&gt;

&lt;h3 id=&quot;orchestration&quot;&gt;Orchestration&lt;/h3&gt;

&lt;p&gt;Vous voilà parés pour la collaboration numérique : tout le monde a son adresse électronique, sa messagerie instantanée, ses calendriers, contacts et documents privés et mutualisés… Bref, ça crée et partage à tout va. Et à plus de deux personnes, c’est à ce moment-là que les choses se compliquent :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Sylvie crée un nouveau calendrier pour le dernier véhicule de service acquis. Elle doit alors le partager explicitement à tous les collaborateurs ;&lt;/li&gt;
  &lt;li&gt;Georges rejoint votre organisation. Vous allez devoir lui partager un à un tous les calendriers, carnets d’adresses et vous assurer qu’il a bien accès à tous les documents pertinents pour lui ;&lt;/li&gt;
  &lt;li&gt;Jean-Michel vogue vers de nouveaux horizons professionnels ou associatifs. Vous devez vous assurer de lui retirer l’accès à tous les éléments précédemment partagés…&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;La notion de &lt;strong&gt;structure&lt;/strong&gt; devient essentielle, avec la capacité de partage non-nominatif qu’elle amène. Je ne partage plus ce document avec Sylvie, Jean-Michel et les 16 autres membres de la structure, je le partage à toute personne de la structure. Vous me direz que, pour le coup, le résultat est le même. En effet, à ceci près que :&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Sylvie a juste eu à le partager à la structure, pas aux dix-sept autres personnes ;&lt;/li&gt;
  &lt;li&gt;quand Georges sera ajouté à la structure, il aura accès à tout ce qui aura été partagé à la structure, automatiquement ;&lt;/li&gt;
  &lt;li&gt;quand Jean-Michel vous quittera, il sera retiré de la structure et ne pourra plus accéder à ces informations, automatiquement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cette notion de &lt;strong&gt;structure&lt;/strong&gt; fait naître un service dont la responsabilité sera de gérer les comptes-utilisateurs et les habilitations associées à chacun. Il fera en sorte que toutes les personnes de la structure aient bien accès à toutes les informations, et seulement elles.&lt;/p&gt;

&lt;h3 id=&quot;spécialisation&quot;&gt;Spécialisation&lt;/h3&gt;

&lt;p&gt;Ce dernier étage est celui sur lequel nous intervenons habituellement. Une fois les besoins ci-dessus remplis à un niveau d’exigence nécessaire et suffisant pour votre structure, vous vous rendez vite compte que ce qu’il vous faut pour vous faciliter encore le quotidien n’existe pas prêt à l’emploi. Vous ne cherchez plus des outils génériques qui remplissent des fonctions support mais bien des outils spécialisés au cœur de votre activité.&lt;/p&gt;

&lt;p&gt;Ces outils sortent donc du périmètre de ce billet. Si vous souhaitez discuter plus en détails de ces questions, n’hésitez pas à &lt;a href=&quot;#contact-us&quot;&gt;nous en parler&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;et-ensuite-&quot;&gt;Et ensuite ?&lt;/h2&gt;

&lt;p&gt;Une fois ce bel exercice d’étude de vos besoins entamé, il va falloir trouver comment les satisfaire. Et c’est justement le sujet &lt;a href=&quot;/blog/2016/05/31/besoins-outils-collaboration-numerique-2-sur-2.html&quot;&gt;du billet suivant&lt;/a&gt; !&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:domain&quot;&gt;
      &lt;p&gt;Vous devriez faire de même, les adresses Orange ou Gmail, ça fait moins sérieux… Et entre 10 et 50 € l’année, c’est un investissement raisonnable. &lt;a href=&quot;#fnref:domain&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 30 May 2016 00:00:00 +0000</pubDate>
        <link>/blog/2016/05/30/besoins-outils-collaboration-numerique-1-sur-2.html</link>
        <guid isPermaLink="true">/blog/2016/05/30/besoins-outils-collaboration-numerique-1-sur-2.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Activité libre en ce début 2016</title>
        <description>&lt;p&gt;Cette année démarre sous de libres et bons auspices. Nous avons mis à disposition deux nouveaux projets, que nous continuons de faire grandir petit à petit, avec l’aide des premiers contributeurs : &lt;a href=&quot;https://git.framasoft.org/CDSA33/OLIGAA&quot;&gt;OLIGAA&lt;/a&gt; et &lt;a href=&quot;https://git.framasoft.org/infopiiaf/redhopper&quot;&gt;Redhopper&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;oligaa&quot;&gt;OLIGAA&lt;/h2&gt;

&lt;p&gt;Vous souvenez-vous du &lt;a href=&quot;http://www.cdsa33.org/&quot;&gt;CDSA33&lt;/a&gt;, ce client de la première heure avec qui nous avons construit un &lt;a href=&quot;/realisations/cdsa33.html&quot;&gt;outil de gestion de l’activité et de la communication&lt;/a&gt;  de leur comité départemental ? Il se trouve que la démarche d’essaimage (que nous vous &lt;a href=&quot;/blog/2015/06/01/libre-et-agile-un-dessein-d-essaim.html&quot;&gt;présentions&lt;/a&gt; et &lt;a href=&quot;/blog/2015/07/07/libre-et-agile-un-dessin-d-essaim.html&quot;&gt;dessinions&lt;/a&gt; précédemment) a fait écho chez eux. Nous avons donc travaillé de concert à libérer le fruit de ces cinq ans de collaboration. Entre les développements pour anonymiser l’application et la rendre personnalisable, et les conditions légales et méthodologiques de la transition à déterminer, ces dernières semaines ont été riches en apprentissages et en échanges.&lt;/p&gt;

&lt;p&gt;Nous sommes heureux de mettre à disposition un logiciel permettant de faciliter le quotidien des structures œuvrant pour le développement local de l’offre sportive à destination des personnes en situation de handicap mental et psychique. Le mieux dans tout ça, c’est &lt;strong&gt;qu’il n’est pas limité à son périmètre originel&lt;/strong&gt;, mais pourrait être utilisé par les comités Handisport, ou toute autre organisation dont la mission est le soutien aux acteurs locaux de son secteur d’activité.&lt;/p&gt;

&lt;p&gt;Mais trêve de bavardage, découvrez en images la partie immergée de l’iceberg.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/oligaa/01-Evenements-Calendrier.png&quot; rel=&quot;prettyPhoto[oligaa]&quot;&gt;
  &lt;img src=&quot;/images/oligaa/01-Evenements-Calendrier.png&quot; alt=&quot;Calendrier des événements&quot; /&gt;
&lt;/a&gt;
&lt;a href=&quot;/images/oligaa/02-Membres-Carte.png&quot; rel=&quot;prettyPhoto[oligaa]&quot;&gt;
  &lt;img src=&quot;/images/oligaa/02-Membres-Carte.png&quot; alt=&quot;Carte des membres&quot; /&gt;
&lt;/a&gt;
&lt;a href=&quot;/images/oligaa/03-Evenements-ListeAdmin-Ellipse.png&quot; rel=&quot;prettyPhoto[oligaa]&quot;&gt;
  &lt;img src=&quot;/images/oligaa/03-Evenements-ListeAdmin-Ellipse.png&quot; alt=&quot;Administration des événements&quot; /&gt;
&lt;/a&gt;
&lt;a href=&quot;/images/oligaa/04-Membres-DetailsAdmin.png&quot; rel=&quot;prettyPhoto[oligaa]&quot;&gt;
  &lt;img src=&quot;/images/oligaa/04-Membres-DetailsAdmin.png&quot; alt=&quot;Administration des membres&quot; /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pour de plus amples détails sur la mise en œuvre de cette application web, nous vous invitons à vous rendre sur le &lt;a href=&quot;https://git.framasoft.org/CDSA33/OLIGAA&quot;&gt;dépôt du projet&lt;/a&gt; et/ou nous &lt;a href=&quot;#contact-us&quot;&gt;envoyer un petit message&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;redhopper&quot;&gt;Redhopper&lt;/h2&gt;

&lt;p&gt;Un bon artisan se doit d’utiliser toujours les outils les plus adaptés à ses besoins. Et quand un outil en particulier ne répond pas parfaitement, il doit en changer ou l’améliorer. C’est cette seconde approche que nous avons adopté pour notre outil de gestion de projets.&lt;/p&gt;

&lt;p&gt;Globalement très satisfaits des possibilités offertes par &lt;a href=&quot;http://www.redmine.org/&quot;&gt;Redmine&lt;/a&gt;, nous étions cependant frustrés par un aspect bien précis : le manque de visibilité opérationnelle qu’offrait son système d’inventaire de demandes. Avoir une liste d’éléments groupés par statut (&lt;em&gt;à faire, en cours, à revoir, terminé…&lt;/em&gt;) et triés par niveau de priorité (&lt;em&gt;faible, normale, élevée, critique&lt;/em&gt;) ne nous suffisait pas pour avoir une bonne vision de l’avancement du projet au quotidien.&lt;/p&gt;

&lt;p&gt;Convaincus sur ce point par les &lt;em&gt;kanban boards&lt;/em&gt;, nous nous sommes attelés à l’écriture d’un greffon pour Redmine après avoir essayé ceux déjà disponibles. Ces derniers demandaient un trop gros investissement en temps pour être opérationnels, réinventant la roue en faisant fi des forces intrinsèques de Redmine. &lt;em&gt;A contrario&lt;/em&gt;, Redhopper, notre greffon, est utilisable dès l’installation, reposant autant que faire se peut sur la configuration actuelle de vos projets.&lt;/p&gt;

&lt;p&gt;Permettez-nous de faire l’économie de mille mots en vous présentant une capture d’écran de la vue &lt;em&gt;Kanbans&lt;/em&gt; mise à disposition par Redhopper.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/redhopper/01-Kanbans.png&quot; rel=&quot;prettyPhoto[redhopper]&quot;&gt;
  &lt;img src=&quot;/images/redhopper/01-Kanbans.png&quot; alt=&quot;Tâches sous forme de kanbans.&quot; /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p class=&quot;nota-bene&quot;&gt;La gestion du flux de production par ce système de cartes (les &lt;em&gt;kanbans&lt;/em&gt;) est apparu chez Toyota dans les années 50. Il a inspiré la &lt;a href=&quot;https://fr.wikipedia.org/wiki/Kanban_%28d%C3%A9veloppement%29&quot;&gt;méthode de développement logiciel du même nom&lt;/a&gt;, que nous utilisons au quotidien. L’accent mis sur la visualisation du flux et la limite de l’encours nous permet d’assurer la transparence nécessaire à une collaboration saine et une livraison de valeur fréquente et de qualité.&lt;/p&gt;

&lt;p&gt;Pour de plus amples informations, vous pouvez vous rendre sur le &lt;a href=&quot;https://git.framasoft.org/infopiiaf/redhopper&quot;&gt;dépôt du projet&lt;/a&gt; et/ou &lt;a href=&quot;#contact-us&quot;&gt;prendre contact avec nous&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;et-la-suite-&quot;&gt;Et la suite ?&lt;/h2&gt;

&lt;p&gt;Ces projets sont maintenant lâchés dans la nature. Ce qui leur arrivera ne dépend quasiment plus de nous, en somme. Nous allons poursuivre leurs développements, et espérons qu’ils susciteront l’intérêt et pourront rendre la vie plus facile à d’autres organisations. Redhopper est déjà &lt;a href=&quot;https://git.framasoft.org/infopiiaf/redhopper/commit/1435c03da25ca8adaef60c6d3374f773eefaf32e&quot;&gt;traduit en portugais brésilien&lt;/a&gt; grâce à une contribution transatlantique spontanée. Quel plaisir !&lt;/p&gt;

&lt;p&gt;De nouveaux projets s’esquissent, prennent vie dans nos têtes, et feront peut-être l’objet d’un article aussi enthousiaste que celui-ci dans le futur. De nombreux secteurs se prêtent tout particulièrement à ce mode de fonctionnement vertueux qu’est l’&lt;a href=&quot;/blog/2015/07/07/libre-et-agile-un-dessin-d-essaim.html&quot;&gt;essaimage&lt;/a&gt;. Il ne reste plus que nous nous trouvions mutuellement ;-)&lt;/p&gt;
</description>
        <pubDate>Thu, 12 May 2016 00:00:00 +0000</pubDate>
        <link>/blog/2016/05/12/activite-libre-2016t1.html</link>
        <guid isPermaLink="true">/blog/2016/05/12/activite-libre-2016t1.html</guid>
        
        
        <category>blog</category>
        
      </item>
    
  </channel>
</rss>
