Stoicism - is an ancient philosophy that got very popular in recent years in the world of uncertainty. Let’s take a look at it through the software developer’s prism.

Don’t explain your philosophy. Embody it.” - Epictetus

Let’s embody and implement our Philosophy Driven Code.

1. Constants or Environment variables

const FAMILY = [ "Drinking Father" , "Brother Brother" , "Loving Mom" ] ; const ENVIRONMENT = { school : "nearby school with hooligans" , finance : "below average" } ;

Environment variables or Constants — are things you can’t change, no matter what you feel, or think it is outside of your control by those you define your program pre-conditions.

You can only accept the game plan with these inputs and try to write your Life Program to execute and Return what you try to achieve!

When we are no longer able to change a situation, we are challenged to change ourselves.” — Viktor Frankl

The point is that we won’t complain about business requirements during our development as it is something we can’t change. So, the same principle applies to life. We have things which we can’t change as they are our DEFAULTS .

2. Execution

“First say to yourself what you would be; and then do what you have to do.” — Epictetus

To write a solution, you have to know what you expect to return at the end. Kind of like Test Driven Development approach 😄.

Without understanding a final goal, you won’t write a good quality program. We have our loop, which can end anytime. LIFE_LENGTH — is unknown and can break any single day.

function randomAge ( min , max ) { return Math . floor ( Math . random ( ) * ( max - min + 1 ) + min ) ; } const LIFE_LENGTH = randomAge ( 0 , 110 ) ;

So be sure that you use every iteration correctly, and your day loop filled with essential things.

function main ( ) { while ( age < LIFE_LENGTH ) { while ( day < 365 ) { let passedDay = [ ] ; let outcome ; outcome = watchNetflix ( "Witcher" ) ; passedDay . push ( outcome ) ; outcome = work ( "Passion Project" ) ; passedDay . push ( outcome ) ; outcome = workout ( "Crossfit" ) ; passedDay . push ( outcome ) ; passedDay = unpredictableEvents ( passedDay ) ; Object . freeze ( passedDay ) ; LIFE . push ( passedDay ) ; debugger ; day = day + 1 ; } age = age + 1 ; } return LIFE ; }

LIFE — is an array that will include all events and memories from your Life. You decide what to execute during your day cycle and how to run it.

Object.freeze(passedDay) — You can’t change your past, you can only reflect on it and move forward to the next iteration.

No man can escape his destiny, the next inquiry being how he may best live the time that he has to live. — Marcus Aurelius (Meditations — Book VII, 167 A.C.E.)

It is your duty to write a proper implementation of your main function. Again, as being said, you can change some things, so better make sure you focus on what you can to improve.

3. Bugs & Breakpoints

You can’t be entirely sure what is going to be an output/outcome of each function which you put into your main block. So that may introduce some unexpected bugs in your program.

The Good News is that you can reflect on each iteration and try to adjust your code accordingly. In Stoicism it is called Reflection.

So, now, you can understand why without any planning and reflection it is impossible to have your Life Array be filled with events and the outcomes that you want.

debugger ; day = day + 1 ;

Don’t forget to put a debugger before the end of the day, or your life cycle happens so fast that you won’t even feel that you had a chance to change anything.

“Life is very short and anxious for those who forget the past, neglect the present, and fear the future.” — Seneca

P.S. Seneca wanted to say; the life is short without breakpoints

4. Random Circumstances

“Whatever can happen at any time can happen today. “— Seneca

If that cycle worked only by our control, that would be too easy to write our perfect program. Unfortunately, and fortunately, Life also introduces an unpredictable pinch of randomness to our day cycles.

passedDay = unpredictableEvents ( passedDay ) ; Object . freeze ( passedDay ) ; LIFE . push ( passedDay ) ;

You can blame that your function did not execute as expected because unpredictableEvents messed up your output. But it is something you’re not in control of.

Review your variables

Adjust your code

Begin a new Day

Keep in mind what happened with you yesterday and be reasonable.

5. Return