3 minute read

Programming Happiness

Tony Lea

Programming Happiness

At birth we are programmed with minimal code and eventually we learn some useful functions like crawl(), walk(), and eat(). These all get stored in main memory. As we get older we learn some advanced functions like love(), joy(), confidence(), and happiness(). We also learn some negative emotions such as fear(), sadness(), sorrow(), and pain().

Emotions are part of our core operating system. Our program tries to avoid running our negative emotions as often as possible, but they are hardcoded and cannot be removed. So, instead of avoiding negative emotions we should learn to re-program their response.

Why re-program negative emotions?

Understanding the need for change is crucial. If you do not learn how to re-program negative emotions, you'll end up in "The Recursive Loop of Negativity”:

Something causes you to feel sad, which then makes you sad about being sad, this makes you angry, and now you're scared that somethings wrong with you, this makes you self-conscious which then makes you sad, REPEAT.

When you get sad, you need to accept it and let the function run. You already know the code behind this emotion, so before the function ends you need to modify the return response.

In the past you might have let this emotion loop:

function sadness()
    return sadness();

Instead you need to modify your code to return a positive emotion. If you can learn to re-program your negative emotions then your problems won't seem so bad, challenges will be more appealing, opportunities more exciting, and happiness restored.

How to re-program

Re-programming your negative emotions is a process similar to debugging an application. You run the program, check the response, modify the code, and run it again until you finally get a desired outcome.

Each time you find yourself in the midst of a negative emotion you have an opportunity to debug your program. Not satisfied with the outcome? Re-write your code.

Quick warning: Emotions cannot be unresolved, that would be like creating a useless function:

function anger()
	// Why am I feeling this way? Oh well...
	return 0;

Not handling your emotions appropriately will lead to unexpected logic in the future. Instead, deal with the emotion in as few steps as possible in order to get back to a positive emotional state. The more you practice (modify your code) the more efficient it will get over time.

Let's use an example: 

Say, for instance that you got a speeding ticket. This immediately prompts your program to run the anger() function. "Yeah, the cop may have been a dick... But you were breaking the law, so get over it."

The longer you remain in the anger() function, the harder it will be to exit. Instead you need find a way to handle that situation and return a positive response:

function anger()
    situation = 'Got a Speeding Ticket';
    myResponse = handleSituation($situation);

    if(myResponse == 'Perhaps I should learn from this')
        return happiness();
        return anger();

Learning how to re-write these emotions will help you take control of your life and live happier.

The concept is simple enough, but the tough part is taking action to implement these changes. You will need to be mindful of checking your current emotion. Perhaps you can create a Cron Job that runs each morning with your cup of coffee.

Take a few minutes to detect any negative emotions from the previous day, then try and play out the same situation in your head with a positive and a desired outcome. This will help re-program emotions you encounter throughout your day.

The more beautiful your code, the better you will feel when running your program.