Jekyll2023-11-06T18:39:15+01:00https://leakyabstractions.com/Leaky AbstractionsPersonal blog about programming, technology and software engineering in general.Guillermo Calvoguillermo@leakyabstractions.comKeep It Complex and Kludgy2015-08-08T00:00:00+02:002015-08-08T00:00:00+02:00https://leakyabstractions.com/posts/2015/08/08/kick<p>KICK is my brand new backronym for <em>“keep it complex and kludgy”</em>. It is related to <em>Macco’s razor</em>, which holds that the weirder and more obscure answer is <em>always</em> the correct answer.</p>
<p>This seems to be the main ground rule for <strong>way too many</strong> self-appointed systems architects I’ve met over the years. I’m about to unveil this <em>advanced</em> guiding principle which will boost your design skills, turning you in a <em>real</em> professional.</p>
<p>The KICK principle states that you should design every system <strong>as complex as you are able to</strong> (not that you need to understand it). This way you will make sure <strong>nobody could comprehend it whatsoever</strong>. The goal of this philosophy is to become irreplaceable in the context of the project. A disciplined and tenacious work will make you <strong>an essential part</strong> of your organization!</p>
<p>In order to achieve this objectives, there are a number of well-known techniques at your disposal:</p>
<h2 id="class-explosion">Class Explosion</h2>
<p>Follow the wise aphorism <em>“the more, the merrier”</em>. Why would you be satisfied with 50 classes, when you can have 500 of them? They don’t need to perform any task in particular. For example, you can let the classes forward every method’s invocation to another object. This technique does not only work with classes: you can let a whole bunch of functions massage the data, on and off, without doing anything at all.</p>
<h2 id="namespace-abuse">Namespace Abuse</h2>
<p>You need to get your project’s namespace all tangled up, until there is no remaining logic on it. Namespaces must be nested <em>ad nauseam</em>. You might find useful:</p>
<ul>
<li>Duplicate names here and there</li>
<li>Similar names that differ only in a single letter</li>
<li>Names that are mostly compound of numbers</li>
</ul>
<p>Since this technique can be repeatedly applied back and forth, you must keep on until nobody could possibly find any file.</p>
<h2 id="leaky-abstractions">Leaky Abstractions</h2>
<p>Whenever you provide an abstraction to a higher level, you should always slip some specific implementation’s details which have to be handled by your client in a way that it would really feel more comfortable to work directly low-level than through your leaky abstraction.</p>
<h2 id="counter-documentation">Counter-Documentation</h2>
<p>The key is to write the opposite of what things really do. Documents are write-once: you cannot update them as the requirements change. This applies not only to formal documentation, but the code itself. For example, the name of a function which reads a file should be <code class="highlighter-rouge">writeObject</code>.</p>
<h2 id="transvestite-patterns">Transvestite Patterns</h2>
<p>Everybody groks the Gang of Four book. You can take advantage of this fact by masquerading one design pattern as something else. For example, you can create a class <code class="highlighter-rouge">FooSingleton</code>, whose <code class="highlighter-rouge">getInstance</code> method always creates a new instance. Of course, don’t forget to provide a public constructor, so nobody can picture out what on earth is the proper way to use it.</p>Guillermo Calvoguillermo@leakyabstractions.comKICK is my brand new backronym for “keep it complex and kludgy”. It is related to Macco’s razor, which holds that the weirder and more obscure answer is always the correct answer.Keep It Simple, Stupid!2015-08-01T00:00:00+02:002015-08-01T00:00:00+02:00https://leakyabstractions.com/posts/2015/08/01/kiss<p>KISS stands for the guiding principle <em>“keep it simple and stupid”</em>. It is related to <em>Occam’s razor</em>, which states: <em>entia non sunt multiplicanda praeter necessitatem</em> (entities must not be multiplied beyond necessity).</p>
<p>This should probably be the main ground rule in <strong>any</strong> design, but it’s often overlooked, if not plain unknown by many self-appointed systems architects.</p>
<p>The KISS principle states that every system should be <strong>as simple as possible</strong> (but not <em>simpler</em>). It doesn’t talk about the <em>easiness</em> of a system, but the <strong>complexity</strong>. Some people tend to mix these two concepts up.</p>
<p>There is nothing to be proud of when designing complex systems <em>per se</em>. It is <strong>always</strong> way harder to design simple systems. They are also superior to more complex systems, provided that they support the same functionality.</p>
<p>This philosophy is also related with some other aphorisms, such as:</p>
<h2 id="perfect-is-the-enemy-of-good">Perfect is the Enemy of Good</h2>
<p>This means that, most of the time, trying to design <em>the best</em> (the more complete) system does not pay off, because it is unrealistic, and forces you to trade simplicity for the sake of perfection.</p>
<p>This, on the other side, is also related with another principle: <strong>YAGNI</strong> (<em>you ain’t gonna need it</em>).</p>
<h2 id="premature-optimization-is-the-root-of-all-evil">Premature Optimization is the Root of All Evil</h2>
<p>This shows that the right answer to the question: <em>“when should I optimize my system?”</em> is, 99% of the time: <em>“not yet”</em>.</p>
<p>It never ceases to amaze me that many programmers eagerly trade well-designed, maintainable code for an alledged better performance.
Yet they rarely take the time to measure the improvement of their <em>optimizations</em>.</p>Guillermo Calvoguillermo@leakyabstractions.comKISS stands for the guiding principle “keep it simple and stupid”. It is related to Occam’s razor, which states: entia non sunt multiplicanda praeter necessitatem (entities must not be multiplied beyond necessity).Hello world!2015-07-21T00:00:00+02:002015-07-21T00:00:00+02:00https://leakyabstractions.com/posts/2015/07/21/hello-world<p>I found out about <a href="http://jekyllrb.com/">Jekyll</a> and just created this blog. This is the mandatory <em>hello world</em> post.</p>
<p>I don’t atually know what kind of content I will publish here… hopefully soon I will be writing soon about programming languages, compilers, interpreters, virtual machines and software engineering in general. I might even post stuff about other interesting topics such as: video games, music, books, art or Japan.</p>
<p>Just don’t expect me to write too often.</p>
<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="cp"># include <stdio.h>
</span>
<span class="kt">int</span> <span class="n">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">){</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"Hello, world!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
<span class="k">return</span><span class="p">(</span><span class="n">EXIT_SUCCESS</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
</div>
<p>That’s all for now. Time to find a nice theme and tune things up.</p>Guillermo Calvoguillermo@leakyabstractions.comI found out about Jekyll and just created this blog. This is the mandatory hello world post.