Hi, I’m Lukas Atkinson. My irregularly published long form blog posts cover topics such as software development, testing and quality assurance, or programming language concepts and whatever I currently find interesting. Learn more about me, or take a look at my projects.

Recent Posts

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.

This release represents four months of work. The focus was on internal changes, but there are lots of enhancements as well: better filters, improved Python 3 support, GCC 8 support, better encoding support via --source-encoding, parallel gcov invocations with -j, and HTML customizations with --html-title, --html-medium-threshold, and --html-high-threshold.

Gcovr is a command line tool that uses gcov to produce code coverage reports as text summaries, detailed HTML reports, or Cobertura-compatible XML. I works with the GCC and Clang compilers.

Answers on Stack Exchange

The quote appears to be misleading. According to “Why did you decide to write the GNU Affero GPLv3 as a separate license?” in the GPL FAQ, early drafts of the GPLv3 allowed an AGPL-like …
continue reading

The GoF design patterns are about clever ways to use polymorphism to keep a design extensible. For example, the strategy pattern lets us supply different strategy implementations without …
continue reading

Linux Containers have become increasingly important over the last few years, in particular driven by Cloud applications. But what are containers, and how can they be useful?

This is an expanded, English-language version of a presentation I had to prepare during my studies. As such there are likely to be some misunderstandings. I am looking forward to be contacted with corrections.

This is a fairly low-level view at container concepts, and not a tutorial for a specific technology like Docker.

Back in 2013 I published a Marpa parser tutorial called Transforming Syntax, which discusses how a language can be parsed with Marpa and then transpiled to another language.

After all that time I have finally moved the tutorial to this blog. The tutorial was edited and updated on that occasion. In particular, it now promotes better best practices for Perl and Marpa. Mistakes were corrected and the AST objects greatly simplified. The code was improved and tested. In retrospect, four years of using Marpa do make a difference.

I hope Transforming Syntax continues to be useful as one of the manywonderful Marpa tutorials out there.

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.

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 Extract Method refactoring technique.1 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?

The number of test cases needed for full path coverage corresponds directly to the McCabe complexity 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.

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.

Object-oriented programming and functional programming imply each other. While encoding closures as objects is a well-known technique (see the command pattern, and e.g. Functors in C++), using closures to implement objects is a bit more unusual.

In this post, I will explore creating a simple object system in JavaScript, using only the functional parts.

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.

This post aims to cover:

parsing with Marpa::R2,

AST manipulation,

optimization passes,

compilation, and

Perl OO.

In the end, we’ll be able to do all that in only 200 lines of code!

Since this post is already rather long, we will not discuss parsing theory. You are expected to be familiar with EBNF grammar notation.