How do programming principles equate to life’s principles?

Rmag Breaking News

How do programming principles equate to life’s principles?

According to Google, A principle is a a fundamental truth, belief or rule that serves as a foundation for a system of belief or for a chain of reasoning. That’s a pretty long winded definition of the word ‘principle’, but it’s pretty spot on. In simpler terms, a principle can be said to be a fundamental rule or truth that helps you achieve a specific goal. Programming has several pretty standardized principles that any aspiring developer should learn, most notably DRY, KISS, YAGNI and the SOLID principles. Following these principles ensures that the developer’s code is simple, readable and maintainable. Just like programming, life in general also has principles. These principles are typically more subjective than in programming, and usually different people employ different principles. Still there are some general principles that most people live by, such as ‘Be kind’, ‘Be positive’, ‘Be healthy’.

I’m probably not the only one who has at some point thought – “How could you apply programming principles to life?”. I think that programming principles draw a couple of very close parallels to life’s principles, and I think that many of them can be used in life just like in programming. Let’s look at the most common programming principles and see how they could equate to life’s principles.

Keep it simple, stupid

“Keep it simple, stupid” or KISS for short is a programming principle that suggests that we should be writing code that is as simple as possible. ‘Simple’ in this context means short, readable and easy to grasp.

I think this would be a good principle in life to live by as well. Try to solve problems in the simplest way possible that is easy to understand by others and that doesn’t take much time and resources.

You aren’t gonna need it

You aren’t gonna need it, or YAGNI, is a programming principle that tells us that we should only focus on what is necessary for us right now, and delay future work for when it is actually needed to be implemented.

This can equate to life’s minimalism principle or lifestyle. Only use and possess what is absolutely necessary for you, and let go of any attachments and addictions that might be bringing you down.

Don’t repeat yourself

Don’t repeat yourself, or DRY, is a programming principle that says that we should write code that doesn’t repeat itself. For example, we can write a piece of code that assigns a value to each element of an array, line by line, or we can write a single for loop that iterates through each element of the array and assigns the necessary value, thus minimizing the amount of repeated code that we write.

If you think in more abstract terms, what I think DRY is really suggesting is similar to the KISS principle – don’t overcomplicate things and try to achieve things in the simplest and least effortful way possible, which is again a good principle to follow in life, in my opinion.

Independence

In programming, it is usually preferred to have your different modules be as independent from each other as possible and not rely on each other, i.e. decouple them.

This oftentimes is a good life principle to live by – strive to be independent and don’t let yourself depend on addictions or other people.

Summary

In this post we explored some similarities between programming principles and life principles. Do you agree/disagree with what I wrote? Or maybe you have some suggestions for other similarities? Let me know if the comments!

Leave a Reply

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