KISS: My New Year’s Code Resolution.

Neil Bartlett
3 min readJan 17, 2021
Relaxing — Lizzie Bartlett 2020

My shiny, new Macbook Pro with M1 Apple Silicon arrived shortly after the New Year. Along with my ritual to compile my old code for a new platform.

This got me thinking.

What code of mine do I appreciate the most?

The first code that I decided to recompile for my new Macbook was a tool that I wrote several years ago. It was inevitable that this would be the first one as I still use the tool every single day, in fact multiple times per day. I will almost certainly use the tool when writing this article. Yet, it is also probably one of the simplest tools I have written. Ever.

The tool is a text deformatter.

I’m sure many of you have written something similar. Mine hangs around on my toolbar ready to do duty. I have honed it over the years to exactly fit my workflow and tastes. It works flawlessly.

It also fixes a real problem. One of the cool features of MacOS is that rich text is pervasive. You can move text from app to app and the OS preserves the formatting. However, a deep irony is that it is not a simple task to remove that richness. Deformatting text to get back to plain text is not a common feature of the Mac. For sure, there are some arcane keyboard sequences in some apps, but they are inconsistent and not generally available in all apps. Or you can cut and paste into an editor that does not preserve rich text — but that is very time-consuming and clunky.

My tool provides a consistent experience that is now an automatic action for my hands whenever I need to move non-formated text around.

Although I wrote the tool years ago, I have continuously polished and upgraded it. Small minor details, but each step improved its usability for me. It has also provided a familiar playground for new technologies. For example, moving to a new OS, learning Swift, trying out a new version of XCode or re-compling for M1.

The code is not very complex. I don’t think of it as a great piece of code. In fact it is downright crufty. Despite its brevity, it is rather ugly to look at, and has some coding practises that I would not normally use, but it is immensely useful code. For me at least. YMMV. Mid last year, I finally put the code into a Github repo — where you can download my current version — see below.

Over the years, I’ve resisted adding features. I did have plans that it would do all kinds of useful text processing, but I soon realized that adding more features, added more steps to the main workflow. And slowed me down. So I have rigorously applied the principle of Keep It Simple Stupid and only made changes that simplify the working of the tool and hence my life.

When I was younger — yes kids I’m on the wrong side on my mid-century — one of my favourite coding books was Jon Bentley’s Programming Pearls. It espoused the essence of the UNIX principle of creating simple tools that work hard. The mantra rubbed off on me and I feel prouder about those things that do one thing well than I do about more complex code that does a multitude of things.

There is a joy in simplicity.

I’m re-learning to celebrate that simplicity. Cutting out the noise and focusing on the one thing that needs to be done is a valuable and calming framework for the mind. It is a clear trend and maybe an antidote. From Cal Newport’s Digital Minimalism and Deep Work to Marie Kondo’s Tidying Up, we all need to focus on the important things, if we want to get important work done. And when we develop code, we definitely need that same thought in mind.

And so, I’ve decided that, this year, simplicity is going to be my watchword.

As promised: my crufty text deformatter code is at https://github.com/neilbartlett/MacTextDeformatter

Enjoy!

--

--

Neil Bartlett
0 Followers

A wannabe renaissance man and polymath.