<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <atom:link href="https://renato.athaydes.com/news/index.xml" rel="self" type="application/rss+xml" />
    <title>Renato Athaydes Blog</title>
    <description>Renato Athaydes' Personal Blog.</description>
    <link>https://renato.athaydes.com</link>
    <copyright>2022 RenatoAthaydes All rights reserved</copyright>
    <lastBuildDate>Sun, 09 Nov 2025 20:06:09 +0100</lastBuildDate>
    <pubDate>Sun, 09 Nov 2025 20:06:09 +0100</pubDate>
    <ttl>1200</ttl>
        <item>
      <title>Creating Lisp Systems</title>
      <description><![CDATA[<p>I like to fiddle with Common Lisp from time to time, but unfortunately I always run in trouble when trying to do some basic things, normally outside of the language itself:</p>

<ul>
<li>how do I build a binary, including on CI (build server pipelines)?</li>
<li>how do I write and run tests?</li>
<li>how to <em>mock</em> during tests?</li>
<li>how to debug code with a line-by-line debugger?</li>
<li>how to describe/document a project for publication?</li>
<li>where to read the hyperspec like it&rsquo;s not 1992 anymore?</li>
<li>which tools are used for all that?</li>
</ul>

<p>Even though most answers can be found, at least on a surface level, either on the
wonderful <a href="https://lispcookbook.github.io/cl-cookbook/">Common Lisp Cookbook</a> or
on the <a href="https://lisp-docs.github.io/">Common Lisp Docs</a> website,
they normally don&rsquo;t go very deep on these topics and ends up leaving me scouring the Internet for answers.</p>

<blockquote>
<p>The Cookbook is so good that I keep a local PDF open all the time while doing anything in Common Lisp.
The authors were generous enough to publish it as a free PDF, and you have the option to pay for the EPUB version.
If you&rsquo;re learning Common Lisp, the Common Lisp Docs linked above has an extremely good tutorial, highly recommended!</p>
</blockquote>

<p>For that reason, I decided to write a few notes on how I did all these things on my latest Common Lisp project.</p>

<p>I expect to update this as I find out more, so don&rsquo;t be surprised if I change something later!</p>

<p>I hope this will help my future self and also perhaps you, the reader, who also enjoys Common Lisp but can&rsquo;t really find things easily online.
Hopefully, now it will be a tiny bit easier!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/creating-lisp-systems.html</link>
      <guid>https://renato.athaydes.com/posts/creating-lisp-systems.html</guid>
      <pubDate>Sun, 02 Nov 2025 21:11:00</pubDate>
    </item>
        <item>
      <title>Zig comptime: does anything come close?</title>
      <description><![CDATA[<p><a href="https://kristoff.it/blog/what-is-zig-comptime/">Zig&rsquo;s <code>comptime</code> feature</a> has been causing a little bit of a fuss on
programmer discussion forums lately. It&rsquo;s a very interesting feature because it is relatively simple to grasp but gives
Zig code some super-powers which in other languages tend to require a lot of complexity to achieve. That&rsquo;s in line with Zig&rsquo;s stated
desire to remain a simple language.</p>

<p>The most common <em>super-power</em> (ok, maybe not a super-power, but a non-trivial feature) given as an example is generics, but there are many more.</p>

<p>In this post, I decided to have a look at that in more detail and compare Zig&rsquo;s approach with what some other languages
can offer. Zig uses comptime for things that look a little bit like macros from Lisp or Rust, templates from C++ and D,
and code generation via annotation processors from Java and Kotlin! Are those alternatives anywhere near as powerful? Or easy to use?</p>

<p>I will investigate that by looking at some Zig examples from Loris Cro (Zig evangelist)&rsquo;s <a href="https://kristoff.it/blog/what-is-zig-comptime/">What is Zig&rsquo;s Comptime</a> and Scott Redig&rsquo;s <a href="https://www.scottredig.com/blog/bonkers_comptime/">Zig&rsquo;s Comptime is Bonkers Good</a>.</p>

<p>I only know relatively few languages, so apologies if I didn&rsquo;t include your favourite one (do let me know if your language has even nicer solutions)&hellip; specifically, I don&rsquo;t know much C++, so be warned that while I am aware C++ has <a href="https://en.cppreference.com/w/cpp/language/constexpr">constexpr</a> (I guess that&rsquo;s the closest thing to <code>comptime</code>),
I won&rsquo;t even try to compare that with <code>comptime</code> in this post!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/comptime-programming.html</link>
      <guid>https://renato.athaydes.com/posts/comptime-programming.html</guid>
      <pubDate>Wed, 15 Jan 2025 19:19</pubDate>
    </item>
        <item>
      <title>Metaprogramming and testing in the D Programming Language</title>
      <description><![CDATA[<div class="date">Written on </div><figure style="display: flex; flex-flow: column; padding: 10px; max-width: 640px;">
    <img style="align-self: center;" src="/images/dlang/choosing-dlang.jpeg" alt="Which language to choose? So many options!">
        <figcaption><p>Which language to choose? So many options!</p>
</figcaption>
    </figure>
<p>I have recently decided to play around with a few <em>niche languages</em> in the &ldquo;system programming&rdquo; realm. Having been programming for many years in higher level programming languages such as Java, Dart and Kotlin (and tried many, many others at the same level, or higher), I feel like I need to expand my horizons as for certain kinds of applications, these languages are just not the best tool for the job.</p>

<p>In this blog post, I want to focus on the <a href="https://dlang.org/">D Programming Language</a> because that&rsquo;s the one that called my attention a bit more than  the others, after some initial experimentation.</p>

<p>I also mocked around a bit with <a href="https://ziglang.org/">Zig</a> and <a href="https://nim-lang.org/">Nim</a>
but didn&rsquo;t feel like they were the right language for me, at least for now (they&rsquo;re really cool anyway, do check them out!).</p>

<p>Of course, I had already looked into the king of this space, <a href="https://www.rust-lang.org/">Rust</a>&hellip; but Rust,
while being a genius language in many ways, doesn&rsquo;t really make me excited about writing code - to the
contrary, the thought of spending weekends battling with the borrow checker fills me with
dread. I would absolutely use Rust in a working context (and have done so) due to its safety guarantees
(not just memory safety but specially resource- and thread-safety it provides) and outstanding performance (both in terms of low memory consumption and raw speed), but for
hobby projects, thanks but&hellip; I just don&rsquo;t see that happening (I already abandoned a few Rust projects halfway through, I&rsquo;m afraid).</p>

<p>Nim goes a bit too far towards the other end, in my opinion, as it&rsquo;s a very <em>playful</em> language
where I felt that safety is considered less important than speed and, well, joy. So if you like that (it&rsquo;s also very fast, creates tiny binaries and uses very little memory) it may be just the language for you.</p>

<p>Zig has a lot of promise, but it just doesn&rsquo;t feel ready at the moment. It&rsquo;s also turning
out to be <a href="https://renatoathaydes.github.io/zig-common-tasks/">quite verbose and difficult to use</a> correctly despite its focus on simplicity.</p>

<p>D seems like a good balance. It looks familiar while having some very interesting features.
It&rsquo;s been around long enough that it&rsquo;s no longer trying to <em>find itself</em> and changing every
6 months.</p>

<p>In this post, I&rsquo;d like to share what I learned, with a focus on an unusual aspect of the
language, its metaprogramming capabilities, and on another feature that very few languages include, despite its importance and obiquity in modern programming practices: unit testing.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/testing-dlang.html</link>
      <guid>https://renato.athaydes.com/posts/testing-dlang.html</guid>
      <pubDate>Sun, 17 Dec 2023 20:37:00 +0000</pubDate>
    </item>
        <item>
      <title>How I wrote my own Smart Home software</title>
      <description><![CDATA[<p><img src="/images/mako/smarthome-banner.jpg" alt="SmartHome Image" /></p>

<p>I&rsquo;ve wanted to automate my home for a long time&hellip; having a background in industrial automation and software development, it felt like I was in a great position to be an early adopter.</p>

<p>However, every time I looked into it, I quickly gave up because of two main problems:</p>

<ul>
<li>the sheer complexity of it all.</li>
<li>prices.</li>
</ul>

<p>The complexity seems to be intentional on the part of most vendors. They tend to not make it clear whether their products work with any <em>controller</em> (if you&rsquo;re completely new to home automation, don&rsquo;t worry, we&rsquo;ll see soon what this means), which software can be used, which devices are compatible with what&hellip;</p>

<p>Prices of <em>smart devices</em> have always been ridiculously high, at least one order of magnitude higher than their <em>dumb</em> counterpart. That&rsquo;s understandable when a technology is still in its early days. But home automation solutions have now been around for a long time!</p>

<p>It&rsquo;s about time smart home devices became more accessible. Well, they may still not be cheap, but finally, prices have gone down enough that I&rsquo;ve finally decided to take the plunge and get myself a few smart <em>things</em> to start playing with!</p>

<p>I got a few power plugs, a motion sensor, a little button that can be programmed to do <em>whatever</em>, and a smart home controller to connect to it all.</p>

<blockquote>
<p>A smart home controller is a hub that connects to all sensors (e.g. thermometers, power consumption meters etc.)
and lets you get information about them, as well as control devices which can be
controlled (e.g. turn on lights, change their colors, open/close the curtains, water the garden etc.).</p>
</blockquote>

<p>I chose to buy an <a href="https://about.ikea.com/en/newsroom/2022/05/25/ikea-launches-dirigera-the-matter-ready-hub-for-smart-products-and-a-new-ikea-home-smart-app">IKEA Dirigera</a>
to start with because at least where I am, IKEA smart things are the cheapest by far! But also because IKEA&rsquo;s smart home products use <a href="https://en.wikipedia.org/wiki/Zigbee">Zigbee</a>,
which is a widely used protocol for home automation, so I could easily migrate to another hub (another name for the controller that manages the <em>things</em>) at some point,
if desired (which I did, as we&rsquo;ll see).</p>

<p>I also got a <a href="https://www.tapo.com/en/product/smart-light-bulb/tapo-l920-10/">Wifi light strip</a> from IP-Link for good measure (it&rsquo;s pretty awesome!).</p>

<p>After learning how to use the apps (from IKEA and IP-Link), including integrating them with my <a href="https://store.google.com/en/product/nest_hub_2nd_gen">Google Nest Hub</a>, I was a little bit underwhelmed.
Even though it&rsquo;s really cool to be able to say &ldquo;hey Google, turn on the lights in the main bedroom&rdquo;, and it just works(!),
there&rsquo;s very little automation you can actually do beyond what&rsquo;s achievable with good old dumb electronics because of all the limitations of the apps.</p>

<p><strong>What I really wanted was to be able to program my home, like I can program my software, well beyond what some manufacturer&rsquo;s app allows me to.</strong></p>

<p>Thus started my chase for the perfect smart home software setup!</p>

<h3>The usual smart home software people use</h3>

<p>At first, I tried a few smart home automation servers which are normally the &ldquo;obvious&rdquo; choices for this kind of stuff.</p>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/openhab.png" alt="OpenHab Logo">
    </figure>
<p><a href="https://www.openhab.org/">OpenHAB</a> is a Java-based server which uses <a href="https://www.openhab.org/docs/developer/osgi/osgi.html">OSGi</a> for its plugin system, meaning it can load/unload plugins at runtime to support
an enormous amount of <a href="https://www.openhab.org/addons/">add-ons</a> for seemingly every smart home product.</p>

<p>Even though OpenHAB looks great, it&rsquo;s a complex system. Understanding its concepts and how to configure a nice dashboard, install <em>things</em>, add automations is very time consuming, I believe (if I remember correctly) I spent a few days on it and
only managed to get one <em>thing</em> connected, and didn&rsquo;t really get to the point where I had a working dashboard at all.</p>

<p>I also looked at what is probably the most popular smart home hobbyist server, <a href="https://www.home-assistant.io/">HomeAssistant</a>. It looks pretty, has an easier setup than OpenHAB, has a neat
<a href="https://www.home-assistant.io/skyconnect/">USB Dongle</a> that makes things even easier&hellip; but what put me off with HomeAssistant were two things: first, it&rsquo;s based on Python. I have a strong aversion to Python
due to its horrendous package management history (we use dozens of languages at work, guess which language is the only one that causes build issues all the time?). It&rsquo;s a nice language, but for things like
home automation, having build/dependencies problems is the absolute last thing I need.</p>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/home-assistant.png" alt="HomeAssistant Logo">
    </figure>
<p>The biggest problem with HomeAssistant, however, is its really overengineered setup for running on mini computers like the <a href="https://www.raspberrypi.org/">Raspberry Pi</a>, which was my goal.</p>

<p>The recommended way to run it is with a fleet of Docker containers (and they even tell you to install <a href="https://www.home-assistant.io/installation/raspberrypi">their own Linux distro</a>
to make sure all the large amounts of software you&rsquo;ll need is managed more easily).</p>

<p>Just imagine for a second, you&rsquo;re automating your house to do little things like turn on a light at a certain time&hellip; perhaps open the curtains
in the morning as your alarm sets off in the morning. Is the best solution we can come up with a bunch of Docker containers running on a custom Linux distro?</p>

<p>As with OpenHAB, this all felt way more complex and heavy than I was hoping for. And I couldn&rsquo;t even find a way to use them to actually write <strong>code</strong> to perform automations the way I wanted, rather than limited
visual programming tools which seem to be the standard way of doing things in this world (no, thanks!).</p>

<h3>Raspbee 2 and deCONZ REST API</h3>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/raspbee2.jpg" alt="Raspbee2">
    </figure>
<p>That&rsquo;s when I finally found something that made sense to me: the <a href="https://phoscon.de/en/raspbee2">Raspbee 2</a> Zigbee Gateway, which is a tiny circuit board you plug directly on the Raspberry Pi&rsquo;s GIO plug
(they also have a USB dongle version).</p>

<p>You then connect to it using either their <a href="https://phoscon.de/en/raspbee2/software">simple web-based app</a> (useful to set it up) or the <a href="https://dresden-elektronik.github.io/deconz-rest-doc/">deCONZ REST API</a> they expose.</p>

<p>This is exactly what I am looking for!</p>

<p>Having full access to my smart things via a REST API would, after all, allow me to write code in whatever programming language I&rsquo;d like.</p>

<p>The next challenge was to decide what stack to use to create a little web application I and my family could use to interact with the smart things&hellip; I wanted something extremely light so I could run it even on
an older Raspberry Pi 2 that I had lying around with low power consumption&hellip; also the less complex, the better chances are it will still be working 10 years from now, which I think is very important for something
that&rsquo;ll become part of the house.</p>

<p>By chance, I found a solution which I didn&rsquo;t expect at all (I work with Java, but wanted to avoid it as I know it&rsquo;s far too memory-heavy and slow on small devices): <a href="https://www.lua.org/">Lua</a>.</p>

<h3>Why Lua?</h3>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/lua.jpg" alt="Lua Language Logo">
    </figure>
<p>Lua was designed to be embedded in C programs. It&rsquo;s probably the lighest practical language you&rsquo;ll find.</p>

<blockquote>
<p><a href="http://justine.lol/">Justine</a>&rsquo;s <a href="https://redbean.dev/">Redbean</a> web server, which is an <a href="https://justine.lol/ape.html">αcτµαlly pδrταblε εxεcµταblε</a> that embeds Lua and SQLite and runs on most Operating Systems
(the same file!), is a mere 2.2 MB download and runs using less than 1MB of RAM.</p>
</blockquote>

<p>For this reason, I considered using Lua and was delighted to find out that there was a really lightweight web server made exactly for things like this: the <a href="https://makoserver.net/">Mako Server</a>.</p>

<p>The Mako Server is based on the <a href="https://barracudaserver.com/">Barracuda Application Server</a>, which was designed to work on embedded devices. <a href="https://realtimelogic.com/products/barracuda-application-server/?t=r">It supports</a>
VxWorks, QNX, Zephyr, FreeRTOS+TCP and lots of other OSs, including of course the mainstream ones, Linux/Windows/MacOS!</p>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/MakoLogo2.svg" alt="Mako Server Logo">
    </figure>
<p>Mako has a <a href="https://makoserver.net/download/raspberry-pi/">special download for the Raspberry Pi</a> which comes with support for using GPIO from Lua. I built it from source on my Pi and it only took a few seconds.</p>

<p>What is the most amazing is the amount of stuff packed into this tiny server: a HTTP Client, JSON/<a href="https://ubjson.org/">UBJSON</a> parser, SMTP, MQTT, TLS,
<a href="https://www.sqlite.org/index.html">SQLite</a>, and obviously, Lua and <a href="https://realtimelogic.com/products/lua-server-pages/">LSP</a> (Lua Server Pages) which makes it easy to generate web content.</p>

<p>The result is a web server that uses less than 3MB of RAM (even including the built-in Mako, Barracuda and Lua&rsquo;s complete Docs, and a code editor for changing things on the fly) while running and that I can code live.</p>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="https://renato.athaydes.com/images/mako/raspbee2-and-dirigera.jpg" alt="Lua Language Logo">
        <figcaption>The IKEA Dirigera (at the bottom) next to its likely replacement, a Raspberry Pi + Raspbee2.</figcaption>
    </figure>
<p>In the rest of this blog post, I&rsquo;ll show how to get started with the Mako Server, and how to use it to talk to the deCONZ API to automate any smart home setup.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/writing-your-own-smarthome-manager.html</link>
      <guid>https://renato.athaydes.com/posts/writing-your-own-smarthome-manager.html</guid>
      <pubDate>Sun, 04 Jun 2023 23:26:00 +0000</pubDate>
    </item>
        <item>
      <title>A look at Unison: a revolutionary programming language</title>
      <description><![CDATA[<p><a href="https://www.unison-lang.org/">Unison</a> is a pure functional programming language that comes with a few revolutionary ideas. Seriously, it makes everything we&rsquo;re used to, like long builds, dependency version conflicts, tests that run every single build even when nothing checked by them has changed, <em>manual</em> encoding and serialization of data, and lots more look like primitive stuff from the time we were programming in caves. For this reason, I&rsquo;ve been following Unison development excitedly, if quietly, for a few years now.</p>

<p>As I write this in early 2023, finally, I think it has reached a level of maturity where it&rsquo;s actually usable for <em>real work</em>, so I decided to write about my impressions using the language for something non-trivial.</p>

<p>Could it really be the language of the future, as its website cheekily proclaims?! What&rsquo;s so revolutionary about it? Why are we not using its revolutionary ideas in other languages yet if they are so great?!</p>

<p>Let&rsquo;s have a closer look. It really is worth it!</p>

<h2>Introduction to the big idea</h2>

<p>The Unison website is very cool and has a <a href="https://www.unison-lang.org/learn/the-big-idea/">full page</a> dedicated
to explaining the <strong>big idea</strong> behind Unison. So, I highly recommend reading that before you continue. Please come back after you&rsquo;re done!</p>

<p>In their words, here it is:</p>

<blockquote>
<p>Each Unison definition is identified by a hash of its syntax tree.</p>

<p>Put another way, Unison code is content-addressed.</p>
</blockquote>

<p>Yes, that&rsquo;s very concise and may not sound terribly interesting. But this simple idea enables things you probably didn&rsquo;t even think were possible.</p>

<p>For example, <strong>Unison does away with builds</strong>. <strong>Completely!</strong> Have you been looking for a language that has great compile times while still being strongly typed? Well, how about a language with basically zero compilation time??</p>

<p>It sounds outrageous, I know&hellip; I also thought it was basically bs before looking into it in more detail. But, believe me, it&rsquo;s not.</p>

<p>Code is not stored in multiple, seemingly unrelated text files in Unison. It&rsquo;s stored in an actual database. One that you can only append to, similar to a Git repository.</p>

<p>The reason Unison doesn&rsquo;t have builds is that code is already stored in its type-checked, AST (Abstract Syntax Tree) form in that database, <em>linked</em> to other definitions by its hash.</p>

<p>If you write the same function with different names, even with different variable names and perhaps declaring bindings in different order, for example, Unison will just store one function, but add an alias to it if you really want it. It has a canonical representation for all code, which allows it to do that.</p>

<p>Even documentation and types are stored this way, though you may use <code>unique type</code> to avoid identically structured types to be considered the same.</p>

<p>When you change the type of a function, it only impacts other code that uses it if you explicitly use Unison refactoring capabilities to update that function everywhere it&rsquo;s used (we&rsquo;ll see exactly how to do that later).
It&rsquo;s simply impossible to <em>commit</em> code that wouldn&rsquo;t compile. You can choose to leave the old function alone and just bind the name to a new function, or rename the old one, that&rsquo;s fine too! It&rsquo;s your choice.</p>

<p><strong>That means there&rsquo;s no version conflicts either in Unison.</strong> You can have different functions using different versions of some other function at the same time. The different versions are different hashes, and functions only refer to the hash of other functions, so there&rsquo;s never a conflict.</p>

<p><strong>This idea also enables easy distributed computing</strong>, after all, sending a computation, code, data and all, to another machine, is much easier when you know exactly what the code dependencies of the computation are, what the data type definitions are, and are unique and cannot conflict.</p>

<h2>This is not an original idea</h2>
<figure style="display: flex; flex-flow: column; padding: 10px; ">
    <img style="align-self: center;" src="/unison/smalltalk.jpg" alt="Smalltalk balloon">
    </figure>
<p>Many readers may be interjecting that this idea is an old idea: Smalltalk already had the idea of an &ldquo;image&rdquo; where all source code was stored instead of text files.</p>

<p>Other readers may remember Joe Armstrong&rsquo;s famous talk, <a href="https://www.youtube.com/watch?v=lKXe3HUG2l4">The mess we&rsquo;re in</a>, where the idea of using (unspoofable) hashes instead of <em>names</em> to facilitate distributed computing, among other things, is expanded at around the 36:00 mark.</p>

<p>However, Unison may be the first time this idea has been implemented in such a way that the full benefits described in the previous section can be fully realized. Even if it&rsquo;s not, I believe it&rsquo;s still a wonderful implementation of that idea, specially when combined with pure, statically typed functional programming.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/unison-revolution.html</link>
      <guid>https://renato.athaydes.com/posts/unison-revolution.html</guid>
      <pubDate>Sun, 08 Jan 2023 23:22:00 +0000</pubDate>
    </item>
        <item>
      <title>My IDE is too heavy so I moved to Emacs</title>
      <description><![CDATA[<p><a href="https://www.redhat.com/en/topics/middleware/what-is-ide">IDEs</a> (Integrated Development Environment) are great tools to make the lives of developers easier.</p>

<p>They help us in so many ways it&rsquo;s almost impossible for me to imagine working without one.</p>

<p>But all the stuff they do to help us is not free, and lately, I&rsquo;ve been suffering the consequences of that.
I use an under-powered MacBook Air from around 2019 as my &ldquo;hobby project&rdquo;, personal laptop, and running the
community edition of Jetbrains&rsquo; IntelliJ IDEA, my favourite IDE, on it has been an unpleasant experience.</p>

<p>In this post, I wanted to pose the question: do IDEs really need to be so heavy that we can barely use one on a laptop
that cost a thousand dollars just a few years ago?</p>
]]></description>
      <link>https://renato.athaydes.com/posts/switching-from-heavyweight-ides-to-emacs.html</link>
      <guid>https://renato.athaydes.com/posts/switching-from-heavyweight-ides-to-emacs.html</guid>
      <pubDate>Sun, 11 Dec 2022 20:55:00 +0000</pubDate>
    </item>
        <item>
      <title>The difficult problem of managing Java dependencies</title>
      <description><![CDATA[<p>Dependency management is a difficult topic, much more difficult than most developers probably realize.</p>

<p>As long as things work, you barely need to pay any attention to which versions of your dependencies you&rsquo;re currently using (but you should, of course), so that&rsquo;s understandable.</p>

<p>But if you want to build reliable software while keeping up with latest security patches in all of your dependencies, which requires constantly updating libraries and making sure no breaking changes have been accidentally introduced and that all libraries remain compatible with each other, then you&rsquo;re in for a challenge.</p>

<p>While this problem exists in every programming language in existence (with perhaps <a href="https://www.unisonweb.org/">one exception</a>), some languages do it better than others.</p>

<p>However, in this blog post, I am going to look in detail at the Java way of handling dependencies, which is mostly based on <a href="https://maven.apache.org/">Maven</a> (though <a href="https://ant.apache.org/ivy/">Apache Ivy</a>, <a href="https://docs.gradle.org/">Gradle</a> and <a href="https://docs.bazel.build/">Bazel</a> are also going to make appearances).</p>

<p>I will also mention some other language&rsquo;s and language-agnostic package managers (like <a href="https://nixos.org/">Nix</a>, for example) in order to try to identify more clearly how things are done today outside the Java world, and where things seem to be heading.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/understanding-java-dependencies.html</link>
      <guid>https://renato.athaydes.com/posts/understanding-java-dependencies.html</guid>
      <pubDate>Wed, 06 Jul 2022 16:15:00 +0000</pubDate>
    </item>
        <item>
      <title>Testing and building C projects with Zig</title>
      <description><![CDATA[<p>C has been around for a long time, but even today it is at the root of much of the critical infrastructure in the software world.</p>

<p>A large amount of the lowest level software that is widely used today, from the <a href="https://github.com/torvalds/linux">Linux kernel</a>
to <a href="https://daniel.haxx.se/blog/2017/03/27/curl-is-c/">curl</a>, from <a href="https://github.com/git/git">git</a>
to <a href="https://github.com/git/git/blob/master/grep.c">grep</a>, and in fact, all of the <a href="https://www.gnu.org/software/coreutils/">GNU Core Utils</a>,
stuff you use every day like <code>kill</code>, <code>cat</code>, <code>cp</code>, <code>mkdir</code>, <code>rm</code>, <code>du</code>, <code>date</code>&hellip; all of this is written in C.</p>

<blockquote>
<p>Check the source code for some of these utilities <a href="https://github.com/MaiZure/coreutils-8.3/tree/master/src">here</a>.
There&rsquo;s something magic about being able to read the actual C code of these little programs we use in our day-to-day
without thinking how it&rsquo;s probably been there for over 40 years.</p>
</blockquote>

<p>While C is a simple language, actually using C properly is really, really hard. There&rsquo;s very little in the way of abstractions and &ldquo;safety&rdquo; when compared to higher-level languages, or even more modern lower-level ones. It&rsquo;s about as close to the metal, as some people like to say, as you can get without writing machine code (with the probable exception of <a href="http://www.forth.org/">Forth</a>).</p>

<blockquote>
<p><em>&ldquo;C is a pretty basic language with not a lot of features. It can do anything, but it can make you work for it.&rdquo; - <a href="https://beej.us/guide/bgc/html/split/hello-world.html#what-to-expect-from-c">Beej&rsquo;s Guide to C Programming</a></em></p>
</blockquote>

<p>For this reason, there has been a wave of languages trying to replace C with something better.
<a href="https://en.wikipedia.org/wiki/C%2B%2B#History">C++</a> was probably the first one, but it was soon followed by others, like <a href="https://dlang.org/">D</a>, <a href="https://www.rust-lang.org/">Rust</a>, <a href="https://nim-lang.org/">Nim</a> and more recently, <a href="https://odin-lang.org/">Odin</a>, <a href="https://vale.dev/">Vale</a> and the one that we&rsquo;ll be looking at for this blog post, <a href="https://ziglang.org/">Zig</a>.</p>

<blockquote>
<p>There are many more modern lower-level languages competing with C, see <a href="https://github.com/robertmuth/awesome-low-level-programming-languages">robertmuth/awesome-low-level-programming-languages</a> for more.</p>
</blockquote>

<p>The problem is that C is still alive and well, and it&rsquo;s probably not going anywhere any time soon. There&rsquo;s just too much of it out there, and some of the effort to replace all that legacy with something new (which I am sure would bring its own different set of issues with it) could be better spent elsewhere.</p>

<p>That&rsquo;s why I think that rather than trying to replace C completely, we should be doing more to actually ensure the existing C code we rely on is <em>wrapped</em> into saner APIs and as well tested as possible, allowing us to integrate with all the legacy C gives us without fear.</p>

<p>It&rsquo;s in this context that I found out that <a href="https://ziglang.org/">Zig</a> embraces C instead of treating it like dirty garbage. It makes it very easy to interop with C, and the Zig compiler itself can compile C code. It might be using MSFT tactics, of course, but even if that were the case, it still gives us a nifty tool to improve test coverage and usability for the mountains of C code we will probably have laying around for a long time!</p>

<p>From <a href="https://ziglang.org/learn/overview/">Zig In-depth Overview</a>:</p>

<ul>
<li>Zig is better at using C libraries than C is at using C libraries.</li>
<li>One of the primary use cases for Zig is exporting a library with the C ABI for other programming languages to call into.</li>
<li>In some ways, Zig is a better C compiler than C compilers!</li>
<li><a href="https://ziglang.org/learn/overview/#performance-and-safety-choose-two">Zig is faster than C.</a></li>
</ul>

<p>I know, a lot of grandiose claims that are hard to believe&hellip; but even though there&rsquo;s been quite a few similarly outrageous claims from other sources in the past that turned out to be nothing other than vaporware, I don&rsquo;t believe that to be the case with Zig.</p>

<p>I&rsquo;ve tried it, and from what I can see so far, it delivers on nearly all fronts.</p>

<p>Including the part where it claims to be a better C compiler than any other C compiler!</p>

<p>In this post, I will be building a C project with the Zig compiler and build system, testing the C code with Zig&rsquo;s native testing system, and finally, giving a taste of what brand new, fresh Zig code looks like.</p>

<blockquote>
<p>All sample code in this blog post can be found in <a href="https://github.com/renatoathaydes/zig-build-c">this GitHub repo</a>. See the commits.</p>
</blockquote>
]]></description>
      <link>https://renato.athaydes.com/posts/testing-building-c-with-zig.html</link>
      <guid>https://renato.athaydes.com/posts/testing-building-c-with-zig.html</guid>
      <pubDate>Sun, 19 Jun 2022 16:35:00 +0000</pubDate>
    </item>
        <item>
      <title>Replacing logging APIs with the Java System Logger</title>
      <description><![CDATA[<p>Logging in the JVM, unfortunately, has never become fully standardized, resulting in a proliferation of logging frameworks and causing
a problem for library authors who want to include logging facilities in their libraries.</p>

<p>Given how Java has had, since Java 9, a <code>System.Logger</code> right in the standard library, I decided to investigate whether that has the
potential to change things, or whether it&rsquo;s just another logging API in a growing list of options on the JVM.</p>

<p>But before we get to that, let&rsquo;s discuss how we got ourselves in this situation.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/java-system-logging.html</link>
      <guid>https://renato.athaydes.com/posts/java-system-logging.html</guid>
      <pubDate>Sat, 15 Jan 2022 23:49:00 +0000</pubDate>
    </item>
        <item>
      <title>Revenge of Lisp (Part 2/2)</title>
      <description><![CDATA[<blockquote>
<p>Note: This is a follow-up blog post to <a href="https://renato.athaydes.com/posts/revenge_of_lisp.html"><em>Revenge of Lisp - Learning Common Lisp to beat Java and Rust on a phone encoding problem</em></a>.
Please read that blog post first for context.</p>
</blockquote>

<p>In the previous Part of this blog post, I introduced basic <a href="https://lisp-lang.org/">Common Lisp</a> to non-Lispers and discussed the phone number encoding problem, as well as Peter Norvig&rsquo;s quick implementation of a solution in CL - which are the basis for this post.</p>

<p>We also saw that the CL code had very competitive performance, running faster than Java and Rust for the most part,
while consuming much less memory than Java, and not very far from Rust&rsquo;s nearly optimal memory usage.</p>

<p>However, the Java and Rust implementations were, as CL&rsquo;s, written without much thought given to performance, after all the description of the original study which introduced the problem asked participants to focus on correctness and readability, not performance.</p>

<p>Besides that, there were some problems with the benchmark, as it was originally meant only for a quick comparison between
the languages, not as a formal proof of relative performance. In any case, if we&rsquo;re going to mention performance,
I acknowledge that some improvements are required in order to avoid misleading the reader, so I spent quite some time thinking about it, and designing a few changes
to both how the benchmarks are run and to how programs should be implemented in order to get a more accurate picture of how each language <em>really</em> performs.</p>

<p>In this post, I will discuss these improvements, then focus on the Common Lisp implementation and the available
techniques for making it run faster. As with my previous Rust blog posts, I will show how each modification affects the performance of the code. The objective is to get the fastest implementation possible, and having optimised
Java and Rust implementations to compare against is a motivator to keep going until there really isn&rsquo;t anything
else that can be tried!</p>

<p>Do you think Common Lisp can run as fast as well-optimised Rust? Read on if you want to find out.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/revenge_of_lisp-part-2.html</link>
      <guid>https://renato.athaydes.com/posts/revenge_of_lisp-part-2.html</guid>
      <pubDate>Sun, 10 Oct 2021 21:13:00 +0000</pubDate>
    </item>
        <item>
      <title>Revenge of Lisp (Part 1/2)</title>
      <description><![CDATA[<p>This may surprise you if you know me, but I&rsquo;ve been learning <a href="https://lisp-lang.org/">Common Lisp</a> for a few weeks now.</p>

<p>It all started when I was reading, funnily enough, a blog post about another, much more hyped, language called <a href="https://julialang.org/">Julia</a>. The post was titled <a href="https://arnuldondata.medium.com/julia-and-the-reincarnation-of-lisp-f60cacd5822c">Julia and the reincarnation of Lisp</a>, and in it the author lamented that despite his love for Common Lisp, it&rsquo;d never become popular, so he was now trying Julia instead as it may become mainstream soon.</p>

<p>Anyway, what called my attention the most was not Julia (I&rsquo;ve seen this promise of a new language that is as fast as C and as easy as Python a few too many times to believe it), but all the Lisp prasing, including by taking a jab at poor Java, of all things:</p>

<div class="quote">
"The industry has a lot of code in Java even when it takes much less time to write code in Lisp."
</div>

<p>I wondered how they could be so certain of that (and why they thought they needed to create something else anyway if Lisp was so great).
As someone who&rsquo;s written a lot of Java code, I would love to use
a language that takes much less time write things in&hellip; so, I followed the <a href="http://www.norvig.com/java-lisp.html">linked article</a>,
which led me to discovering a few papers written in the late 1990&rsquo;s and early 2000&rsquo;s comparing Java with Common Lisp and other popular languages of the time.
That made me think that, 20 years later, it would be a good idea to revisit the topic and compare Lisp with modern Java
(those papers used Java 1 and 1.2!) and other newer languages like Rust to see whether the results of the old
papers (which generally lauded Lisp while slamming Java) still held today.</p>

<p>I ended up slightly obsessed with doing that for the last few months and wrote a few articles about what I found
out, including <a href="https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html">Revising Prechelt&rsquo;s paper&hellip;</a></p>

<h3>Common Lisp - a brief history and introduction for non-Lispers</h3>

<p>Common Lisp, henceforth <strong>CL</strong>, <a href="https://en.wikipedia.org/wiki/Common_Lisp_HyperSpec">is actually an ANSI standard</a>. It does not have only a single compiler implementation,
far from it, there are <a href="https://en.wikipedia.org/wiki/Category:Common_Lisp_implementations">lots of implementations</a>, both free and commercial.</p>

<p>In this post, I am going to use the most prominent and performant (I believe) free implementation today, <a href="http://www.sbcl.org/">SBCL</a>.</p>

<p>Lisp is a big family of languages with a long tradition. The first Lisp was described already in 1958
by <a href="https://en.wikipedia.org/wiki/John_McCarthy_(computer_scientist">John McCarthy</a>. Today, there are arguably three
main languages in the Lisp family tree: Common Lisp, the result of an unification effort in 1994 which resulted in the Common Lisp&rsquo;s ANSI standard&hellip; <a href="https://www.scheme.com/tspl4/">Scheme</a>, which today has spawned many <em>dialects</em> such as
<a href="https://racket-lang.org/">Racket</a> and <a href="https://www.gnu.org/software/guile/">GNU Guile</a> (most notably used in <a href="https://guix.gnu.org/">GNU Guix</a>), and <a href="https://clojure.org/">Clojure</a>, which was created by <a href="https://en.wikipedia.org/wiki/Rich_Hickey">Rich Hickey</a> based on his frustrations with both Java and the existing Lisp implementations at the time.</p>

<p>Even though Clojure might be a more obvious choice for someone, like me, who is used to working with the JVM, I actually wanted to try using something else with a lighter runtime and great performance.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/revenge_of_lisp.html</link>
      <guid>https://renato.athaydes.com/posts/revenge_of_lisp.html</guid>
      <pubDate>Thu, 30 Sep 2021 21:21:00 +0000</pubDate>
    </item>
        <item>
      <title>How to write fast Rust code</title>
      <description><![CDATA[<p>Since I wrote <a href="https://renato.athaydes.com/posts/how-to-write-slow-rust-code.html">How to write really slow Rust code</a>
and its sequence, <a href="https://renato.athaydes.com/posts/how-to-write-slow-rust-code-part-2.html">Part 2</a>,
I have received so much feedback and suggestions to make my Rust code run faster that I decided I had enough material
to write another post, this time focusing on more advanced tools and techniques available to Rust developers rather than
on how to avoid noobie mistakes that will totally destroy your Rust code performance, as the previous blog posts did.</p>

<p>If you&rsquo;re new to Rust, it may be worthwhile looking at those posts first.</p>

<p>We ended up with a fairly optimized code base that was able to leave behind the Java and Common Lisp implementations
(though they were not as optimized - which deserves another blog post)!</p>

<p>So, this time let&rsquo;s focus on Rust and on what Rust developers can do to make their code go fast fast!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/how-to-write-fast-rust-code.html</link>
      <guid>https://renato.athaydes.com/posts/how-to-write-fast-rust-code.html</guid>
      <pubDate>Sun, 15 Aug 2021 19:38:00 +0000</pubDate>
    </item>
        <item>
      <title>How to write really slow Rust code - Part 2</title>
      <description><![CDATA[<p>This blog post is a follow-up to <a href="https://renato.athaydes.com/posts/how-to-write-slow-rust-code.html">How to write really slow Rust code</a>,
which itself was a follow-up to <a href="https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html">a paper analysis</a>
which discussed how programming language affects developer&rsquo;s productivity and program&rsquo;s efficiency.</p>

<p>I have received a lot of feedback after these posts, specially the latest one, hence I would like to clarify a few points
that I think were not made clear enough, and respond to some criticism that I think was very unfair.</p>

<p>I will also go further and show even more ways of making Rust code faster!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/how-to-write-slow-rust-code-part-2.html</link>
      <guid>https://renato.athaydes.com/posts/how-to-write-slow-rust-code-part-2.html</guid>
      <pubDate>Sun, 08 Aug 2021 18:28:00 +0000</pubDate>
    </item>
        <item>
      <title>How to write really slow Rust code</title>
      <description><![CDATA[<p>I have recently published <a href="https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html">a blog post</a>
that, as I had expected (actually, hoped for, as that would attract people to
contribute to the &ldquo;study&rdquo;), generated quite some polemic on the Internet!</p>

<p>The post was about an old study by Lutz Prechelt comparing Java to C/C++, as well as a few follow-up papers that added
other languages to the comparison, including Common Lisp and a few scripting languages.</p>

<p>I decided to try and see if the results in those papers, which ran their studies 21 years ago, still stand or if things
changed completely since then.</p>

<p>I couldn&rsquo;t get a bunch of students, let alone professional programmers, to write programs for my &ldquo;study&rdquo; in multiple
languages, so I did the next best thing and ported the arguably most common approach to the problem
(based on code by <a href="https://norvig.com/">Peter Norvig</a>, no less) to other languages:
Java, Rust, and later also Julia and Dart.</p>

<p><a href="https://docs.google.com/spreadsheets/d/14MFvpFaJ49XIA8K1coFLvsnIkpEQBbkOZbtTYujvatA/edit#gid=1209911081">The results</a>
were shocking: Rust was one of the slowest languages! It had the lowest memory usage, but also the highest
LOC (lines-of-code) if I included only the implementations of the same algorithm.</p>

<p>Today, I want to appease angry Rust fans and other concerned parties by showing exactly why my Rust code was so slow,
and how with a few small fixes, it can outperform the other languages in the &ldquo;competition&rdquo;, at least in performance
(and as I found out, for certain kinds of inputs only).</p>

<p>Thanks to <a href="https://github.com/renatoathaydes/prechelt-phone-number-encoding/pull/1">the Rust fans</a> who took a lot of
their free time to show me just why my Rust code was so slow and how to fix it!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/how-to-write-slow-rust-code.html</link>
      <guid>https://renato.athaydes.com/posts/how-to-write-slow-rust-code.html</guid>
      <pubDate>Sat, 31 Jul 2021 10:50:00 +0000</pubDate>
    </item>
        <item>
      <title>Revisiting Prechelt's paper and follow-ups comparing Java, Lisp, C/C++ and scripting languages</title>
      <description><![CDATA[<p>In 1999, <a href="https://twitter.com/prechelt">Lutz Prechelt</a> published a seminal article on the COMMUNICATIONS OF THE ACM (October 1999/Vol. 42, No. 10)<br />
called <a href="https://www.ebhakt.info/dl/Comparejavaandc_D9F7/compare_java_c.pdf">Comparing Java vs. C/C++ Efficiency Differences to Interpersonal Differences</a>,
henceforth , which seems to have later (March 2000) been expanded into a full paper, <a href="http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprtTR.pdf">An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl for a search/string-processing program</a>,
henceforth .</p>

<p>In that paper, they analysed data from a study (which was run for another paper, as we&rsquo;ll see later) where participants
were asked to solve a problem consisting of encoding phone numbers into a combination of
digits and words from a dictionary, presumably to make it easier for humans to remember phone numbers they might want
to recall later (this was in a time before mobile phones were widespread).</p>

<p>The same problem was later used by <a href="https://flownet.com/ron/">Ron Garret</a> (aka Erann Gat) in his short paper,
<a href="https://flownet.com/ron/papers/lisp-java/lisp-java.pdf">Lisp as an alternative to Java</a>,
henceforth , from the year 2000.</p>

<p>Both papers have been widely cited and continue to be <a href="https://arnuldondata.medium.com/julia-and-the-reincarnation-of-lisp-f60cacd5822c">linked to even today</a>.</p>

<p>In this article, I would like to revisit these papers, analyse their methodology and conclusions, and
try to find out whether anything has changed in the 21 years since those articles were published by writing my own
solutions to the problem as if I, myself, had participated in one of the studies.</p>

<p>I wrote a solution in Java without looking into any other solutions in order to find out how my solution (and Java 16)
would&rsquo;ve done if it had participated.</p>

<p>After that, I analysed some other solutions and compared them against mine. Based on my findings and some comments by
Prechelt himself in his paper, I decided to write a second Java program to match a completely different strategy that
was commonly used in the more dynamic languages. I implemented the same algorithm also in <a href="https://www.rust-lang.org/">Rust</a>
in order to get an idea of how a very modern systems-language would do.</p>

<p>That should allow us to compare modern languages more directly by using
the same exact algorithm (to the extent possible), eliminating the potentially big differences that could arise from
the different algorithms chosen by the programmer.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html</link>
      <guid>https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html</guid>
      <pubDate>Sat, 24 Jul 2021 14:54:00 +0000</pubDate>
    </item>
        <item>
      <title>Vanilla Java: Using Java SE as a Framework</title>
      <description><![CDATA[<p>The <a href="https://docs.oracle.com/javase/specs/jls/se15/html/index.html">Java Language Specification</a> specifies in minute
detail the grammar and semantics of the Java Programming Language. It also includes platform features
like the <a href="https://docs.oracle.com/javase/specs/jls/se15/html/jls-12.html#jls-12.2">loading of classes and interfaces</a>,
<a href="https://docs.oracle.com/javase/specs/jls/se15/html/jls-7.html#jls-7.7.4">service provisioning</a> and <a href="https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.7">annotations</a>
that can provide runtime and compile-time information for meta-programming.</p>

<p>With all these features, I think it&rsquo;s fair to consider <a href="https://www.oracle.com/java/technologies/java-se-glance.html">Java Standard Edition</a>,
or Java SE, as a framework in its own right.</p>

<p>It is not to be confused with <a href="https://www.oracle.com/java/technologies/javaee-8-sdk-downloads.html">Java EE</a>, or
Java Enterprise Edition <a href="#footnote-1">[1]</a> (recently rebranded as <a href="https://jakarta.ee">Jakarta EE</a>), which adds <a href="https://jakarta.ee/specifications/">loads and loads of APIs</a>
against which Java programmers can create huge enterprisey things on top of
<a href="https://jakarta.ee/specifications/pages/3.0/jakarta-server-pages-spec-3.0.html">JSPs</a> and <a href="https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0.html">Servlets</a>,
for example.</p>

<p>Java EE was all the rage in the early 2000&rsquo;s, but these days
you&rsquo;re more likely to find Java software based on things like <a href="https://spring.io">Spring</a> and its more
streamlined version <a href="https://spring.io/projects/spring-boot">Spring Boot</a>, or even trendier things like
<a href="https://micronaut.io">Micronaut</a> and <a href="https://quarkus.io">RedHat&rsquo;s Quarkus</a> (I know it must be very cool because its slogan is
<em>SUPERSONIC SUBATOMIC JAVA</em>), both of which promise to make Java more Kubernetes/Cloud/Microservice friendly <a href="#footnote-2">[2]</a>.</p>

<p>What you&rsquo;re very unlikely to see is Vanilla Java being used in the real world.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/using-java-se-as-framework.html</link>
      <guid>https://renato.athaydes.com/posts/using-java-se-as-framework.html</guid>
      <pubDate>Sun, 22 Nov 2020 21:25:00 +0000</pubDate>
    </item>
        <item>
      <title>Why Gradle is loathed while actually being great!</title>
      <description><![CDATA[<p><a href="https://gradle.org">Gradle</a> is a misunderstood gem. Most people using Gradle did not choose to use it and were forced
into it by the toolchain of whatever platform they wanted to work with (Android, Jetbrains IDEs, nearly all Kotlin projects&hellip;).
Hence, there seems to be lots of <a href="https://what.thedailywtf.com/topic/26523/gradle">Gradle hate</a>
<a href="https://www.reddit.com/r/java/comments/5zckrr/alternatives_to_gradle/">going around</a>.</p>

<p>This disturbs me (in a weak sense, like people flashing bare ankles on a freezing day disturb me) because I find Gradle to be one of
the greatest tools available to build things. That is perhaps
the result of coming to it by choice, after having suffered for years at the hands of XML-heavy tools like Ant and,
later, Maven. Add to that an inevitable but unhealthy dose of bash scripts and Make files, and building software had been
a tough call for me before I met Gradle.</p>

<p>In this post, I will try to convince you, the reader, that Gradle is, in fact, a great
piece of software that can be used to build nearly any software in a quite elegant manner, despite the best efforts by plugin
authors and Gradle, the company, to pile up layers upon layers of complexity and configuration options over the years
in the name of pursuing infinite flexibility and, of course, ensuring <a href="https://blog.gradle.org/gradle-vs-bazel-jvm">newcomers&rsquo;</a>
claims at being better at any particular thing, no matter how irrelevant, shall not go unchallenged.</p>

<p>To convince you, though, I need to show you how Gradle <strong>really</strong> works.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/gradle-loathed-but-great.html</link>
      <guid>https://renato.athaydes.com/posts/gradle-loathed-but-great.html</guid>
      <pubDate>Sun, 01 Nov 2020 19:39:00 +0000</pubDate>
    </item>
        <item>
      <title>Taking Project Loom for a spin</title>
      <description><![CDATA[<p><a href="https://wiki.openjdk.java.net/display/loom/Main">Project Loom</a> is one of many the Java JDK&rsquo;s incubating project that
aim to design and, all going well, deliver new features to Java.</p>

<p>Its objective is to <em>support easy-to-use, high-throughput lightweight concurrency and new programming models on the
Java platform</em>, according to the Project&rsquo;s Home Page.</p>

<p>I was very excited to read about the current state of Project Loom in the <a href="http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html">State of Loom</a>
article which came up just a few days ago! The final design they have settled on is a dream-come-true for Java developers.</p>

<p>It will allow nearly any existing code that currently relies on the good-old <code>Thread</code> class for concurrency to immediately
benefit with almost no changes at all, all the while making one of the hottest features of <em>cooler</em> and <em>trendier</em> languages,
<a href="https://en.wikipedia.org/wiki/Async/await"><code>async/await</code></a>, look like one of those regrettable <em>it-sounded-liked-a-great-idea-at-the-time</em>
features they wish they didn&rsquo;t have anymore.</p>

<p>It even sounds too good to be true, and whether that&rsquo;s the case remains to be seen!</p>

<p>Luckily, <em>State of Loom</em> published a link to the <a href="http://jdk.java.net/loom/">Loom EA binaries</a> so anyone can already
take it for a spin! And that&rsquo;s exactly what I did.</p>

<p>Here&rsquo;s what I found out!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/taking-loom-for-a-spin.html</link>
      <guid>https://renato.athaydes.com/posts/taking-loom-for-a-spin.html</guid>
      <pubDate>Sun, 17 May 2020 18:50:00 +0000</pubDate>
    </item>
        <item>
      <title>Writing HTTP files to test HTTP APIs</title>
      <description><![CDATA[<p>Writing automated tests for HTTP APIs is currently harder than it needs to be.
You have basically two common approaches to the problem:</p>

<ul>
<li>write tests in your favourite programming language using a HTTP client.</li>
<li>use a GUI tool like <a href="https://medium.com/better-practices/from-manual-to-automated-testing-the-roadblocks-and-the-journey-6333dfacc5ae">Postman</a>,
<a href="https://swagger.io/solutions/api-testing/">Swagger Inspector</a> and its older cousin, <a href="https://www.soapui.org/professional/soapui-pro/">SoapUI</a>.</li>
</ul>

<p>I believe that none of these approaches is ideal. Furthermore, I think that an alternative solution exists that is much
better in most situations, but is still not very well-known: writing HTTP directly in a text file, with a few
human-friendly conveniences added in order to make it a more pleasurable experience.</p>

<p>In this blog post, I will explain what I believe is the problem with the current approaches, and why HTTP files are
a great alternative.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/writing-http-files-for-testing.html</link>
      <guid>https://renato.athaydes.com/posts/writing-http-files-for-testing.html</guid>
      <pubDate>Fri, 01 May 2020 16:20:00 +0000</pubDate>
    </item>
        <item>
      <title>Running WebAssembly on the JVM</title>
      <description><![CDATA[<p><a href="https://webassembly.org/">Web Assembly</a> (or WASM) is the hot, new technology that aims to allow more efficient
programming languages to run inside a browser at near-native speeds.</p>

<p>In summary, it is a low-level instruction format that&rsquo;s both fast to load and to execute, perfect for handling
demanding content in a web browser that JavaScript would have more difficulty handling.</p>

<p>Web Assembly has two formats: binary (the default) and a
<a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format">textual representation</a>
which is human readable.</p>

<p>In fact, it&rsquo;s possible to <a href="https://blog.scottlogic.com/2018/04/26/webassembly-by-hand.html">write WASM by hand</a> using
the textual format.</p>

<p>Even though the language is stack-based (like <a href="https://en.wikipedia.org/wiki/Forth_(programming_language">Forth</a>),
it has some &ldquo;syntax sugar&rdquo; that allows for nesting instructions, making code look much more familiar to developers
used to more usual languages.</p>

<p>For example, the following code performs the equivalent of <code>2 + 3</code>:</p>
<pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;"><code><span style="display:flex;"><span><span style="color:#8be9fd">i32</span>.<span style="color:#ff79c6">const</span> <span style="color:#bd93f9">2</span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd">i32</span>.<span style="color:#ff79c6">const</span> <span style="color:#bd93f9">3</span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd">i32</span>.add
</span></span></code></pre>
<p>This can be also written as:</p>
<pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;"><code><span style="display:flex;"><span>(<span style="color:#8be9fd">i32</span>.add
</span></span><span style="display:flex;"><span>    (<span style="color:#8be9fd">i32</span>.<span style="color:#ff79c6">const</span> <span style="color:#bd93f9">2</span>)
</span></span><span style="display:flex;"><span>    (<span style="color:#8be9fd">i32</span>.<span style="color:#ff79c6">const</span> <span style="color:#bd93f9">3</span>)
</span></span><span style="display:flex;"><span>)
</span></span></code></pre>
<p>Not very different from Lisp (except for the explicit types everywhere):</p>
<pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;"><code><span style="display:flex;"><span>(<span style="color:#50fa7b">add</span> <span style="color:#bd93f9">2</span> <span style="color:#bd93f9">3</span>)
</span></span></code></pre>
<blockquote>
<p>The similarity between WAT (WASM Text) and Lisp is not just a coincidence! As Lisp, WAT is based on
<a href="https://en.wikipedia.org/wiki/S-expression">S-expressions</a>, which are very easy to parse, something that&rsquo;s
a goal of WASM.</p>
</blockquote>

<p>It&rsquo;s really fun to try to write to WASM like this! And more than that, it&rsquo;s a very good way to learn WASM, which is
important for anyone writing compilers targeting it.</p>

<p>But the current <a href="https://webassembly.org/getting-started/developers-guide/">compiler toolchain</a>
to interact with WASM is quite focused, understandably, on compiling C, C++ and Rust to WASM.</p>

<p>Besides, the &ldquo;normal&rdquo; way of running the compiled WASM is by embedding it in a HTML page and loading it on the browser.</p>

<p>So, if you just want to play with the textual format and quickly run the code, things are harder than they should be.</p>

<p>That&rsquo;s why I decided to find something that could run WASM outside of the browser, and being a JVM developer, if it
ran on the JVM, even better!</p>

<p>Doing a little research, I came across the <a href="https://github.com/cretz/asmble">cretz/asmble</a> project, which can run WASM
and WAT directly on the JVM by compiling to Java bytecode!</p>

<p>In this blog post, I will show how you can use that, as well as <a href="https://github.com/renatoathaydes/wasm-on-jvm">WASM-on-JVM</a>
Gradle Plugin I wrote, to easily play with WASM and interact with it from standard Java and Kotlin code.</p>

<p>But before that, let&rsquo;s have a quick look at how the WASM toolchain <em>normally</em> works, so we understand the differences.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/running-wasm-on-the-jvm.html</link>
      <guid>https://renato.athaydes.com/posts/running-wasm-on-the-jvm.html</guid>
      <pubDate>Sun, 24 Nov 2019 18:40:00 +0000</pubDate>
    </item>
        <item>
      <title>Interesting Features of the Dart Programming Language</title>
      <description><![CDATA[<p>Dart is often compared to Java for being a &ldquo;boring&rdquo; language. While it&rsquo;s true that if you know Java (or JavaScript for
that matter) Dart will look pretty familiar, I hope you&rsquo;ll agree after reading the rest of this post that Dart has quite
a lot more to offer, without going to extremes and becoming inaccessible. And to be honest, I would even go
as far as saying that Dart deserves to be regarded as belonging to  the same league as other modern languages like
<a href="https://kotlinlang.org/">Kotlin</a> and <a href="https://swift.org/">Swift</a> (but with a killer app the other 2 are lacking: Flutter).</p>

<p>Flutter developers tend to love the language from what <a href="https://gitter.im/flutter/flutter">I&rsquo;ve been reading</a> lately,
and I can definitely see why.</p>

<blockquote>
<p>Flutter is already the <a href="https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-other-frameworks-libraries-and-tools">3rd most loved Framework</a>
  in the StackOverflow Developer Survey 2019.</p>
</blockquote>

<p>In this article, I want to show how the Dart of 2019 (version 2.4 to be exact) is actually quite an exciting language!</p>

<p>I&rsquo;ll discuss some nice feature of the language itself, as well as some neat platform characteristics (like built-in
platform-specific - like browser - testing support and hot reloading) which make developer&rsquo;s lives so much easier.</p>

<p>By the end, I hope you&rsquo;ll be as convinced as I am that Dart deserves the success it is starting to finally enjoy, and
that it might be a good choice for multi-platform development at present, and even more in the future.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/interesting-dart-features.html</link>
      <guid>https://renato.athaydes.com/posts/interesting-dart-features.html</guid>
      <pubDate>Sun, 07 Jul 2019 13:32:00 +0000</pubDate>
    </item>
        <item>
      <title>Comparing JVM alternatives to JavaScript</title>
      <description><![CDATA[<p>Given that a build/compilation step seems to be a necessary evil no matter what we do, and that we&rsquo;ve known
how to write large applications for a long time in the backend using decent tools, why not try to use those in the
front end too!?</p>

<p>After all, back in 2011 when I was doing web development, people were already experimenting with that idea&hellip;
for example, I was using <a href="http://www.gwtproject.org/">GWT</a>, which is a Java-based web toolkit, in 2011&hellip;
surely, 8 years later, the scene should have improved a lot for Java-based web applications?</p>

<p>I set out to see what&rsquo;s available out there. Can a backend developer who is happy to stay with the nice tooling and
great ecosystem of the Java world do frontend work without jumping ship to the madness of the JS world?</p>

<p>Get ready to find out!</p>
]]></description>
      <link>https://renato.athaydes.com/posts/comparing-jvm-alternatives-to-js.html</link>
      <guid>https://renato.athaydes.com/posts/comparing-jvm-alternatives-to-js.html</guid>
      <pubDate>Wed, 17 Apr 2019 21:11:00 +0000</pubDate>
    </item>
        <item>
      <title>Creating a website generator to generate my website</title>
      <description><![CDATA[<p>This blog post is about how I ended up writing my own static website generator to make it easy for me to publish
this very blogging website.</p>
]]></description>
      <link>https://renato.athaydes.com/posts/creating-this-website.html</link>
      <guid>https://renato.athaydes.com/posts/creating-this-website.html</guid>
      <pubDate>Sun, 31 Mar 2019 15:25:00 +0000</pubDate>
    </item>
      </channel>
</rss>
