At My Edge: Number Bases

“Effective practice is consistent, intently focused, and targets content or weaknesses that lie at the edge of one’s current abilities”.

This quote is from a TED Ed lesson called “How to practice effectively for just about anything”, which Chris Lee, a Launch School instructor, shared with the student community not long ago. For a less than 5 minutes video, I am surprised by how many times I’ve thought about it’s message since. The idea has come up in conservation with friends, challenged me in code reviews at work, and nagged at me when studying late into the night and energy for learning new content is low. The first step in practicing at your edge is knowing what weaknesses are there at the edge of your abilities.

I’ll come right out and say it: number bases intimidate me. For those who draw a blank with the term number bases, think binary numbers (base 2). Number bases was one of those topics that when it came up, I knew what was being discussed, but I did not know the specifics. The subject surfaced recently in a pair programming session with my mentor. I decided, instead of just nodding my head because I was following his thought process (‘following’ is different than ‘fully comprehending’), I would ask him if we could take a pause from the problem we were working on to talk more specifically about number bases, what they are, and how they work. Additionally, I did some of my own research when I got home that evening and found this tutorial and article particularly helpful.

Below you can read about three takeaways from my brief dive into number bases. Was my goal to become a master at number bases? No, nor do I claim to be one. I am, however, more comfortable with the subject now and can approach certain programming challenges with a greater sense of ease than before. Acknowledging your weaknesses is the first step to practicing and mastering anything. What weaknesses lie at your edge?

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Takeaways:

1.) Number bases are everywhere.

In a way, I’ve used them for a long time — since learning how to tell time with hours, minutes, and seconds and how to measure ingredients in pounds and ounces to bake a cake. Today, I work as a media designer, and use number bases everyday to style HTML elements with color codes.

2.) What’s the point of number bases?

To record quantities more efficiently by using less space. For example, without number bases, it would take a significant amount of time to record the ~600,000 people living in my state if I had to draw one line to represent each person.

3.) How do number bases work?

Well, to explain fully would take some time, and to be honest, the tutorial and article I linked to above do a much better job of explaining than I would. I will share, however, some visual context which helped to solidify my understanding.

Let’s start with the number 456. From right to left (←), we know it has a ones place (6), a tens place (5), and a hundreds place (4). Nothing scary about that so far, right? Now imagine each ‘place’ is represented by a bucket on the floor in front of you in the same order. Each bucket can only hold ‘bundles’ of a certain size. Mirroring the ‘places’ from right to left (←), bucket #1 holds singles, bucket #2 holds bundles of ten, and bucket #3 holds bundles of one-hundred. The ‘bundles’ can consist of anything — how about your favorite candy. My favorite candy is a Twizzler, so if I look in bucket #1, I would see 6 individual Twizzlers. If I look in bucket #2, I would see 5 bundles with ten Twizzlers in each bundle. Lastly, if I look in bucket #3, I would see 4 bundles with one-hundred Twizzlers in each bundle. The number of bundles in each bucket is the number we record (4–5–6). 456 is simply a more concise way to write and represent the total number of Twizzlers in all the buckets. This is base 10 or decimal numbers, and this is the number base we are accustomed to in our society.

So what changes when you change number bases? The size of the bundles in each bucket. For example, if we change to base 4, bucket #1 would still hold individual Twizzlers, bucket #2 would hold bundles with four Twizzlers in each bundle, and bucket #3 would hold bundles with sixteen Twizzlers in each bundle. If we were to try and visually represent the 456 pieces of candy in base 4, we would need more buckets. Do you see why? Maybe not yet, and that’s OK. This exercise will only take you part way with understanding number bases, but hopefully, the picture I painted for you above is clear enough to get you started and accessible enough to make you curious.

Now I need a Twizzler…