Abstraction in Programming

Bjorn Rudolfsson
Geek Culture
Published in
6 min readFeb 25, 2022

--

Image by nepomuk-si from Pixabay

A few months ago I was going through some code with a couple of colleagues. I was handing over components to some junior co-workers, and we were discussing the code and the functionality. The code itself was in pretty bad shape. It had been handed from developer to developer without really giving anyone the time to fix it properly, and thus had grown organically — patch by patch — to a huge mess. You know the type, long functions with lots of deeply nested if-statements, code shoe-horned into place for convenience rather than coherence, tons of duplication. I hadn’t had much time to work on the code, I had simply been yet another in a long line of temporary owners. But I had at least taken the time to go through the code thoroughly to determine where the main problems were and come up with ideas for improvement.

As they were both junior developers the discussion veered into more generic ideas and thoughts about writing code, and I took the opportunity to share my experience and reasons as to why code should be written in a certain way. There are lots of ideas and best practices in coding, but what do they mean and why are they important? I thought I’d start by taking a closer look at one of the more important ones — abstraction.

The problem with programming code is that it’s complex. Even a very modest piece of software typically has several thousand lines of code, and…

--

--

Bjorn Rudolfsson
Geek Culture

Swedish software engineer with delusions of writerhood.