A simple, compile-time dependency injection framework

4 February Comments

The most popular dependency injection frameworks in Java — Spring and Guice — are built using reflection. There are some problems with this approach, and I believe that a compile-time solution is better in most cases. There are already compile-time implementations (e.g. Dagger), but I wanted to write my own bare-bones implementation. It’s not designed to be used in real projects, but as an illustrative example of how such an implementation can work.

Continue reading

Using two versions of a library in Java

14 June 2022 Comments

Java and its build tools aren’t designed to support using two different versions of the same library at runtime. Generally, that’s a conflict that’s automatically resolved to one or the other, and that’s exactly what we want. But what if it’s not? With a few tricks, it’s possible to circumvent that behaviour.

Continue reading

Imposter syndrome? You might just be bad at programming

12 December 2021 Comments

Imposter syndrome is the tendency for people to significantly underrate their own ability and to feel like an imposter within their field. It can make people feel anxious that they’re eventually going to be exposed. Over the past few years, this term’s seen a surge in popularity within software development. If you express that you’re struggling at your programming job, there’s a good chance that you’ll be met with comforting replies like “you just have imposter syndrome.” There’s an alternative explanation: you might actually be bad.

Continue reading

Design patterns reviewed #3: behavioural

25 October 2021 Comments

This is the third and final post in a series in which I’m reviewing software design patterns. This time out I’m taking a look at behavioural patterns. These all “characterize the ways in which classes or objects interact”. If that sounds indistinct from structural patterns, it’s because it is. Just go with it.

Continue reading

Reflection is a crutch of the Java ecosystem

4 October 2021 Comments

Java gained traction because you could write code which could run anywhere, but it continues to be successful in a large part due to its fantastic ecosystem. Libraries like Spring, Hibernate and Gson are comparable to, if not better than, practically any equivalent tools available for other languages. However, they’ve helped popularise the idea that using reflection is likely to be an intrinsic part of writing a Java library or framework. As Java developers, we’re being short-changed with solutions that force us to sacrifice strong typing and are impossible to debug.

Continue reading

Adding control flow to JSX with TypeScript

13 June 2021 Comments

In any non-trivial React project, one of the things you’ll eventually need to do is render something conditionally. You can’t use if-else statements within JSX. You can use the conditional (“ternary”) operator but I often find that it produces code that’s hard to read. I’ve developed a transform which adds special meaning to certain JSX tags, allowing you to write <If> and <Else> blocks which behave intuitively.

Continue reading

Don't sponsor me

31 October 2020 Comments

There seems to be a growing trend of software developers panhandling for donations. Whether it’s via GitHub Sponsors, Patreon or Ko-fi, a culture of entitlement is on the rise. Some even expect to be rewarded for their Stack Overflow answers. Good luck with that.

Continue reading

Design patterns reviewed #2: structural

25 October 2020 Comments

This is the second post in a series in which I’m reviewing software design patterns. This time out I’m taking a look at structural patterns. These are all strategies for defining and managing relationships between classes and interfaces.

Continue reading

Hybrid CI

18 October 2020 Comments

The company I work for uses GitLab to host our Git repositories. Along with GitHub more recently, it provides a way to build your projects directly within the service without relying on an external build server like Jenkins or Travis. The general reaction here seems positive, and most people seem happy to rely on it for their only automated build now. I can see the benefits but I’m hesitant to fully commit. Hybrid CI is an approach I came up with so I could have my cake and eat it too.

Continue reading

SOLID: the 'SO' stands for Snake Oil

13 September 2020 Comments

SOLID is possibly the most over-hyped concept in all of software engineering. You can throw away that jar of Sudocrem because we’ll have no fence-sitting today, no sir.

Continue reading