DEV Community

Chandravijay Agrawal
Chandravijay Agrawal

Posted on

Hard-Coding Your Values: Why a Compass is Better than a Roadmap

You are sitting at your desk at 10:15 PM on a Tuesday. The overhead lights in the office have long since clicked off, leaving you in the sterile, blue glow of your monitor. You are looking at a document. Maybe it is a contract, a performance review, or an email to a client. You are about to hit "send" or "sign," but your stomach is doing something strange. It feels like a cold, wet cloth is being wrung out behind your ribs.

You know why. You are about to agree to something that you don't actually believe in. You are about to "tweak" the numbers just enough to make the quarterly report look survivable. Or perhaps you are about to tell a "strategic half-truth" to a coworker to avoid a confrontation. You tell yourself that this is just how the world works. You tell yourself that you are being flexible. You are being a team player. You are being pragmatic.

But later that night, as you lie in bed staring at the ceiling, the pragmatism feels a lot like a puncture wound. You realize that you didn't just make a tactical choice: you moved the goalposts of your own character. And the terrifying thing is that you can’t quite remember where the goalposts used to be.

This is the phenomenon of the "Slow Drift." It is the process by which a human being, over the course of a career or a decade, becomes a stranger to their own younger, more idealistic self. We don't wake up one morning and decide to become villains. Instead, we make a thousand tiny adjustments. We update our internal software to match the environment. We become "compatible" with a world that we once promised ourselves we would change.

The problem is that most of us treat our personal values like a roadmap. We think of them as a set of directions that we follow to get to a destination called "Success" or "Happiness." But roadmaps are, by their very nature, subject to change. If a road is blocked, you take a detour. If the destination moves, you recalculate the route. When we treat our values as a roadmap, we are constantly recalculating our integrity based on the traffic of our current circumstances.

We think we are being adaptable. In reality, we are suffering from a fatal design flaw that software engineers spent thirty years trying to solve.


To understand why your internal compass keeps spinning, you have to understand the concept of "State." In the world of systems, state is simply the information that a system remembers about itself at any given moment. Your "state" includes your current bank balance, your mood, your hunger level, and, crucially, your current priorities.

The great nightmare of early computer programming was something called "Mutable State." "Mutable" just means "changeable." In the old days of code, if you had a piece of information, any part of the program could reach in and change it at any time.

Imagine you are writing a program to manage a bank. You have a variable called user_balance. In a mutable system, the part of the code that handles "Withdrawals" can change that number. The part that handles "Interest" can change it. But also, a tiny, unrelated bug in the "Change Password" section of the code might accidentally reach over and change the user_balance to zero. Because the data is mutable, it is vulnerable. It is "leaky."

This is exactly how most of us live our lives. We have a "list" of values: Honesty, Family, Health, Ambition. But because that list is mutable, the "Office Politics" section of our life can reach over and change "Honesty" to "Expediency" when the pressure is high. The "Stress" section of our life can reach over and change "Health" to "Another Cup of Coffee and Three Hours of Sleep."

When your values are mutable, they aren't actually values. They are just temporary variables. They are suggestions.

Funnily enough, programmers ran into this exact problem in the late 20th century. They realized that if they let every part of a program change the core data, the program would eventually become a tangled, unpredictable mess that crashed for no apparent reason. They called this "spaghetti code." To fix it, they created a brilliant constraint called Immutability.

In certain programming languages like Python, you can choose to store your data in structures that literally cannot be changed once they are created. If you try to change a "tuple" (an immutable list) or a "frozenset," the entire program will stop and scream at you. It will refuse to continue rather than allow the core data to be corrupted.

Here is literally what that looks like in Python: just to make the parallel concrete:

# A list is mutable; it can be changed at any time
my_values = ["Honesty", "Family"]
my_values[0] = "Convenience"  # This works, but you've lost your core.

# A tuple is immutable; it is frozen forever
CORE_VALUES = ("Integrity", "Courage")
CORE_VALUES[0] = "Safety"  # This triggers a TypeError and stops the program.
Enter fullscreen mode Exit fullscreen mode

In this example, the "TypeError" isn't a failure: it is a security feature. It is the system saying "I would rather crash than be someone I am not."


The reason we feel that "3 AM anxiety" is that our human operating system does not have a built-in TypeError. We are allowed to mutate our values as much as we want. We can swap "Integrity" for "Safety" in the middle of a Tuesday afternoon, and the "program" of our life keeps running. We don't crash. We just slowly become a different, buggier version of ourselves.

When we talk about "leading with integrity," we are usually talking about the ability to resist this mutation. But we often go about it the wrong way. We try to use willpower. We try to "be stronger." But willpower is a finite resource. It is a battery that drains every time you have to make a decision.

If you have to decide to be honest every single time a difficult situation arises, you will eventually fail. You will be tired, or hungry, or scared, and you will update the variable. You will "refactor" your ethics to fit the moment.

The solution isn't to have more willpower: it is to hard-code your values.

In engineering, "hard-coding" is often seen as a bad thing because it makes a program rigid. If you hard-code the price of a gallon of milk into a grocery store app, the app becomes useless the moment inflation hits. You want the price to be a variable that can change.

However, when it comes to the "source code" of your identity, rigidity is actually the point. You want your values to be "hard-coded" because they are the constants upon which everything else is built. They are the "True North" of your compass. A compass is only useful because the needle is "rigid" in its commitment to the magnetic pole. If the needle was "flexible" and pointed toward whatever looked interesting at the time, it wouldn't be a compass anymore. It would just be a spinning toy.

So, how do you move from a "Mutable Roadmap" to an "Immutable Compass"?

First, you have to identify the difference between a Strategy and a Value. This is where most people get tripped up. A strategy is "I want to be a Vice President by age thirty." A value is "I will not take credit for other people's work."

Strategies should be highly mutable. They should change as the market changes, as you learn new skills, or as your life circumstances shift. If your "Roadmap to VP" is blocked, you should absolutely recalculate. You should be like a "List" in Python: append new goals, remove old ones, and sort them as needed.

But your values must be the "Tuple." They must be the data structures that cannot be overwritten. If your strategy for becoming VP requires you to take credit for a subordinate's work, a "Mutable Value" system says: "Well, I'll just change my value of 'Fairness' to 'Ambition' for this one project. I'll change it back later."

An "Immutable Value" system says: "TypeError. This action is incompatible with the core data. Execution halted."


When you decide to live an "Immutable" life, you are essentially deciding to accept a certain number of "crashes."

In the short term, this is terrifying. It might mean losing a client. It might mean a tense conversation with a boss where you have to say, "I can't do that because it violates our commitment to transparency." It might mean being the only person in the room who points out that the "strategic half-truth" is actually just a lie.

But there is a profound psychological peace that comes with being a "Known Quantity."

In software, immutable objects are prized because they are "thread-safe." This means that no matter how many different things are happening at once, no matter how much "concurrency" or "chaos" is going on in the program, you can always trust that the immutable object is exactly what it says it is. It won't change behind your back.

People who hard-code their values become "thread-safe" humans. You can put them in a high-pressure boardroom, or a family crisis, or a moment of extreme temptation, and they will not mutate. This makes them incredibly valuable. In a world of shifting variables, a constant is a superpower.

One of the most famous historical examples of this isn't found in a church or a philosophy textbook, but in the annals of business. In 1982, seven people in Chicago died after taking Tylenol capsules that had been laced with cyanide by an unknown suspect. At the time, Johnson & Johnson (the parent company) had no legal requirement to recall every bottle in the country. It would cost them $100 million (about $300 million today). It would be a logistical nightmare. It would crater their stock price.

Their "Roadmap to Profit" was effectively blocked.

But the leadership at Johnson & Johnson had a "Credo," a document written decades earlier that outlined their values. The first line of that Credo was: "We believe our first responsibility is to the doctors, nurses, and patients, to mothers and fathers and all others who use our products."

That wasn't a variable. It was a "frozenset."

They didn't debate the cost. They didn't "recalculate." They performed a massive, national recall, which was unheard of at the time. They invented the tamper-evident packaging we use today. They chose to "crash" their short-term profits to protect their immutable state. As a result, Tylenol remains one of the most trusted brands in the world today. They traded a mutable variable (money) for an immutable constant (trust), and they won the long game.


The shift toward an immutable life starts with a very small, very private audit. You need to look at the "state" of your life and ask: "Which parts of my character am I treating like a List, and which parts am I treating like a Tuple?"

Most of us have a "List" of virtues that we’ve been carrying around since childhood. But because it’s a list, we’ve been adding and removing things based on convenience. We added "Productivity" because our first boss liked it. We removed "Leisure" because it felt like a bug. We edited "Honesty" to "Diplomacy" when we realized that the truth is often expensive.

To fix this, you have to perform a "cast." In programming, casting is the process of taking one type of data and forcing it into another. You take your "List" of values, you look at the ones that are actually non-negotiable, and you "cast" them into an immutable structure.

You decide that certain things are "frozensets."

A frozenset is a unique Python structure. It’s a collection of items where the order doesn't matter, but the membership is permanent. You can’t add anything to it, and you can’t take anything out.

If you decide that your "frozenset" of values includes "Time with my children" and "Intellectual honesty," then when a promotion offers you more money but requires you to lie to investors and miss every bedtime for a year, you don't have to "think about it." You don't have to weigh the pros and cons.

The pros and cons are irrelevant. The operation is illegal. The code doesn't compile.

This sounds like it would make life harder, but it actually makes life infinitely easier. The most exhausting part of being human is the constant negotiation with ourselves. We spend so much CPU power trying to justify our deviations from our own standards. "Is it okay if I do it just this once? What if nobody finds out? What if the outcome is good enough to justify the means?"

When you have hard-coded values, the negotiation ends. The answer is already in the source code. You save your mental energy for the things that should be mutable: how to solve the problem, how to grow the business, how to help a friend, how to build a better future.


The great irony is that we are taught to fear rigidity. We are told to be "fluid" and "agile." And in many ways, we should be. We should be agile in our methods, fluid in our opinions when presented with new data, and flexible in our strategies.

But you cannot be agile if you don't have a stable platform to jump from. In engineering, the most "agile" systems are the ones that have the most "immutable" core logic. They are reliable because they have boundaries.

If you are feeling that Sunday night dread, or that 3 AM anxiety, it is likely because your internal "state" has become corrupted. You have let the environment write over your values. You have become a program that is doing things it wasn't designed to do.

It is time to go back to the source code.

Take those values that you actually care about-the ones that make you feel like a "Version 1.0" human being-and "freeze" them. Stop treating your character like a roadmap that can be rerouted by every traffic jam of circumstance. Start treating it like a compass.

The world will try to update you. It will try to "patch" your integrity with compromises. It will try to "refactor" your empathy into efficiency. Your job is to make sure that those core files are "Read-Only."

Because at the end of the day, you aren't a roadmap. You aren't a destination. You are the system that gets you there. And a system is only as good as the things it refuses to change.


TL;DR

  • The "Slow Drift" happens when we treat our values as flexible roadmaps rather than fixed points, leading to a loss of identity.
  • Mutable State is the root of many bugs in both software and life; when your core values can be "overwritten" by stress or pressure, they cease to be values.
  • Immutability is the engineering solution: creating data structures that cannot be changed once they are set.
  • Hard-coding your values saves mental energy by ending the constant negotiation with yourself, making you "thread-safe" in a chaotic world.
  • And yes - you just quietly learned how Python handles immutability through tuples and frozensets to prevent logic errors.

A life without "TypeErrors" is a life without boundaries. Don't be afraid to crash if it means staying true to your code.

Top comments (0)