6 Life Habits That Programming Could Teach You Today

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.

flowchart   6 Life Habits That Programming Could Teach You Today

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.

The same is true in life. When you’re making a decision about how to go about paying off debt, buying a house, or how to handle any other complex life situation or even how to manage a project at work. All of those seemingly insurmountable tasks can be better managed when you first sit down, put pen to paper, and draw out a creative flow chart of every step in the process or decision. This will help you decide on all possible choices or predict all possibilities at each stage, and then trace through the various scenarios. Just like with programming, understanding how early choices could affect the outcomes later on will help you make much better-educated decisions early on.

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.

variables1   6 Life Habits That Programming Could Teach You Today

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?
assembly line   6 Life Habits That Programming Could Teach You Today

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.

As a start, go through our Automation Guide for The Web.

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.

 

documenting code   6 Life Habits That Programming Could Teach You Today

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 journal 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.

breakout   6 Life Habits That Programming Could Teach You Today

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 language, 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?

Image Credits: Flow Chart Diagram at Shutterstock, Javascript Code at Shutterstock, Programming HTML code at Shutterstock, program code on monitor via Shutterstock, Pavel L Photo and Video / Shutterstock.com

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

22 Comments -

0 votes

Jeremy S

I’m a software engineer and I don’t like doing some of these :P

0 votes

John, CEO

Not a good one dough, right?

0 votes

Jeremy S

Um, yea I’m a pretty good one.

0 votes

Félix D

I hate COBOL…

2 votes

Guy M

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.

1 votes

dragonmouth

When your boss wants the program done yesterday, all documenting goes out the window. :-)

Another point about documentation is that you don’t document for yourself as much as for the next worker bee that inherits your program when you get promoted to your level of incompetence.

0 votes

moxy

Hahahaha..SO RIGHT!

2 votes

Anonymous

A quite effective strategy, maybe one of the most important ones: KIS (Keep it simple). Probably overlooked because it’s so common sense like.

2 votes

Matthew

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 :)

1 votes

Ryan Dube

That’s a pretty cool analogy.

1 votes

Dan Sutton

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.

0 votes

Prodigi

Programmers are programmers because they tend to be lazy. They would spend time in automating stuff so that it doesn’t have to be repeated.

Unfortunately, That’s not how real life works. Sigh.

0 votes

dragonmouth

Obviously you don’t know the first thing about programming.

1 votes

Ryan Dube

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….

0 votes

Oliver S

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.

0 votes

Prodigi

Is it so? That explains the missing documentation in so many projects!

0 votes

Oliver S

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?

0 votes

Aibek

Great article!

0 votes

Manuel S

Ryan, you forgot the number 7.

“Every Loops MUST have an end”

0 votes

Anonymous Coward

I’m a pretty successful programmer, I’d say, and mostly none of the above is what I do systematically. Actaully, I’d strongly argue _against_ some of those rules.

The rules I follow: the SOLID principles, doing TDD, always doing the simplest thing that can work, plus continuous refactoring. There’s not much more to it. Really.

Rules are for fools. Use your mind. (Can’t remember who I’m quoting, it’s not my saying.)

0 votes

Angela A

Mmm… Flowcharts. Yup, right with you there. :)

0 votes

Rishi Raj

hmm… good.
Thanks for presenting.