Stories code tells us

As your code evolves, it starts to tell a story

When I say the story of code, one of the things that mean is how that code came to be, but also what exactly the code tells and explains both in code and beyond it.

All code, written by us has a story behind it, where it came from, why it is written that way, why certain decisions were made, even if those decisions were made randomly or with your gut vs arduous thinking, maybe they were assumptions made based on information available at hand that time. This post is just something to ponder on the story our code tells us.

The stories that we have around our code continue to accrue as time moves forward. So let's say you are writing Javascript and you build up the naming conventions, and you create an idea, some kind of mental wrapper around values and relationships among other things, and that idea is necessary to grasp what is going on in your code. The idea has more meaning than the code gives it.

A function means more to a persona writing it than it to a computer interpreting it. This is necessary to understand because it means we name our functions in ways that constrain the way we think about them. So the narratives of our past code in many ways constrain or help define the narratives of your future code.

If you are to rename every function or variable in your code, you might come up with a different structure entirely.

We have seen that happen, if a person is working on existing codebases, any new code that is written on top of that, follows previously set conventions closely, while the same person writing a new app from scratch might structure their code in a completely different way.

Your code may have classes or functions which are named one way but there is more meaning attached to them, maybe the more meaning that is imbued in that object, that meaning is living in slack conversations, or your memory or the conversations you had with other people or documentation. We tend to overload our code with more information but the story of that changes lives somewhere else, somewhere beyond the code. Connecting those stories is not easy unless you know where to look. There is not just one story, everyone has a different experience with code and in many ways, the code is a snapshot of those experiences.

In the end, take time to consider what the stories are, that you are telling yourself, about the code.