Dylan Falconer

Join 718+ game programmers getting weekly tips.

You Can Just Build Things

The Misconception

People have forgotten, or refuse to believe, that all software we have was built by other people just like them.

they spout this misconception online ad nauseam: “smarter people than you built X, so don’t waste your time”.

If you take this to heart, you stifle your own potential. Which, in my opinion, is the subconscious goal of these people. They are resentful about their own mediocrity.

There’s a name for this that’s familiar to anyone who has dabbled in entrepreneurship: “Limiting beliefs”.

The Sane Way to Think

I propose that we don’t listen to those people. That’s why in my recent streams on YouTube, I’ve been working things out, as much as possible, from first principles.

I’d never built a string builder before this stream. I’d never even looked at an implementation. I think I’d only used a string builder once.

By figuring out how to do this from the ground up I gained knowledge I never would have acquired by using someone else’s implementation.

Knowledge I can now use when doing other work. Such as implementing a binary file format for the Metroidvania module in my course.

I became a better programmer by taking an hour to implement something myself.

There are no performance or resource usage metrics to show here. That’s not what this is about.

How To

Assuming you want to, how can you do this yourself?

Next time you reach for a library or even standard library solution - that’s a good candidate.

Let’s walk through a hypothetical example. Say you’ve decided to make a hash table for fun/to learn.

Write down the answers to the following:

  1. What do you know about hash tables?
  2. What’s the usage API look like?
  3. What inputs must the system be designed to handle?
  4. What are the expected outputs?

I’ll answer these, as I recently did exactly this on another stream.

1. What do I know about hash tables?

They take a key and value pair, store it somewhere and allow you to look up the value by key.

2. What’s the usage API look like?

void *v = hash_table_insert("key", &value);
bool success = hash_table_remove("key");
void *v = hash_table_get("key");

3. What inputs must the system be designed to handle?

I implemented this from first principles on stream. I’ll provide a quick outline below. If you want the full experience, check it out here.

I already knew that hashing strings into a number may cause the output number to be the same - which means we get something called a collision.

We need to figure out how to handle this. I decided to do something very simple which is iterate over the hash table slots until the next empty slot.

That means the hash table can be full - it has a max capacity. It also means that locality of data remains high.

The implementation is entirely up to you and what you need for your program. Or, just what you want to try - because it’s all fun and learning.

The Takeaway

People who speak in limiting ways are wrong in most cases. They are just writing things to cope with and make excuses for their own mediocrity.

It’s an entirely natural part of the human condition to re-frame our choices to be in the right.

It’s important to understand that, and reject it when it stifles growth in oneself.


← Articles

Join 718+ game programmers getting weekly tips.