<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Colas.Nahaboo.net - programming</title>
    <subtitle>Colas Nahaboo personal site, with discussions about programming code, web and computing topics, surfing and SUPing, and various musings.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://colas.nahaboo.net/tags/programming/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://colas.nahaboo.net"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2022-02-24T00:00:00+00:00</updated>
    <id>https://colas.nahaboo.net/tags/programming/atom.xml</id>
    <entry xml:lang="en">
        <title>One year retired</title>
        <published>2022-02-24T00:00:00+00:00</published>
        <updated>2022-02-24T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/blog/one-year-retired/"/>
        <id>https://colas.nahaboo.net/blog/one-year-retired/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/blog/one-year-retired/">&lt;p&gt;I have been retired for one year now, and what happened? Well...&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;I basically stopped coding and reading about anything computer-related for eight months. I didn&#x27;t expect it, I was thinking I would start coding at once, going through my huge todo list of various projects.&lt;&#x2F;li&gt;
&lt;li&gt;I enjoyed being able to go SUP surfing at will, but I ended up actually less on the water than before, simply because i didn&#x27;t feel pressured into going on the water if the conditions were not enjoyable: I have now all the time in the world, I can wait for better conditions.&lt;&#x2F;li&gt;
&lt;li&gt;I started what I should have done years ago: Stretching at least 30 minutes daily, and warming up a full 10 minutes before going surfing. Work and play for me were mainly sitting in front of a computer, and I had become awfully stiff. I will detail my routine in later posts, it is worth it.&lt;&#x2F;li&gt;
&lt;li&gt;I dived deep in modern physics: astrophysics, cosmology and quantum mechanics. This also will warrant a full separate post.&lt;&#x2F;li&gt;
&lt;li&gt;I started re-coding in the last four months:
&lt;ul&gt;
&lt;li&gt;The first month I began working on various bits of code (shell scripts), progressively getting back to speed, and also deciding to learn the language Go. I was looking for a very longtime for an efficient language to replace lisp or C as compliment to scripting (I never liked Java), and was hesitating between Rust and Go. A discussion with &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.arsac.org&#x2F;olivier&#x2F;&quot;&gt;Olivier Arsac&lt;&#x2F;a&gt; convinced me to try Go.&lt;&#x2F;li&gt;
&lt;li&gt;I switched to git (I was using mercurial) for version control, and &lt;a href=&quot;&#x2F;code&#x2F;moving-to-github&#x2F;&quot;&gt;moved&lt;&#x2F;a&gt; my publicly available source codes from my personal web site to my &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&quot;&gt;GitHub&lt;&#x2F;a&gt;. It may sound ridiculous, but at now 61, setting things up so they do not disappear when I do is becoming an important consideration. I will thus progressively stop using self-hosted sites to publish on places that will survive me, as nobody in my family is tech-savvy enough to maintain a web site.&lt;&#x2F;li&gt;
&lt;li&gt;Then in December I stumbled upon the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;Advent of Code&lt;&#x2F;a&gt; challenge that I decided to do in bash for the challenge, and it was unexpectedly productive? I learned more in these 25 puzzles than in my last 10 years of professional bash scripting. You can see my solutions in my post &lt;a href=&quot;&#x2F;code&#x2F;bash-lessons-learned-with-aoc-2021&quot;&gt;Bash lessons learned with AoC 2021&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Thus, after finishing the Go tutorial, I decided to do the previous AoC years in Go. And I just &lt;a href=&quot;&#x2F;code&#x2F;completed-the-2015-advent-of-code-challenge-in-go&quot;&gt;finished the AoC 2015 in Go&lt;&#x2F;a&gt;. This definitively made me a Go enthusiast, I realized that the designers of Go had exactly the same opinion of what should be a general programming language: They worshiped readability, simplicity, performance and maintainability while hating inheritance and the feature creep of most modern languages.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That was my first year. And now, embarking for the next one!&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Completed the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-24T00:00:00+00:00</published>
        <updated>2022-02-24T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;And I completed the 2015 challenge! (see my &lt;a href=&quot;&#x2F;code&#x2F;starting-the-2015-advent-of-code-challenge-in-go&quot;&gt;previous post&lt;&#x2F;a&gt;). You can read my notes on it on my  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;go&#x2F;2015&quot;&gt;GitHub&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This was quite interesting, and I thing a great way to learn a language just after completing its tutorial, as this challenge as a feel of &quot;real life&quot; situations, and allow for a variety of solutions, so that you can put different approaches to the test.&lt;&#x2F;p&gt;
&lt;p&gt;I forced myself to not look at the solutions available on the net, except for two cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using working code to generate more data to test against (random inputs + expected result number). I just ran the code of other solutions, without reading their source. I often used  solutions by &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;devjobe&#x2F;advent-of-code-2015-golang&quot;&gt;devjobe&lt;&#x2F;a&gt; and &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;schwern&#x2F;adventofcode.go&quot;&gt;schwern&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Once I had a working solution, browsing the source code of other solutions to compare with mine and see where I could improve, and discover cool tricks. I mostly used the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;adventofcode&#x2F;wiki&#x2F;solution_megathreads&#x2F;#wiki_december_2015&quot;&gt;reddit megathread&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I also tried to use only the standard Go packages, and not the ones available on the web. I am sure I will end up using 3rd party packages to replace the standard ones (the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;pkg.go.dev&#x2F;flag&quot;&gt;flag package &lt;&#x2F;a&gt;  to parse options for instance is really too primitive). And I also didn&#x27;t create a separate module or package for my library of common useful functions. I will surely do it in the future, but I feel I should have more experience first.&lt;&#x2F;p&gt;
&lt;p&gt;Anyways, it has confirmed that Go was the language I have been waiting for all these years. On the one hand, I have a bit of regret not having jumped on it sooner, but on the other hand it was easier to just wait for my retirement (one year ago) to free myself from any work politics and constraints to be able to fully explore the programming language landscape with no strings attached.&lt;&#x2F;p&gt;
&lt;p&gt;I can see myself using 4 languages in the future:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bash&lt;&#x2F;strong&gt; for any &quot;glue&quot; tooling and scripts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;go&lt;&#x2F;strong&gt; for my main do-it-all language, and web backend.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;javascript&lt;&#x2F;strong&gt; (and&#x2F;or WebAssembly) for my web frontend, with pure modern HTML and CSS, but no framework, à la  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;vanilla-js.com&#x2F;&quot;&gt;Vanilla JS&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;and maybe a higher performance, specialized language, if I encounter such needs: E.g: &lt;strong&gt;zig&lt;&#x2F;strong&gt; as a replacement of C for tasks where Go could be unsuited (if I encounter any), or &lt;strong&gt;julia&lt;&#x2F;strong&gt; for math-specific things, etc...&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Edit: I see that Neil Henning also enjoyed discovering a new language via AoC: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.duskborn.com&#x2F;posts&#x2F;2021-aoc-zig&#x2F;&quot;&gt;A Review of the Zig Programming Language (using Advent of Code 2021)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Starting the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-09T00:00:00+00:00</published>
        <updated>2022-02-09T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;I discovered the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;advent of code&lt;&#x2F;a&gt; in 2021, and did it in &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;tree&#x2F;main&#x2F;bash&quot;&gt;bash&lt;&#x2F;a&gt; for the challenge. But since I started learning GO, I decided to code the previous AoC years in GO as a mean to practice it. So, although my bash code can be useful to see some tricks of a seasoned bash programmer, these GO solutions must be considered as &quot;student code&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;So I started coding the 2015 year of AoC in GO, available on my GitHub: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;advent-of-code-my-solutions&#x2F;blob&#x2F;main&#x2F;go&#x2F;2015&quot;&gt;advent-of-code-my-solutions&#x2F;go&#x2F;2015&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The code is in GO, with some housekeeping scripts in bash.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>My bash library on Github</title>
        <published>2022-02-05T00:00:00+00:00</published>
        <updated>2022-02-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/my-bash-library-on-github/"/>
        <id>https://colas.nahaboo.net/code/my-bash-library-on-github/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/my-bash-library-on-github/">&lt;p&gt;I have started to publish on Github, at &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ColasNahaboo&#x2F;colas-bash-lib&quot;&gt;colas-bash-lib&lt;&#x2F;a&gt;, my collection of various &lt;strong&gt;bash functions&lt;&#x2F;strong&gt; I reuse often in my bash scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Fell free to copy and use in any of your projects or compilation of bash tools.&lt;&#x2F;p&gt;
&lt;p&gt;I have tried to make them the &lt;strong&gt;fastest&lt;&#x2F;strong&gt; possible, by avoiding forking sub-shells or external commands, and
benchmarking extensively to compare the possible way of coding them. Of course, I will gladly accept suggestions or code to make them faster.
But it means that error checking is often terse and minimal, and readability of the code was not a priority.&lt;&#x2F;p&gt;
&lt;p&gt;I have a kind of «anti-npm» approach, in that I &lt;strong&gt;copy&lt;&#x2F;strong&gt; these functions into my scripts rather that using hem as a true external library that I would load at runtime. It thus avoid installation issues, and the ependency problems that may arise from automated upgrades.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>What is good code?</title>
        <published>2008-10-22T00:00:00+00:00</published>
        <updated>2008-10-22T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/blog/what-is-good-code/"/>
        <id>https://colas.nahaboo.net/blog/what-is-good-code/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/blog/what-is-good-code/">&lt;p&gt;I stumbled upon the blog post &quot;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20190630095624&#x2F;https:&#x2F;&#x2F;weblogs.asp.net&#x2F;fredriknormen&#x2F;is-it-important-to-write-good-code&quot;&gt;Is it important to write good
code?&lt;&#x2F;a&gt;&quot;
the other day, and became more and more ill at ease as I realized that I
thought that I preferred the original code, that the author was trying
to ridicule, over his new &quot;improved&quot; object-oriented version. At first I
guessed this was another manifestation of the the &quot;Worst is best&quot;
scenario - enhancements are often not worth the added complexity - but I
realized that it was perhaps a more profound factor:&lt;&#x2F;p&gt;
&lt;p&gt;The original code is very good because it ... is &lt;strong&gt;small&lt;&#x2F;strong&gt;. It fits on a
teminal screen, so an human being can &lt;strong&gt;read&lt;&#x2F;strong&gt; it at once and have less
items to maintain in his &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Magical_Number_Seven,_Plus_or_Minus_Two&quot;&gt;short term
memory&lt;&#x2F;a&gt;
and also &lt;strong&gt;understand&lt;&#x2F;strong&gt; it easily because it follows a natural way of
thinking with &lt;strong&gt;sentences using IF&lt;&#x2F;strong&gt;. This becomes obvious by reading
the body of the blog post surrounding the code samples, where you can
see that the author is using phrases such as &quot;if I need this I do that&quot;,
showing that in plain english, the if statement is the best way to make
people understand what you mean. And making code that &lt;strong&gt;people&lt;&#x2F;strong&gt;
understand is the best way to make debuggable and maintainable code.&lt;&#x2F;p&gt;
&lt;p&gt;At this moment I noticed the citation in the blog header: &lt;em&gt;&quot;Good
programmers write code that humans can understand&quot;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Indeed :-)&lt;&#x2F;p&gt;
&lt;p&gt;PS: I know I am a bit exaggerating the issues there, and that I unfairly
nitpick on Fredrik Normé, but it is that it seems to me from my personal
experience that the two changes I see most in my coding efficiency as I
grow older is a decrease of my short term memory capacity, and that I
make more and more typos where I realize I mix up totally words with
totally different meanings but that sound the same, for instance writing
&quot;never&quot; instead of &quot;nether&quot;, making me suspect that our natural way of
thinking may be much more language-based that I imagined...&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
