<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: David Boureau</title>
    <description>The latest articles on Forem by David Boureau (@bdavidxyz).</description>
    <link>https://forem.com/bdavidxyz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F561240%2F4232d2c5-c77b-4caa-a8ab-9e85c10309da.png</url>
      <title>Forem: David Boureau</title>
      <link>https://forem.com/bdavidxyz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bdavidxyz"/>
    <language>en</language>
    <item>
      <title>Git clean local branches</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Tue, 27 May 2025 06:08:44 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/git-clean-local-branches-14c7</link>
      <guid>https://forem.com/bdavidxyz/git-clean-local-branches-14c7</guid>
      <description>&lt;p&gt;Article originally published here &lt;a href="https://alsohelp.com/blog/git-clean-local-branches" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/git-clean-local-branches&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have some problem with images here on dev.to, so article above may display everything in a better way&lt;/p&gt;

&lt;p&gt;Article below :&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Let's say you are on your machine, and your local repository has too many branches :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;my_lovely_but_old_project&amp;gt; git branch
&lt;span class="k"&gt;*&lt;/span&gt; Story-4965-password-complexity
  Story-4998-Clean-up-code-from-unnecesssary-comments
  PM25-modification
  blabla
  debug1
  debug2
  debug3
  debug4
  blabla2
  debugging-lm-4730
  doc-get-incident
  doc-incident
  docs/v5apiLocations
  document-api-separately
  main
  development
  refactor/gcalendar-sync
  &lt;span class="nb"&gt;.&lt;/span&gt;
  &lt;span class="nb"&gt;.&lt;/span&gt;
  &lt;span class="nb"&gt;.&lt;/span&gt;
  &lt;span class="o"&gt;(&lt;/span&gt;... and much more branches&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to &lt;strong&gt;locally clean branches that are already destroyed on the remote repository&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;There you go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git fetch &lt;span class="nt"&gt;-ap&lt;/span&gt; &lt;span class="nt"&gt;--progress&lt;/span&gt; 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;'\[deleted\]'&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $NF}'&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s|origin/||'&lt;/span&gt;  | xargs git branch &lt;span class="nt"&gt;-D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;p&lt;/code&gt; option of fetch will prune remotes that don't exist anymore&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;progress&lt;/code&gt; option scratched my head... without it, the terminal is unable to read the output of the git command&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;awk print NF...&lt;/code&gt; reads the last word&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sed ...&lt;/code&gt; removes un-needed origin prefix (we delete local branches)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;xargs git branch -D&lt;/code&gt; finally removes all required branches&lt;/li&gt;
&lt;li&gt;pfew!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Recreate the problem at home
&lt;/h2&gt;

&lt;p&gt;Replace username by your actual GitHub user name.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new GitHub repository &lt;code&gt;supercleaner&lt;/code&gt; (tick "create a readme" checkbox)&lt;/li&gt;
&lt;li&gt;Clone it locally &lt;code&gt;git clone git@github.com:_username_/supercleaner.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd supercleaner&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create 4 branches locally
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; branch1 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin branch1
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; branch2 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin branch2
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; branch3 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin branch3
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; branch4 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin branch4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now go to GitHub &lt;a href="https://github.com/_username_/supercleaner/branches" rel="noopener noreferrer"&gt;https://github.com/_username_/supercleaner/branches&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Delete branches "branch1" and "branch3"&lt;/li&gt;
&lt;li&gt;Good! So now only branch2 and branch4 exist on the remote repository. Locally, you still have 4 branches.&lt;/li&gt;
&lt;li&gt;Go back to the main branch &lt;code&gt;git checkout main&lt;/code&gt; so that we won't cut the branch on which we are sat :)&lt;/li&gt;
&lt;li&gt;Kboom: it's time to try the command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git fetch &lt;span class="nt"&gt;-ap&lt;/span&gt; &lt;span class="nt"&gt;--progress&lt;/span&gt; 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;'\[deleted\]'&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $NF}'&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s|origin/||'&lt;/span&gt;  | xargs git branch &lt;span class="nt"&gt;-D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;List all what you have locally. Did it worked?
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By tweaking well-documented git command, we can remove pain that we usually don't take time to address.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed it!&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Rails philosophy explained with drawings</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Mon, 26 May 2025 06:16:36 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/rails-philosophy-explained-with-drawings-4o7k</link>
      <guid>https://forem.com/bdavidxyz/rails-philosophy-explained-with-drawings-4o7k</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/rails-philosophy-explained-with-drawings" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/rails-philosophy-explained-with-drawings&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The SVGs do not appear correctly here on dev.to, so I suggest the article above.&lt;/p&gt;

&lt;p&gt;Text below :&lt;/p&gt;




&lt;p&gt;In the NextJS era, there's a lot of difficulty for junior developers to understand the MVC model, so plain old Rails, Laravel or Django may looks weird.&lt;/p&gt;

&lt;p&gt;Rails itself has a special &lt;a href="https://rubyonrails.org/doctrine" rel="noopener noreferrer"&gt;doctrine&lt;/a&gt;, that I would advise to read before to dive into the framework, because you may not understand the design choice along the way if you don't deeply understand its philosophy.&lt;/p&gt;

&lt;p&gt;Now here how I would draw it.&lt;/p&gt;

&lt;p&gt;Rails values on deep integrated system, so your codebase may look like this :&lt;/p&gt;



&lt;ul&gt;
&lt;li&gt;gray zone = energy spend to write code&lt;/li&gt;
&lt;li&gt;circle = one layer of your app (M, V or C for example)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, each circle &lt;strong&gt;is not&lt;/strong&gt; completely independant of each other.&lt;/p&gt;

&lt;p&gt;That means &lt;strong&gt;less code&lt;/strong&gt; written at the end of the journey.&lt;/p&gt;

&lt;p&gt;A cleaner architecture would be as follow :&lt;/p&gt;



&lt;ul&gt;
&lt;li&gt;gray zone = energy spend to write code&lt;/li&gt;
&lt;li&gt;circle = one layer of your app (M, V or C for example)&lt;/li&gt;
&lt;li&gt;green zone = energy spend to write boundaries code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which leads to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;more time spend on the gray zone&lt;/li&gt;
&lt;li&gt;new time dedicated to write an maintain boundaries between zone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So is Rails 100% "clean" ? Maybe not for everybody.&lt;/p&gt;

&lt;p&gt;Is Rails less energy spent? Less money spent? Less mental workload?&lt;/p&gt;

&lt;p&gt;Yes.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>mvc</category>
    </item>
    <item>
      <title>T vs any in TypeScript</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Sat, 24 May 2025 22:00:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/t-vs-any-in-typescript-59ol</link>
      <guid>https://forem.com/bdavidxyz/t-vs-any-in-typescript-59ol</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/t-vs-any-in-typescript" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/t-vs-any-in-typescript&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something you probably already heard about, but this is my way of seeing it.&lt;/p&gt;

&lt;p&gt;Article below&lt;/p&gt;




&lt;p&gt;This is something that went in my head while learning TypeScript.&lt;/p&gt;

&lt;p&gt;Both means "could be any kind of type", but there is one huge difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Similarities of "any" and generic "T"
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;any is never constrained&lt;/li&gt;
&lt;li&gt;generic is always under constraint somewhere&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example with generic T
&lt;/h2&gt;

&lt;p&gt;Let's say we want a method that returns an array with only one element :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;oneElementArrayOf&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stuff&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;stuff&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;T is under constraint&lt;/strong&gt; : "stuff" can only be of T type, and the return type can only be an array of T&lt;/p&gt;

&lt;p&gt;In other word, if you see the  somewhere, there is another place where it will be used, in the args or the returned type.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same example with any
&lt;/h2&gt;

&lt;p&gt;The same code with any&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;oneElementArrayOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stuff&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// valid!!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"any" is not constrained by anything. The code is valid (TS valid I mean), despite &lt;strong&gt;not&lt;/strong&gt; achieving the initial goal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;That was quick, but I hope it helped.&lt;/p&gt;

&lt;p&gt;To sum up,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"any" means "zero constraint".&lt;/li&gt;
&lt;li&gt;"T" means "has at least one constraint".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope it helped!&lt;/p&gt;

&lt;p&gt;David.&lt;/p&gt;

</description>
      <category>typescript</category>
    </item>
    <item>
      <title>Is TypeScript difficult to learn?</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Sat, 24 May 2025 04:29:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/is-typescript-difficult-to-learn-1j8m</link>
      <guid>https://forem.com/bdavidxyz/is-typescript-difficult-to-learn-1j8m</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/is-typescript-difficult-to-learn" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/is-typescript-difficult-to-learn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My personal journey.&lt;/p&gt;

&lt;p&gt;Article below&lt;/p&gt;




&lt;p&gt;I just finished course from Jad, and it was a pure joy to follow.&lt;/p&gt;

&lt;p&gt;That being said :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm not affiliated or whatsoever&lt;/li&gt;
&lt;li&gt;It's not a review about this course&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's my personal feeling about the difficulty of learning TypeScript&lt;/p&gt;

&lt;h2&gt;
  
  
  My background
&lt;/h2&gt;

&lt;p&gt;Learned and practice Java professionnally for many years, then switched to untyped languages, mostly JS and Ruby.&lt;/p&gt;

&lt;h2&gt;
  
  
  Difficulty of practicing TS without proper training
&lt;/h2&gt;

&lt;p&gt;I think I made a mistake here. Because I already knew Java in-depth, I didn't need to learn the basics of TS before practicing.&lt;/p&gt;

&lt;p&gt;Wrong, wrong, wrong. Do yourself a favor : don't be like me.&lt;/p&gt;

&lt;p&gt;Review everything from the base. Here is what will happen :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oh, I guessed it from experience&lt;/li&gt;
&lt;li&gt;Woot? No way I would have implemented it this way.&lt;/li&gt;
&lt;li&gt;Tons of ah-ah moments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How hard was it to learn TypeScript
&lt;/h2&gt;

&lt;p&gt;It is one thing to read the lesson, but another to fight the TS compiler complaining about things going wrong.&lt;/p&gt;

&lt;p&gt;Even with experience with other languages, I struggled one time or two during exercice.&lt;/p&gt;

&lt;p&gt;So TS is not completely easy, but I would say it is not too complicated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take your time to grab every concept&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And reading will not be enough. Be prepare to suffer on exercices.&lt;/p&gt;

&lt;p&gt;How hard it is? Well, for a complete beginner, you will take more time, of course. But nothing undoable, so don't be too shy either.&lt;/p&gt;

&lt;p&gt;For a beginner, I wouldn't advise the official docs. I loved Jad's course, but there are probably other good online courses nowadays. It will give you enough guidance to properly climb the moutain without sacrifying too much energy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can ChatGPT help?
&lt;/h2&gt;

&lt;p&gt;Hmm nowadays I would say 50-50. I mean, it may point out the right bug, or give a vague but correct idea around 50% of the time. Or just be completely wrong the other half of the time.&lt;/p&gt;

&lt;p&gt;What is sure it that it won't help you if you don't take time to understand the basics anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  What helped me a lot
&lt;/h2&gt;

&lt;p&gt;I think my biggest "ah-ah" moment, was when I decided to replace "type" and "interface" keyword by "contract" (in my head only, "contract" does not exist in TS).&lt;/p&gt;

&lt;p&gt;At that point, everything tricky stuff was a lot clearer.&lt;/p&gt;

&lt;p&gt;TS just define contracts about what variables, classes and functions should be.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;TS may be easy or hard to learn, depending on your initial experience. My takeaway.&lt;/p&gt;

</description>
      <category>typescript</category>
    </item>
    <item>
      <title>TypeScript primitive types</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Fri, 23 May 2025 04:23:22 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/typescript-primitive-types-42gl</link>
      <guid>https://forem.com/bdavidxyz/typescript-primitive-types-42gl</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/typescript-primitive-types" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/typescript-primitive-types&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's mostly a note to self&lt;/p&gt;




&lt;p&gt;Here are &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Primitive" rel="noopener noreferrer"&gt;primitive types&lt;/a&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;number&lt;/li&gt;
&lt;li&gt;string&lt;/li&gt;
&lt;li&gt;boolean&lt;/li&gt;
&lt;li&gt;bigint&lt;/li&gt;
&lt;li&gt;symbol&lt;/li&gt;
&lt;li&gt;undefined&lt;/li&gt;
&lt;li&gt;null&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But wait!&lt;/p&gt;

&lt;p&gt;These primitives types are actually &lt;strong&gt;JavaScript types&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I love how elegant TypeScript is. ❤️&lt;/p&gt;

&lt;p&gt;Because it's a superset of JavaScript, it doesn't try to reinvent the base types, and &lt;strong&gt;just accept JS basic types&lt;/strong&gt; as &lt;strong&gt;TypeScript basic types&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Yes, they are the same.&lt;/p&gt;

&lt;p&gt;So this is correct :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;saySomethingClever&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can explicitly use JS primitive types.&lt;/p&gt;

&lt;p&gt;BTW you probably already heard about null and undefined, but probably not about bigint and symbol.&lt;/p&gt;

&lt;p&gt;You can view the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#type_information" rel="noopener noreferrer"&gt;bigint docs&lt;/a&gt; and &lt;a href="" rel="noopener noreferrer"&gt;symbol docs&lt;/a&gt; on MDN.&lt;/p&gt;

&lt;p&gt;At that point you should try to ask "but where are object" ?&lt;/p&gt;

&lt;p&gt;That will be the topic for another article.&lt;/p&gt;

&lt;p&gt;Best,&lt;/p&gt;

&lt;p&gt;David.&lt;/p&gt;

</description>
      <category>typescript</category>
    </item>
    <item>
      <title>Unpoly outclasses Hotwire</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Thu, 22 May 2025 09:37:21 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/unpoly-outclasses-hotwire-20m4</link>
      <guid>https://forem.com/bdavidxyz/unpoly-outclasses-hotwire-20m4</guid>
      <description>&lt;p&gt;Article originally published here :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://alsohelp.com/blog/unpoly-outclasses-hotwire" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/unpoly-outclasses-hotwire&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What Unpoly and Hotwire share
&lt;/h2&gt;

&lt;p&gt;Here is what do they have in common :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Both are frontend web tools&lt;/li&gt;
&lt;li&gt;Both aim to "make web UI snappy like React", without using any React-like framework&lt;/li&gt;
&lt;li&gt;Both tries to respect the web "as it is", avoiding un-necessary JS layer&lt;/li&gt;
&lt;li&gt;Both play with plain old HTML render (like Laravel, Rails or Django)&lt;/li&gt;
&lt;li&gt;Both are born inside a Ruby-on-Rails based company&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now here is how Unpoly and Hotwire complexity compares, and why I think Unpoly is so far the best front-end tool, at least in terms of low-tech and low-complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lowering front end complexity
&lt;/h2&gt;

&lt;p&gt;I'm not a good drawer I know, but here is the idea :&lt;/p&gt;

&lt;p&gt;Hotwire is far simpler than React.&lt;/p&gt;

&lt;p&gt;But Unpoly is even simpler.&lt;/p&gt;

&lt;p&gt;However, if you try to go back to plain old vanillaJS/jQuery, you end up with a complexity that is even worse than React.&lt;/p&gt;

&lt;p&gt;Why is that?&lt;/p&gt;

&lt;p&gt;React seems to be go-to front end tools nowadays.&lt;/p&gt;

&lt;p&gt;But if you use Hotwire, you will reduce the complexity, just by cutting off the quantity of LOC in the frontend.&lt;/p&gt;

&lt;p&gt;Remember that a huge quantity of LOC is harder to maintain than a smaller one, even if the code is clean or IA-generated.&lt;/p&gt;

&lt;p&gt;I've seen a Reddit comment saying that using Hotwire reduce by 70% the code required to get things done.&lt;/p&gt;

&lt;p&gt;So is Hotwire a move in the correct direction ? I think so.&lt;/p&gt;

&lt;p&gt;However...&lt;/p&gt;

&lt;h2&gt;
  
  
  Unpoly is simpler than Hotwire
&lt;/h2&gt;

&lt;p&gt;Hotwire means a lot of convention to remember.&lt;/p&gt;

&lt;p&gt;Hotwire means a fair effort of training before using it - BTW there is an incredibly&lt;br&gt;
&lt;a href="https://www.hotrails.dev/" rel="noopener noreferrer"&gt;good Hotwire tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Unpoly is the opposite.&lt;/p&gt;

&lt;p&gt;Less code, less convention, almost no need of training, once you grab the &lt;a href="https://demo.unpoly.com/" rel="noopener noreferrer"&gt;Unpoly demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is no tutorial about Unpoly because it's incredibly easy.&lt;/p&gt;

&lt;p&gt;Also no need for the server to know about Unpoly. You just render plain old HTML.&lt;/p&gt;

&lt;p&gt;One last thing is that I can chirurgically target what element to replace, whereas Turbo swaps the whole body of HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;For personal project, you don't need a React-like framework - it's probably another story inside big companies.&lt;/p&gt;

&lt;p&gt;Just use plain old HTML, and augment it with JS with the tool that creates the smallest amount of friction(s).&lt;/p&gt;

&lt;p&gt;For me, it's Unpoly.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>unpoly</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Declare an array in TypeScript</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Wed, 21 May 2025 04:57:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/declare-an-array-in-typescript-2ce</link>
      <guid>https://forem.com/bdavidxyz/declare-an-array-in-typescript-2ce</guid>
      <description>&lt;p&gt;Article published on my blog here :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://alsohelp.com/blog/typescript-declare-array" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/typescript-declare-array&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;How to declare an array in TypeScript the right way. A small recap, mostly note to self.&lt;/p&gt;

&lt;p&gt;First, this is how you declare an array in JS :&lt;/p&gt;

&lt;h2&gt;
  
  
  In JS
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;orange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember that TS generates JS, so you always end up with the above.&lt;/p&gt;

&lt;h2&gt;
  
  
  In TS
&lt;/h2&gt;

&lt;p&gt;In TS, it will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;orange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are telling TS "I'm declaring an array of string".&lt;/p&gt;

&lt;p&gt;In TS, you always declare &lt;strong&gt;an array of something&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an Array of string,&lt;/li&gt;
&lt;li&gt;an Array of number,&lt;/li&gt;
&lt;li&gt;an Array of MyType,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and so on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things to avoid
&lt;/h2&gt;

&lt;p&gt;There is no "array of nothing" in TS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ const fruits: [] = []
// wrong! you are declaring an empty array
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ const fruits = [1, 2, 3]
// wrong! you are declaring an "array of any", like in JS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ const fruits: any[] = [1, 2, 3]
// wrong! you are using any, which is almost forbidden in TS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;An array in TS is always an "array of something". I think it's the only gotcha to remember.&lt;/p&gt;

&lt;p&gt;Best,&lt;/p&gt;

&lt;p&gt;David&lt;/p&gt;

</description>
      <category>typescript</category>
    </item>
    <item>
      <title>Background jobs with Rails 8 are delightful</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Tue, 20 May 2025 03:58:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/background-jobs-with-rails-8-are-delightful-22ce</link>
      <guid>https://forem.com/bdavidxyz/background-jobs-with-rails-8-are-delightful-22ce</guid>
      <description>&lt;p&gt;Article originally published here (image doesn't work well here) : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://alsohelp.com/blog/background-jobs-in-rails-8-are-delightful" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/background-jobs-in-rails-8-are-delightful&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;There's one thing I forgot to mention about &lt;a href="/blog/rails-8-opinion"&gt;my Rails 8 opinion&lt;/a&gt; last time : it's how background jobs are handled in Rails 8.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;Here's what it looks like on my current project :&lt;/p&gt;

&lt;p&gt;(image)&lt;/p&gt;

&lt;h2&gt;
  
  
  Background jobs should be a default feature
&lt;/h2&gt;

&lt;p&gt;Most web frameworks completely underestimate how background jobs are valuable.&lt;/p&gt;

&lt;p&gt;Honestly I &lt;strong&gt;always&lt;/strong&gt; need a way to handle background jobs, on every new web project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forgot password email ? =&amp;gt; background task to send the email&lt;/li&gt;
&lt;li&gt;Clean image asynchronously ? =&amp;gt; background task to clean the image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And so on.&lt;/p&gt;

&lt;p&gt;IMHO A good way go see if a framework is mature enough is "are background jobs already included from day 1".&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it's delightful with Rails 8
&lt;/h2&gt;

&lt;p&gt;Why it is so good with Rails 8?&lt;/p&gt;

&lt;p&gt;Because you don't have to care about : it's already included.&lt;/p&gt;

&lt;p&gt;From what I've read, it's not possible with other frameworks - outside Laravel.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Database is already backed&lt;/li&gt;
&lt;li&gt;The Dashboard is already included (!)&lt;/li&gt;
&lt;li&gt;And, of course, it's damn easy to hook any kind of job inside the framework itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All I had to do is to protect the route, so that only the admin can view it.&lt;/p&gt;

&lt;h2&gt;
  
  
  You don't have to care about internals because it just works
&lt;/h2&gt;

&lt;p&gt;You don't have to care about the JS/CSS, because as long as you keep "propshaft" as gem, it will work.&lt;/p&gt;

&lt;p&gt;The beauty (again) is that &lt;strong&gt;I don't use propshaft&lt;/strong&gt; myself. I use Vite.&lt;/p&gt;

&lt;p&gt;This is Rails deep integration : even if you don't use the default frontend management, external gem will work with your product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two different processes
&lt;/h2&gt;

&lt;p&gt;Of course "background jobs" means "take another thread than the one of the web server".&lt;/p&gt;

&lt;p&gt;So there's a tiny configuration locally (Thank you &lt;a href="https://mattbrictson.com/blog/better-bin-dev-script" rel="noopener noreferrer"&gt;Matt Brictson for your bin/dev&lt;/a&gt;&lt;br&gt;
), and another one for the production, but honestly, it's one line of code that you can forget once properly set up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Rails 8 shine not only for the things previously mentionned, but also thanks to mission control.&lt;/p&gt;

&lt;p&gt;It gives you very elegant, monitor-able background jobs, right from day one, with full support and upgrades of the Rails maintainers.&lt;/p&gt;

&lt;p&gt;Close from silver bullet ;)&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Where 1 = 1 in SQL</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Mon, 19 May 2025 05:39:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/where-1-1-in-sql-4k65</link>
      <guid>https://forem.com/bdavidxyz/where-1-1-in-sql-4k65</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/where-one-equals-one-in-sql" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/where-one-equals-one-in-sql&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;After more than 5 years of writing SQL, I found this thing in a colleague's code.&lt;br&gt;
At first, I didn’t see the point.&lt;/p&gt;

&lt;p&gt;Juniors are often baffled when they see this condition in their colleagues’ code.&lt;/p&gt;

&lt;p&gt;(Personally, the first time I saw it, I thought it was some trick to optimize a join’s performance in certain conditions...)&lt;/p&gt;

&lt;p&gt;In reality, it’s just a handy tip.&lt;/p&gt;

&lt;p&gt;It’s used to quickly test query results with and without certain conditions.&lt;/p&gt;

&lt;p&gt;Here, if we wanted to test the query without the condition work = 'c-level', we’d have to move degree = 'master' next to WHERE (and remove the AND keyword).&lt;/p&gt;

&lt;p&gt;That’s tedious...&lt;/p&gt;

&lt;p&gt;The 1=1 trick simply avoids that, saving a bit of time when testing queries. :)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;people&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;-- AND degree="master"&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;work&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;"c-level"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sql</category>
    </item>
    <item>
      <title>Each child in a list should have a unique key prop</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Sun, 18 May 2025 04:16:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/each-child-in-a-list-should-have-a-unique-key-prop-1d03</link>
      <guid>https://forem.com/bdavidxyz/each-child-in-a-list-should-have-a-unique-key-prop-1d03</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/each-child-in-a-list-should-have-a-unique-key-prop" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/each-child-in-a-list-should-have-a-unique-key-prop&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;This is a React disaster, because I can spend countless hour on this (well-known!), but simple bug :&lt;/p&gt;

&lt;p&gt;"Each child in a list should have a unique 'key' prop."&lt;/p&gt;

&lt;p&gt;Wait, wait, wait... I already googled around and it seems so easy to fix!&lt;/p&gt;

&lt;p&gt;I had already set a unique key on every element in my list!&lt;/p&gt;

&lt;p&gt;Who's in charge? Who's guilty?&lt;/p&gt;

&lt;p&gt;Undefined data when initializing my component.&lt;/p&gt;

&lt;p&gt;Yup.&lt;/p&gt;

&lt;p&gt;Here's what was happening:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;My server component was loading data&lt;/li&gt;
&lt;li&gt;Before loading, my state was &lt;code&gt;undefined&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;My &lt;code&gt;PlotMap&lt;/code&gt; was trying to map over &lt;code&gt;undefined&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;React threw the key error&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The solution was simple but &lt;strong&gt;so easy to miss&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check my data before passing it to my component!&lt;/p&gt;

&lt;p&gt;This simple conditional rendering fixed everything.&lt;/p&gt;

&lt;p&gt;Always make sure your data exists before using it!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This is wrong, causing an error&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PlotMap&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Fixed!&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PlotMap&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
    </item>
    <item>
      <title>How to display git shortsha in terminal</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Sat, 17 May 2025 05:02:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/how-to-display-git-shortsha-in-terminal-2n7j</link>
      <guid>https://forem.com/bdavidxyz/how-to-display-git-shortsha-in-terminal-2n7j</guid>
      <description>&lt;p&gt;Article originally published here : &lt;a href="https://alsohelp.com/blog/how-to-display-git-shortsha-in-terminal" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/how-to-display-git-shortsha-in-terminal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had a problem displaying the image here on dev.to, everywhere else, the text is fine&lt;/p&gt;

&lt;p&gt;Article below :&lt;/p&gt;




&lt;h2&gt;
  
  
  The answer
&lt;/h2&gt;

&lt;p&gt;The answer is already given in this &lt;a href="https://stackoverflow.com/a/5694416/2595513" rel="noopener noreferrer"&gt;StackOverflow answer&lt;/a&gt; more than 6 years ago (!) and still holds true nowadays :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rev-parse &lt;span class="nt"&gt;--short&lt;/span&gt; HEAD
&lt;span class="c"&gt;# 4d7b213&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why the short sha?
&lt;/h2&gt;

&lt;p&gt;In Git every commit is identified by a 40-character hexadecimal string named the "Git SHA".&lt;/p&gt;

&lt;p&gt;See the commit number pointer by the arrow ? (view it in original article)&lt;/p&gt;

&lt;p&gt;Yes, that's the git short SHA.&lt;/p&gt;

&lt;p&gt;Only the first 7 digits amongst the 40.&lt;/p&gt;

&lt;p&gt;The risk of collision is small enough to identify uniquely each commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trick to display the short SHA in the Terminal
&lt;/h2&gt;

&lt;p&gt;You can define an alias, on Linux or Windows, in order to display it without to remember the whole command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;shortsha&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'git rev-parse --short HEAD'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(exemple from my Linux machine)&lt;/p&gt;

&lt;p&gt;Will be used like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;shortsha
&lt;span class="c"&gt;# 4d7b213&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Neat!&lt;/p&gt;

&lt;h2&gt;
  
  
  Last trick
&lt;/h2&gt;

&lt;p&gt;Sometimes, you will try some attempt to display it somewhere in the footer, in order to increase confidence about which version of the website is deployed. I like and use it, but I admit it's not very common though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;That was a quick recap about the git short SHA.&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Is React beginner-friendly?</title>
      <dc:creator>David Boureau</dc:creator>
      <pubDate>Fri, 16 May 2025 05:09:00 +0000</pubDate>
      <link>https://forem.com/bdavidxyz/is-react-beginner-friendly-7ic</link>
      <guid>https://forem.com/bdavidxyz/is-react-beginner-friendly-7ic</guid>
      <description>&lt;p&gt;I originally published this article on my blog here : &lt;a href="https://alsohelp.com/blog/is-react-beginner-friendly" rel="noopener noreferrer"&gt;https://alsohelp.com/blog/is-react-beginner-friendly&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice it's opinionated, you are perfectly allowed to disagree :)&lt;/p&gt;

&lt;p&gt;Article below :&lt;/p&gt;




&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;It's not.&lt;/p&gt;

&lt;p&gt;React &lt;strong&gt;looks like&lt;/strong&gt; very appealing for beginners, because each component looks like a brick you can easily (almost physically) manipulate with a very fine granularity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The easy part
&lt;/h2&gt;

&lt;p&gt;And each component sounds very intuitive.&lt;/p&gt;

&lt;p&gt;Let's take a basic example, taken from one of my previous project :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NextSeo&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next-seo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Navigation&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/navigation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ScrollToTop&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/ScrollToTop&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;About&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;NextSeo&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;About | Some title | Some subtitle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lorem ipsum&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ScrollToTop&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Navigation&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How good is that?&lt;/p&gt;

&lt;p&gt;Even with little or no dev experience, you can guess that the about page uses a ScrollToTop, and a Navigation component.&lt;/p&gt;

&lt;p&gt;Oh, and SEO is also handled by a component given by the underlying framework (yes, it's NextJS).&lt;/p&gt;

&lt;p&gt;So good!&lt;/p&gt;

&lt;p&gt;So Easy!&lt;/p&gt;

&lt;h2&gt;
  
  
  The trap
&lt;/h2&gt;

&lt;p&gt;No let's face it, React is full of akward traps.&lt;/p&gt;

&lt;p&gt;Here is the official docs about "&lt;a href="https://react.dev/learn/you-might-not-need-an-effect" rel="noopener noreferrer"&gt;don't use useEffect here&lt;/a&gt;".&lt;/p&gt;

&lt;p&gt;You can achieve all problems in React in multiple ways, and you have no clue, unless you spend countless hours on the docs, to know which one is "the right way" or not.&lt;/p&gt;

&lt;p&gt;Another possibility is to spend your night to read how React replaced the whole underlying DOM Event system, then try to understand how hooks tries to play with this replacement, and then you start to guess what to do and what to avoid with React.&lt;/p&gt;

&lt;h2&gt;
  
  
  No full integration
&lt;/h2&gt;

&lt;p&gt;The last huge problem with React is the complete lack of deep integration.&lt;/p&gt;

&lt;p&gt;Oh, I know, there are some.&lt;/p&gt;

&lt;p&gt;ShipFast (commercial), NextJS (free, but hugely bound to private PaaS company), Blitz (build on top of NextJS, with same inconvenients), React-Router (not used by all the community), Redwood (same)...&lt;/p&gt;

&lt;p&gt;So there are no "React way" to build something from top to bottom.&lt;/p&gt;

&lt;p&gt;Good luck for long-term maintenance.&lt;/p&gt;

&lt;p&gt;Still possible of course, but...&lt;/p&gt;

&lt;p&gt;definetely not for beginners.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;React is a good framework, in term of popularity.&lt;/p&gt;

&lt;p&gt;Is it for beginners?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
