Code your way to happiness and success

Code your way to happiness and success

What do I mean with “coding logic”?
I like to say that coding/programming (whatever you wanna call it) is not complicated, its actually very simple.
The problem most people have is that they start too big, too complex and get lost before finding the basics or understanding where to look.
Of course, I do know that it’s not easy for some BUT everyone can take something away from the way coding works.

Now, how does coding work?
As I said, its very simple, you have “blocks” of code and you just repeat the same few blocks over and over to create your core. You add functions into that core and thats where the complexity comes from.

But for you, for now, just the idea of blocks will be helpful.

A block is a part of code that always looks the same, with just a minor tweak here or there, lets look at the if-else-block

if(Thing that should be true)
{
  its true;
}else
{
  its not true;
}

This is a simple block that is being used over and over, you can also repeat it to check a lot of conditions.
To take this over to the real world,
IF I haven’t worked out yesterday, then I work out today, ELSE take a rest day to recover.

There are a lot of other blocks we can use,

while (as long as this is true){ do this}

do{do it once, then repeat if true}while(is this true)

What are functions?

Functions are repeatable actions, you call the function somewhere in your flow (in the if, else, while or just standalone) and then the function happens.
In coding this is usually something like transforming an input with the same pattern or storing something etc, there are really few limits to what you can make your function do.

Taken over to real-life a function could be something like

<pre class="wp-block-syntaxhighlighter-code">makeHealthyFood(); // this is how you call a function that is defined somewhere else

function makeHealthyFood(){
  if(proteinToday < 100g){
     makeEggs();
  }else{
     cookRice();
  }
}</pre>

Once again very very simplified, I would now have to define makeEggs() and cookRice, but maybe you can already see where I am going with this.

Predetermined actions and reactions of yourself, prepared for use at the right moment.

BUT WHY?!
Why indeed, the answer is fairly simple.
Limited willpower, every single day you only have so much bullshit you can take until you snap at your partner or family for something minor cause someone else fucked you over earlier in the day.

While most people act like that every once in a while and so most others understand, we are aiming to be better here, so creating functions and blocks for our daily life will limit the amount of wasted energy.

A lot of famous/rich entrepreneurs do this, like Bill Gates or Mark Zuckerberg, they always seem to wear the same clothing even though they got money without end.
They too understand the issue of limited willpower and instead of wasting 5-15 minutes picking an outfit they opt out and just use the same one every day.

Since we are not barbarians anymore though and we don’t want everyone to think that we are weird (or too broke for other clothing), since we are not one of the super-rich yet, we will instead add a block to the end of our day, with a function picking out an outfit for the next day and laying it out.

For food we can have a set amount of meals we usually eat, prepare some parts of it and then have set times for our food intake, suddenly you get all that done without hesitation and 20 minutes of “what should we/I eat”.

So…
You don’t have to become Neo seeing everything in code, but I am completely sure that understanding the idea behind coding blocks and functions and implementing this for some parts of your life will not only make you happier but also more productive and less irritable.

Give it a try and let me know what you think.

Leave a Reply

Your email address will not be published. Required fields are marked *