Abstraction for Beginner Coders

Roger Siver
4 min readSep 21, 2021

Nowadays, developers work in highly abstracted environments. Their code is able to be more prose than math, and their work uses English words more often than the binary that computers understand.

I’m going to attempt to answer the question of; Is abstraction a good thing?

When I refer to abstraction I refer to the degree to which the developer is separated from the actual computation. In the coding Bootcamp which I attended, we only dealt with highly abstracted concepts. No binary, no assembly, no C, no computation, no electronics. I became familiar with these concepts as “low-level” code concepts. Kind of an oxymoron, as these increase in complexity the “lower” the level you go.

Why is abstraction great?

Programmers are lazy people. Abstraction “abstracts” away work. Automation abstracts away work. The less work you do, the more work a computer is doing to compensate. Look at Github copilot for instance. Github copilot allows you to describe a function and trust a genius machine learning algorithm to spit out the function you asked it to write. Programmers used to build their own data structures and deal with processors and giant piles of ones and zeros daily. Now they write code using patterns that more or less mimic traditional spoken word. NodeJS handles process management, server hosting, as well as garbage collection. Now as developers we can focus on the product we are making and how it is perceived by people

Were all familiar with the concept of 10,000 hours. The infamous number of hours that The Beatles practiced together in order to become “The Beatles”. It is a common trope to equate mastery to the individuals' completion of their respective 10,000 hours. Now due to abstraction, the musician has access to seemingly infinite tools and sounds, usually accessible on a mobile device such as a laptop. Old school musicians may have put their 10,000 hours into learning a single instrument. Now, a masterful performance can be sampled by someone who has never seen the instrument before. 10,000 hours of work reduced into the click of a button.

While some argue that this invalidates the master’s hard work, I argue that the new music producer still has his 10,000 hours to go, however, mastering that specific instrument went from taking the full time to just a moment of it. The new music producer is now awarded the freedom to combine never-heard-before combinations of instruments, as well as time to explore arrangement and production techniques.

This is extremely similar to programming. Instead of spending your 10,000 hours implementing low-level ideas that just move around data, we are free to solve extremely complex problems with incredibly powerful tools.

The Problem With Abstraction

Abstraction isn’t always a good thing. To begin to explain why I’ll start with an immensely obvious statement.

“Work that someone else has already done, you have no control over”

On a recent project, I used Chakra UI. In the beginning, I was extremely impressed with the power of the tools I was given. Chakra-UI components are beautiful out of the box, and they give you tools that they created to modify them. The problem with this abstraction is just as mentioned before, I didn’t make it. The moment you begin to utilize code that you did not write you enter into a grey area. Not only can you not be confident about your code in the way you could be if you wrote it all, but, there is absolutely no chance that the tool you are using has all of the capabilities of the language it was written in. Material and Chakra UI do not have all of the capabilities of vanilla CSS. In a recent project, I wanted to update one of my base style values live using React State. Chakra-UI provided me with a extendTheme hook, that according to them would allow me to override my base style value in a stateful way, the key here being “according to them”. I couldn’t figure it out, and all I wanted to do was update a CSS value. Chakra-UI’s abstraction added about a day of suffering onto a simple task that simply would not have been such a pain had I built the styling myself.

Another amazing example is here

An article detailing how a name change of one simple NPM package broke the dependency tree of almost every major JS application in the world. Programmers thought they could abstract away 11 lines of code and look at where it got them.

So finally, abstraction is a give and take procedure. It gives powerful tools, complex logic, and shortens time working by years. It takes control over the code, a complete understanding of what is actually going on, and potentially adds lots of debugging time. It is up to the programmer how abstracted they want their experience to be.

--

--