Lukas Atkinson2024-01-06T00:00:00+00:00https://lukasatkinson.de/feed.atom.xmltag:lukasatkinson.de,2017:post:/2023/intent-not-implementation/Intent, not implementationLukas Atkinson2023-12-09T00:00:00+00:002023-12-09T00:00:00+00:00
<p>When designing interfaces / APIs, it is easy to design the interface around
the solution space.
This makes such interfaces difficult to use, difficult to test, and
difficult to maintain.
Instead, our
interfaces should allow users to easily express their intent.</p>
<p><a href="https://lukasatkinson.de/2023/intent-not-implementation/">read full post (6 min)</a></p>
<p>Tags:
[code-craft]
[python]
</p>
tag:lukasatkinson.de,2017:post:/2023/available-for-hire/Available for hireLukas Atkinson2023-06-24T00:00:00+00:002023-06-24T00:00:00+00:00
<p><a href="https://lukasatkinson.de/2023/available-for-hire/">read full post (3 min)</a></p>
<p>Tags:
<i>none</i>
</p>
tag:lukasatkinson.de,2017:post:/2023/rust-no-golden-rule/Rust doesn't actually follow its Golden RuleLukas Atkinson2023-04-02T00:00:00+00:002023-04-02T00:00:00+00:00
<p>(when it comes to async functions)</p>
<p>A couple of days ago,
Steve Klabnik published an article discussing <a href="https://steveklabnik.com/writing/rusts-golden-rule">Rust's Golden Rule</a>,
arguing that Rust's function signatures provide a clear contract
that doesn't depend on the function's contents,
which aids reasoning about the code.
In particular, function signatures are never inferred.</p>
<p>However, the Rust language has evolved so that it violates this Golden Rule.
While <code>impl Trait</code> return types by themselves are fine,
they combine with auto-traits such as <code>Send</code> in an unfortunate manner.
This is a noticeable limitation when it comes to writing async Rust code.</p>
<p><a href="https://lukasatkinson.de/2023/rust-no-golden-rule/">read full post (11 min)</a></p>
<p>Tags:
[rust]
</p>
tag:lukasatkinson.de,2017:post:/2020/brexit-deal-gdpr/Brexit deal and GDPR: no adequacy yet, but transfers can continue for a while…Lukas Atkinson2020-12-26T00:00:00+00:002020-12-26T00:00:00+00:00
<p>The last-minute Brexit deal
essentially extends the transition period status for a few months
with regards to data protection issues.</p>
<p><a href="https://lukasatkinson.de/2020/brexit-deal-gdpr/">read full post (2 min)</a></p>
<p>Tags:
[gdpr]
</p>
tag:lukasatkinson.de,2017:post:/2019/gcovr-4.2/gcovr 4.2Lukas Atkinson2019-11-06T00:00:00+00:002019-11-06T00:00:00+00:00
<p>Gcovr 4.2 is out, and provides a broad array of new features!
With the ability to use config files,
new output formats like JSON and SonarQube XML,
and the ability to combine coverage data from multiple runs,
this release should make it easier to create coverage report in more complex scenarios.</p>
<p>Gcovr is a command line tool that uses gcov
to produce code coverage reports in various formats,
such as text summaries, detailed HTML reports,
and various machine-readable formats.
It works with the GCC and Clang compilers.</p>
<p>You can <code>pip install gcovr</code> <a href="https://pypi.org/project/gcovr/">from PyPI</a>,
read the <a href="https://github.com/gcovr/gcovr">overview on GitHub</a>,
or read the <a href="https://gcovr.com/">full documentation</a>.</p>
<p><a href="https://lukasatkinson.de/2019/gcovr-4.2/">read full post (7 min)</a></p>
<p>Tags:
[projects]
[python]
</p>
tag:lukasatkinson.de,2017:post:/2019/gdpr-scope-of-erasure/On the ECJ's ruling that the GDPR Right to Erasure doesn't apply outside the EULukas Atkinson2019-09-24T00:00:00+00:002019-09-24T00:00:00+00:00
<p>Today's ruling by the <abbr title="European Court of Justice">ECJ</abbr> on the Google v CNIL case
seems to limit the territorial scope of the GDPR.</p>
<p>But that misses the main point of the ruling.
First, the analysis is specific to the Right to Erasure.
Second, it's more about the territorial scope of EU data protection authorities:
they have no direct right to mandate changes to non-EU activity
unless the authority first balances data subject rights against the <em>freedom of information</em>
to show that such changes are necessary and proportional.</p>
<p><a href="https://lukasatkinson.de/2019/gdpr-scope-of-erasure/">read full post (5 min)</a></p>
<p>Tags:
[gdpr]
</p>
tag:lukasatkinson.de,2017:post:/2019/mongodb-no-longer-seeks-osi-approval-for-sspl/MongoDB no longer seeks OSI approval for SSPLLukas Atkinson2019-03-09T00:00:00+00:002019-03-09T00:00:00+00:00
<p>MongoDB announced that they are withdrawing the SSPL license
from the OSI license-review process.</p>
<p>This reduces confusion about what is Open Source and what is not,
but leaves a crucial question unsolved:
how can we ensure sustainable development for Open Source projects?</p>
<p><a href="https://lukasatkinson.de/2019/mongodb-no-longer-seeks-osi-approval-for-sspl/">read full post (3 min)</a></p>
<p>Tags:
[open-source]
</p>
tag:lukasatkinson.de,2017:post:/2018/interface-dispatch/Interface DispatchLukas Atkinson2018-07-22T00:00:00+00:002018-07-22T00:00:00+00:00
<p>Virtual method calls are simple:
you just look up the method slot in a vtable and call the function pointer.
Easy!
Well, not quite: interfaces present a kind of multiple inheritance, and things quickly become complicated.</p>
<p>This post discusses interface method calls in
C++ (GCC),
Java (OpenJDK/HotSpot),
C# (CLR),
Go,
and Rust.</p>
<p>It is an expanded version of my answer on
Software Engineering Stack Exchange
on <a href="https://softwareengineering.stackexchange.com/a/373810/60357">Implementation of pure abstract classes and interfaces</a>.</p>
<p><a href="https://lukasatkinson.de/2018/interface-dispatch/">read full post (16 min)</a></p>
<p>Tags:
[object-oriented-programming]
[java]
[cpp]
</p>
tag:lukasatkinson.de,2017:post:/2017/how-to-check-for-an-array-reference-in-perl/How to check for an array reference in PerlLukas Atkinson2017-05-12T00:00:00+00:002017-05-12T00:00:00+00:00
<p>So you've got a Perl <code>$variable</code>.
Can we use it as an array or hash reference?
If you do an online search for possible solutions,
you'll find a number of suggestions, most of them wrong.</p>
<p>TL;DR:
checking if <code>ref $variable eq 'ARRAY'</code> is almost always a bug.
Depending on your use case, you want:</p>
<ul>
<li><code>reftype $variable eq 'ARRAY'</code> from <a href="https://metacpan.org/pod/Scalar::Util">Scalar::Util</a>
as a check for <em>physical array references</em>, or</li>
<li><code>_::is_array_ref $variable</code> from my module <a href="https://metacpan.org/pod/Util::Underscore">Util::Underscore</a>
as a check for <em>logical array references</em>.</li>
</ul>
<p><a href="https://lukasatkinson.de/2017/how-to-check-for-an-array-reference-in-perl/">read full post (6 min)</a></p>
<p>Tags:
[perl]
</p>
tag:lukasatkinson.de,2017:post:/2017/dist-zilla-on-travis-ci/Dist::Zilla on Travis CILukas Atkinson2017-02-27T00:00:00+00:002017-02-27T00:00:00+00:00
<p>With Dist::Zilla (dzil), testing Perl projects on Travis CI can be a bit
tricky. Here's my approach.</p>
<p><a href="https://lukasatkinson.de/2017/dist-zilla-on-travis-ci/">read full post (5 min)</a></p>
<p>Tags:
[testing]
[perl]
</p>
tag:lukasatkinson.de,2017:post:/2017/should-i-separate-unit-tests-from-integration-tests/Should I Separate Unit Tests from Integration Tests?Lukas Atkinson2017-01-07T00:00:00+00:002017-01-07T00:00:00+00:00
<p>When does it make sense to keep integration tests separate from your unit tests, and when is it OK to make no distinction?</p>
<p>Well, it's all about getting fast feedback.</p>
<p><a href="https://lukasatkinson.de/2017/should-i-separate-unit-tests-from-integration-tests/">read full post (4 min)</a></p>
<p>Tags:
[testing]
</p>
tag:lukasatkinson.de,2017:post:/2016/dynamic-vs-static-dispatch/Dynamic vs. Static DispatchLukas Atkinson2016-12-03T00:00:00+00:002016-12-03T00:00:00+00:00
<p>This article explains the difference between dynamic dispatch (late binding) and static dispatch (early binding).
We'll also touch on the differences in language support for virtual and static methods, and how virtual methods can be circumvented.</p>
<p><a href="https://lukasatkinson.de/2016/dynamic-vs-static-dispatch/">read full post (8 min)</a></p>
<p>Tags:
[object-oriented-programming]
[cpp]
</p>
tag:lukasatkinson.de,2017:post:/2016/simpler-tests-thanks-to-extract-method-refactoring/Simpler Tests thanks to “Extract Method” RefactoringLukas Atkinson2016-09-18T00:00:00+00:002016-09-18T00:00:00+00:00
<p>I'm currently refactoring a huge method into smaller parts.
It is stock full of nested loops, maintains a complex state machine with more variables than I have fingers, and is the kind of code where I have to ask myself how I could ever think this would have been a good idea.
So obviously, I'm splitting that function into smaller, independent chunks with the <em>Extract Method</em> refactoring technique.<sup><a href="https://lukasatkinson.de/2016/simpler-tests-thanks-to-extract-method-refactoring/#fn:1" id="fnref:1">1</a></sup>
Since the control flow is now simplified, the code has also become easier to test – as long as I'm comfortable with testing private methods. Why?</p>
<p>The number of test cases needed for full <em>path coverage</em> corresponds directly to the <em>McCabe complexity</em> of the code under test. Since many simple functions often have lower total complexity than one convoluted function, the overall required testing effort is reduced. As this reduction can be substantial, there is a strong incentive to test the extracted methods directly, instead of testing only through the public interface.</p>
<p><a href="https://lukasatkinson.de/2016/simpler-tests-thanks-to-extract-method-refactoring/">read full post (7 min)</a></p>
<p>Tags:
[testing]
</p>
tag:lukasatkinson.de,2017:post:/2016/extract-your-dependencies/Extract Your DependenciesLukas Atkinson2016-02-07T00:00:00+00:002016-02-07T00:00:00+00:00
<p>Making your code ready to be tested</p>
<p>Global dependencies make it difficult to properly test a piece of code. By
extracting all dependencies into a single manageable object, we can easily
mock the necessary services and avoid a large-scale refactor.</p>
<p><a href="https://lukasatkinson.de/2016/extract-your-dependencies/">read full post (14 min)</a></p>
<p>Tags:
[testing]
[cpp]
</p>
tag:lukasatkinson.de,2017:post:/2015/marpa-overview/An Overview Of The Marpa ParserLukas Atkinson2015-04-28T00:00:00+00:002015-04-28T00:00:00+00:00
<p>There are many exciting parser technologies out there,
and one of the most promising is Marpa.
This post discusses how Marpa improves over commonly used parsers.</p>
<p><a href="https://lukasatkinson.de/2015/marpa-overview/">read full post (18 min)</a></p>
<p>Tags:
[marpa]
[parsing]
</p>
tag:lukasatkinson.de,2017:post:/2015/emerging-objects/Emerging ObjectsLukas Atkinson2015-02-03T00:00:00+00:002015-02-03T00:00:00+00:00
<p>Building a simple object system out of closures</p>
<p>Object-oriented programming and functional programming imply each other.
While encoding closures as objects is a well-known technique (see the <em>command pattern</em>, and e.g. Functors in C++),
using closures to implement objects is a bit more unusual.</p>
<p>In this post, I will explore creating a simple object system in JavaScript,
using only the functional parts.</p>
<p><a href="https://lukasatkinson.de/2015/emerging-objects/">read full post (10 min)</a></p>
<p>Tags:
[object-oriented-programming]
[functional-programming]
[javascript]
</p>
tag:lukasatkinson.de,2017:post:/2013/transforming-syntax/Transforming SyntaxLukas Atkinson2013-06-26T00:00:00+00:002013-06-26T00:00:00+00:00
<p>Or: how to write the easy part of a compiler</p>
<p>A Stack Overflow question asked
how to translate a VB-like conditional into a C-like ternary.
The other answers suggested regexes or treating it as Perl code *shudder*.
But transpiling code to another language can be done correctly.</p>
<p>This post aims to cover:</p>
<ul>
<li>parsing with Marpa::R2,</li>
<li>AST manipulation,</li>
<li>optimization passes,</li>
<li>compilation, and</li>
<li>Perl OO.</li>
</ul>
<p>In the end, we'll be able to do all that in only 200 lines of code!</p>
<p>Since this post is already rather long, we will not discuss parsing theory.
You are expected to be familiar with <a href="https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form">EBNF grammar notation</a>.</p>
<p><a href="https://lukasatkinson.de/2013/transforming-syntax/">read full post (17 min)</a></p>
<p>Tags:
[marpa]
[parsing]
[perl]
</p>