<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Development on Ctrl &#43; Champagne</title>
    <link>/tags/development/</link>
    <description>Recent content in Development on Ctrl &#43; Champagne</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 29 Mar 2026 14:00:00 +0000</lastBuildDate>
    <atom:link href="/tags/development/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Jumping the queue? Yes, but in constant time</title>
      <link>/posts/fast_queue/</link>
      <pubDate>Sun, 29 Mar 2026 14:00:00 +0000</pubDate>
      <guid>/posts/fast_queue/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The Problem&lt;/h2&gt;&#xA;&lt;p&gt;Classic interview setup: you walk in, sit down, and the interviewer says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;ldquo;Design a &lt;code&gt;FastQueue&lt;/code&gt; class. It stores entries, where each entry has a &lt;code&gt;long id&lt;/code&gt; and a &lt;code&gt;String family&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You need three operations, all in O(1) time: &lt;code&gt;add(entry)&lt;/code&gt;, &lt;code&gt;removeLast()&lt;/code&gt;, and &lt;code&gt;removeLast(family)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Space complexity is O(N) for all operations.&amp;rdquo;&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s unpack that. You have a queue of entries, each tagged with a family group.&#xA;At any point, you can eject the oldest entry within a given family, all in constant-time.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JUnit 5 Tricks Recap</title>
      <link>/posts/junit/</link>
      <pubDate>Wed, 11 Jun 2025 13:45:56 +0000</pubDate>
      <guid>/posts/junit/</guid>
      <description>&lt;h2 id=&#34;junit-lay-of-the-land--mutation-testing&#34;&gt;JUnit: Lay of the Land &amp;amp; Mutation testing&lt;/h2&gt;&#xA;&lt;p&gt;Alright, what do we know about unit tests?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A unit test verifies an individual unit of code works as expected,&lt;/li&gt;&#xA;&lt;li&gt;It is small, fast and isolate a &lt;em&gt;single functionality&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;They are generally named based on what the test verifies, e.g. &lt;code&gt;testInvalidAccountIdThrowsException&lt;/code&gt;; they are &lt;em&gt;independent&lt;/em&gt;&#xA;from each other even though grouped in the&#xA;same class as related tests.&lt;/p&gt;&#xA;&lt;p&gt;We create them in the same package structure as the source code but under the &lt;code&gt;src/test/java&lt;/code&gt; directory. With Maven,&#xA;tests can be run using lifecycle phases like &lt;code&gt;test&lt;/code&gt;, &lt;code&gt;install&lt;/code&gt;, etc.&lt;/p&gt;</description>
    </item>
    <item>
      <title>We all need a Holiday Destination Finder</title>
      <link>/posts/asynch/</link>
      <pubDate>Sat, 12 Apr 2025 13:45:56 +0000</pubDate>
      <guid>/posts/asynch/</guid>
      <description>&lt;h2 id=&#34;tiptoeing-through-the-asynch-door-with-the-completionstage-interface-jse17&#34;&gt;Tiptoeing Through the Asynch Door with the CompletionStage Interface JSE17&lt;/h2&gt;&#xA;&lt;p&gt;When it comes to holidays, I&amp;rsquo;m as spontaneous as they come. I enjoy not planning&#xA;and picking the best option available just before or even while traveling.&lt;/p&gt;&#xA;&lt;p&gt;So I needed a holiday&amp;hellip; and a reason to explore Java&amp;rsquo;s async magic.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;/posts/asynch/hols.jpg&#34; alt=&#34;text&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;We&amp;rsquo;ll get to this Holiday Finder but first let&amp;rsquo;s get the theory&#xA;out of the way, shall we?&lt;/p&gt;&#xA;&lt;h3 id=&#34;diving-right-in&#34;&gt;Diving Right In&lt;/h3&gt;&#xA;&lt;p&gt;Considering two API calls A &amp;amp; B, API A is called first, and then API B.&#xA;This is what synchronous code does: it waits before executing the next task and things run &lt;em&gt;in order&lt;/em&gt;.&#xA;However, could the thread blocked on the API response be doing some other work instead?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Lambdas &amp; Single Abstract Method Interfaces</title>
      <link>/posts/fi/</link>
      <pubDate>Mon, 24 Mar 2025 11:45:56 +0000</pubDate>
      <guid>/posts/fi/</guid>
      <description>&lt;h2 id=&#34;quick-tour-of-java-functional-interfaces&#34;&gt;Quick Tour of Java Functional Interfaces&lt;/h2&gt;&#xA;&lt;p&gt;A functional interface is an interface with just one abstract method, such as&#xA;Runnable, Comparator, Callable, etc.&#xA;The main benefit of functional interfaces, with the introduction&#xA;of lambdas in Java 8, is that they allow you to pass behavior (code) to a function the same way you&amp;rsquo;d pass data (objects) to a method.&#xA;This means we can pass a lambda expression when a method is accepting a functional interface.&#xA;Since there is only one function to override, it is possible to infer which function to implement when using a lambda expression.&lt;/p&gt;</description>
    </item>
    <item>
      <title>No Huff and Puff—Just Compress!</title>
      <link>/posts/huffman/</link>
      <pubDate>Sun, 16 Mar 2025 13:45:56 +0000</pubDate>
      <guid>/posts/huffman/</guid>
      <description>&lt;h2 id=&#34;the-huffmans-algorithm&#34;&gt;The Huffman&amp;rsquo;s Algorithm&lt;/h2&gt;&#xA;&lt;p&gt;The Huffman&amp;rsquo;s algorithm was born in 1952 as a way to perform a lossless compression&#xA;on data files. Its efficiency comes from the frequency analysis of characters&#xA;present in the text to encode: shorter codes are used to encode more frequent characters&#xA;while longer codes are used to encore less frequent ones.&lt;/p&gt;&#xA;&lt;p&gt;It constitutes the foundation of modern text compression.&lt;/p&gt;&#xA;&lt;p&gt;You can read more on variable-length encoding and tree representations&#xA;under the Design tag on this blog.&lt;/p&gt;</description>
    </item>
    <item>
      <title>When Strings go wrong</title>
      <link>/posts/encoding/</link>
      <pubDate>Tue, 04 Mar 2025 13:45:56 +0000</pubDate>
      <guid>/posts/encoding/</guid>
      <description>&lt;h2 id=&#34;encoding-for-web-apps-internationalisation&#34;&gt;Encoding for Web apps internationalisation&lt;/h2&gt;&#xA;&lt;h3 id=&#34;some-theory-about-information-content--entropy&#34;&gt;Some theory about Information Content &amp;amp; Entropy&lt;/h3&gt;&#xA;&lt;p&gt;Encoding is the process of converting data from one form into another using&#xA;an &lt;em&gt;unambiguous&lt;/em&gt; mapping. It can refer to transforming human-readable characters into a machine-readable format.&#xA;The main question it raises is: how many bits do I need to encode &amp;lsquo;a&amp;rsquo; (and the rest of the characters)?&lt;/p&gt;&#xA;&lt;p&gt;The Information Content (Shannon information) quantifies the amount of &amp;ldquo;uncertainty&amp;rdquo; associated&#xA;with a particular piece of information.&lt;/p&gt;</description>
    </item>
    <item>
      <title>`x = Pépin, y = x` I&#39;m Pépin too, says y</title>
      <link>/posts/valueref/</link>
      <pubDate>Tue, 25 Feb 2025 13:45:56 +0000</pubDate>
      <guid>/posts/valueref/</guid>
      <description>&lt;h2 id=&#34;pass-by-value-or-reference-the-great-debate&#34;&gt;Pass-by-Value or Reference: the Great Debate&lt;/h2&gt;&#xA;&lt;h3 id=&#34;background-on-heap-and-stack&#34;&gt;Background on Heap and Stack&lt;/h3&gt;&#xA;&lt;p&gt;The stack referred to when talking about memory is the same as the run-time call stack. It is&#xA;composed of stack frames and stores &lt;em&gt;things&lt;/em&gt;. It controls the function calls and program execution by&#xA;storing in its frames the function parameters, the return address, local variables - among other things.&#xA;The stack has a fixed-size so in some cases, for instance deep recursion, it can run out of memory.&#xA;Remember this one time you forgot a stopping condition in your code and got a &lt;code&gt;StackOverflowError&lt;/code&gt; or&#xA;&lt;code&gt;RecursionError&lt;/code&gt;: that&amp;rsquo;s the call stack telling you it&amp;rsquo;s full.&#xA;Stack frames only exist during the execution of a function. This means everything stored in it becomes&#xA;unavailable after the function has returned. This makes the allocation and de-allocation of memory&#xA;automatic, which helps prevent memory leaks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>topic=logFormatting context=distributedSystems</title>
      <link>/posts/javalog/</link>
      <pubDate>Fri, 14 Feb 2025 13:45:56 +0000</pubDate>
      <guid>/posts/javalog/</guid>
      <description>&lt;h2 id=&#34;structured-logging-in-java-for-distributed-systems&#34;&gt;Structured logging in Java for distributed systems&lt;/h2&gt;&#xA;&lt;h3 id=&#34;where-do-applications-log-end-up-anyway&#34;&gt;Where do applications log end up anyway?&lt;/h3&gt;&#xA;&lt;p&gt;Applications typically write to standard output. Logs can either be handled&#xA;by the app&amp;rsquo;s supervising process or be passed to the next supervision&#xA;layer to be processed. For example Kubernetes collects logs&#xA;written to &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt; by containers and stores them in node-specific&#xA;log files (usually &lt;code&gt;/var/log/containers&lt;/code&gt; based on name).&#xA;From there, they can be accessed by tools like kubectl logs.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
