Everything important that you need to know about living a successful life, you can get from a computer program. Don’t believe me? Read on.

When I first started programming as a young kid, it only amounted to copying foreign-looking words and symbols out of a computer magazine so that my brother and I could get our old Franklin 64 with a dual floppy drive to play a cute little digital tune at us. Back then, there weren’t many life lessons to discern out of that cryptic text.

A number of years later, in high school Pascal class, things started to look different. Learning about IF statements and FOR loops started to spark philosophical synapse connections the likes of which Walt Whitman and Robert Frost would have been proud of. Okay, I exaggerate a bit, but still the insights were pretty cool.

Yes, I know, it’s quite a nerdy thing to say — but the truth is that there’s a lot of wisdom in code….in while statements, arrays, methods, objects and all that. In fact, a whole lot that I learned about managing life in general came directly from my study of various programming languages.

Flow Charts Simplify Everything

Many programmers start out using flow charts long before they ever start writing a single line of code. The reason for this is, trying to write an entire program all at once can feel really overwhelming at times, especially when the program is going to accomplish some pretty complex tasks.

Programmers will take that big, giant software project, and then break them down into smaller components that can be better managed — sort of like building a car by building each required component first, before assembling them all together. Each component is a block (or several blocks) of code that take in specific sets of input values or actions, and then accomplish some output task. Within that component, a programmer will trace out the logic from input to output using flow charts.

Flow charts help you follow the logic in a visual format that is far easier to understand than if you try to write it out in text, or just try to blow right through writing code and figuring it out as you go. The reason programmers don’t figure out the logic “on the fly” like this is because the logic that comes later often depends a great deal on the decisions you make about how to handle the earlier logic in the program. Decide wrong early, and you could program yourself into a dead-end.

Everything Has Its Place

Whenever you launch into writing a script or a program, the first step is to always create your variables. In programming, there are variables of different types. You’ve got strings to hold text, integers to hold non-decimal numbers, double or variants to handle bigger numbers, and then you’ve got arrays, structures and more. The idea is to define a variable that’s suitable for the task at hand. For example, if the output of a function is the name of a person, then a string variable is what you want.

The same is true when you’re organizing your life, whether it’s your house or your office. You choose the size of containers for things based on how much of it you need to store. A small, clear plastic bin for dry goods or a rack of like well-labeled containers for spices to conserve space. At the office, you want to store daily work documents in a drawer in your desk, but you store sensitive, business documents in a locked cabinet. The right container for everything, and everything has it’s right place – it’s the motto for a well organized life.

Re-Use Program Modules to Save Time

Any good programmer eventually learns that certain blocks of code, otherwise known as “functions” can be reused in multiple programs. For example, one function to convert from Fahrenheit to Celsius can be used in any program you’re creating that needs that kind of task completed. The function is simply a module that takes the temperature in Fahrenheit and gives it back to you in Celsius. The function may include a certain number of lines of code, but why would you re-create those lines of code for every program you write, when you can just save them once as a program “module”, and then insert that module into any future programs that need it?

Henry Ford once said about his famous Model T, “Any customer can have a car painted any colour that he wants, so long as it is black.”

The reason for this is that Ford had figured out how to assemble cars and get them out the door faster if he could reuse the same equipment (and the same color paint) without having to recreate the process every time a new car was made. This gave birth to the assembly-line, and it revolutionized the auto industry. In the same way, you can use this principle in every area of your life where you do the same task over and over. Automation is the key to success, so if you can find ways to automate tasks in your job that you do repeatedly — you can make your day much more efficient and save time.

Document Everything

Sometimes, it can be pretty tempting for a programmer to just fly through writing code without documenting a single thing. It’s tempting because, any moment you know exactly what you want the program to do and how you want to do it. Documenting a program takes time. You have to describe how and why you’re doing each step. It seems pointless at the time, but months later when you decide to reuse that code or modify it for another purpose, it can mean the difference between struggling through trying to remember what the heck you were doing with each line of code, or quickly getting back up to speed with the whole intent behind your logic.

This meticulous documentation can help in every area of life, from keeping track of birthdays and anniversaries, to keeping a log of daily business transactions and why you made them. Daily life can turn into a blur of days passing by, with decisions coming and going like leaves blowing by in the wind. It’s naive and inefficient to trust only your memory to remember why you attended certain meetings or why you made certain purchases. A daily journalThe Beginner's Guide to Digital Journaling The Beginner's Guide to Digital Journaling Maintaining a private journal is a great way to build your writing skills, spill out your thoughts, desires, worries, and reflections on paper. The very act of writing itself can often help you think through...Read More or log can go a long way to freeing up your mind for more important things.

Always Leave Yourself an Escape Route

One of the most common mistakes of an amateur programmer is the infinite loop. That’s a situation where the condition required to break out of the loop never actually takes place, so the program stays in that loop and never ends — this consumes 100% of the PC CPU and pretty much locks up the computer for good until you kill the process.

The lesson that amateur programmer needs to learn is that whenever you create a loop to perform some kind of task that chews up a lot of CPU power, it’s important to introduce a release valve of sorts. In other words, instead of basing a While loop on whether or not your calculation exceeds a certain value (which it might never reach in some cases), it’s a good idea to introduce a very basic loop count and then add a secondary condition where the loop must end if it exceeds a certain ridiculous number of loops it should never really reach if everything is working okay.

How might this apply to real life? It goes to show that even when you think you have everything planned perfectly, things can go wrong. One example might be planning a week-long family vacation in the most beautiful, relaxing tropical paradise, only to have it end up raining the entire week. The idea of an “escape route” in life is to think of the “worst case” scenario, and then figure out how you’re going to either avoid that situation or make the best of it, if it comes true.

Life isn’t always predictable, and some of the best-laid plans can easily unravel, even when you think nothing at all can go wrong. Planning for the worst contingency will make sure that you don’t end up dead-in-the-water when that event that you never expected to happen actually comes true.

Free Up Memory When You’re Done

The final life lesson that comes out of programming is cleaning up after yourself. In a program, you will need to open up a stream to an output file, create a large array filled with data points, and other things that consume computer memory and resources. A clean program is one that closes those output streams or empties those arrays once the program is done with them. The idea here is to avoid a common problem with poorly written applications known as a memory leak.

For example, in a simple VB app, you would clear an array like this:

Erase ArrayDin

Or close out a file stream like this:

FileClose(1)

It sounds like something you’ve probably heard your mother say when you were younger, right? Clean your room. Put your clothes away. Do your dishes. However, taken a step further, putting away the tools that you’re currently using for the task at hand not only keeps your home and your workspace tidy, it also leaves you with plenty of space to accomplish your next project more quickly. Leaving things hanging around just wastes space and wastes your time when you can’t find what you need later on.

Bottom Line

The truth is, there aren’t just six life lessons that you can learn from the art of programming — there are many more. When it comes to organization, planning, plotting out strategies, and conserving resources, computer programmers have got it figured out. There’s a lot to be learned from taking the time to learn a programming languageWhich Programming Language Should You Learn For Software Development?Which Programming Language Should You Learn For Software Development?When starting on the path of programming, it’s important you invest your time wisely in choosing to learn something that will both benefit you in the immediate future with visible results on your platform of...Read More, beyond just programming itself. In fact, this is why every child should learn at least one programming language in school — because once you’ve caught on to the tricks of the trade, it becomes apparent pretty fast that you can use those same tricks throughout many other parts of your life.

What are some of the other life lessons you found a parallel for in the world of programming?

The missing documentation in so many projects. Honestly, I write plenty of documentation for myself, as a programmer. The better programs write good documentation. I am sure there are a lot of lazy programmers out there but people are lazy in general and you are blaming that on a whole group of people!?!

I am sure there are a lot of projects out there with missing documentation but that does NOT prove anything. Give me an example of a program that you have been having trouble with because of the documentation?

Yeah - from my own experiences working with programmers, they are some of the least lazy people I know. Automation comes from the need to accomplish even more in less time - not to relax more, but to do more....

No way. This is a stupid and ignorant comment to put. Programming automations is not being lazy, it is being efficient of your time. You have to work hard to solve the complex problems that you come across as a programmer.

I think that when you get to the point at which programming becomes a Zen act, and you stop thinking about variables, declarative structures, classes, algorithms and so on; things like REST and so forth seem childish to you, and the whole thing begins to feel more like sitting down with an old friend and explaining what you're thinking about, then your programs just work - because for them not to do so would imply that you'd been lying to your friend about what you're thinking.

At this point, what's actually happened in your head is that you've become virtually incapable of thinking the wrong way about solving a problem: the reason you can sit down and have a friendly discussion with the computer is that the processes which go on in your head before you start are so finely honed that, virtually without realizing it, you've latched onto the correct path for your programs to follow, and you've done so before you've even become conscious of starting the process.

Of course this bleeds into the real world: you find yourself seeing the answer to most problems in life as obvious, and when people come to you for advice, you look at them and say to yourself, "Why can't you see this? It's self-evident..." the thing, then, is a form of mental organization which imposes itself onto the way you think about almost everything.

When this happens, almost everyone else becomes annoying.

It's when you can't see an obvious answer to a problem that you need to realize that you've probably encountered something new you need to learn.

I found that in Programming involves writing Method/Functions/Procedures/sub-routines to perform actions on something. If you Methods are incorrect then your output will be incorrect. I find that the same is true in life - if you're not getting the results you want then change your methods :) or create new ones :)

Programming definitely develops analytical and reasoning skills, much like high end math such as calculus does. However, I think programming is more accessible to people than high end mathematics.
Programming has helped many life skills for me, however I haven't gotten much out of it in the way of things like compassion, or empathy. But using really bad software has made me more empathetic of the end user, as a programmer. So I guess that counts.
Great article. I like getting into the more philosophical side of technology. We should do more of that.

Ryan has a BSc degree in Electrical Engineering. He's worked 13 years in automation engineering, 5 years in IT, and now is an Apps Engineer. A former Managing Editor of MakeUseOf, he's spoken at national conferences on Data Visualization and has been featured on national TV and radio.