Category: Software Engineering

In my day to day life I am an Android developer working at The Guardian. The further I progress into my career I find myself more and more passionate about good software engineering.

Learning a lot at Twitter

I recently joined Twitter as an Android Developer. So far, it is unlike anywhere I have ever worked before. In two months I have learned a lot and have been incredibly overwhelmed. I’ve recently felt like I have started to get on top of the learning curve and I can start to reflect a bit on the first two months. To do that, I’m going to make an effort to blog three times a week focusing on a few topics.  I already have so many thoughts on MVI, dependency injection (and annotation processors!), lifecycles and memory leaks, build times, working...

Merging multiple files into one with Kotlin

Kotlin lets us write top level functions, this enables us to write code that isn’t necessarily constrained to the concept of classes. It frees us from “util” classes of static methods (but it doesn’t free us from dumping methods or functions in one place). Under the hood, Kotlin is constrained to classes, the compiler must generate bytecode that will run in the JVM (multiplatform is another story). To do this, it must put your functions into a class. It will take your file name and create a class from it. Functions in StringExtensions.kt will be placed in a class named StringExtensionsKt....

Experimenting in a legacy code base

Experimenting in a legacy code base

I work on what could be called a “legacy code base”. We’ve just crossed the 10 year anniversary of the first commit. Between then and now over 40 developers have contributed. Many features have come and gone, and the platform we develop for has changed beyond recognition and so have our ways of writing code. Because of these reasons, we have a vibrant, frustrating, yet interesting code base. Over the past three or so years we have systematically refactored and improved it, but we have a lot further to go. We’re in a place where we can start to think...

To abstract or not to abstract

To abstract or not to abstract

The longer I’ve written software the more I debate with myself about whether I should be adding an abstraction or not adding an abstraction. Let us define an abstraction, it could be an interface, a trait, a protocol, or an abstract class. It is a structure that defines how a piece of code should interact with the outside. But not how that interaction is handled. Abstractions are a powerful tool, but they should be used appropriately. They are powerful at the boundaries of your code but introduce too much indirection when used overzealously. A good abstraction lets a developer switch...

Some thoughts on testing

Some thoughts on testing

I associate a number of things with writing test code. The first is finding peace of mind. In years gone by I have written some dodgy code that has gone to production, I still think about some of this code to this day. I still write dodgy code, but I’m able to stop it from going to production with a superpower I have gained. That superpower is to write tests for my code and mostly stop that code from being released (crashlytics will sometimes disagree). A good set of tests should be enough to give me confidence that what I...

Slice don’t Splice

Slice don’t Splice

This weekend I’ve spent some time working on a side project written TypeScript, I’ve never used it before so I’ve spent a lot of time referring to documentation and learning a lot. One thing stood out. I had an array of data that I wanted to create a sub-list of elements starting from and index, i, to a range. You can do this by calling array.slice: “Extracts a section of the array and returns the new array” https://www.tutorialsteacher.com/typescript/typescript-array Typescript, or the underlying Javascript also has a function that adds or removes elements from an array. This is called array.splice: Adds...