Life Lessons Learnt From Programming

Mohit Kanwar
Xebia Engineering Blog
6 min readDec 3, 2019

I have been a software programmer for more than 12 years now, and I love this profession. There is so much to learn from software development that can be applied in real life. There are software engineering philosophies that help me lead and manage my personal life in an effective manner. Below are the ones that I found applicable to personal life:

  • Fail Fast — Failing early in life has lesser consequences and give you a better chance to improve yourself
  • Lazy loading — Delaying decisions until they are absolutely required gives you more time and information to make better decisions
  • Single Responsibility — Multitasking makes us less productive so we should focus on one thing at a time
  • Design Patterns: Talk to experts who have solved similar problems in their real-life can save time and might lead to better results
  • Environmental effects — Not everything can be controlled

Fail Fast

Failing Fast is a technical term that means identifying and reporting any problems as early as possible. For example, in Java, if you try to modify a collection while iterating, it throws an exception. This exception prevents any incorrect change to your collection.

This philosophy is fundamental in real life as well. It teaches us the importance of rehearsing and practicing. Recently, I was helping my wife learn how to drive a car. She is a beginner and understands the basics of driving. However, during practice, she took a turn a bit faster than it should have been. This resulted in her losing a bit of balance, and our car went off-track.

While we failed, but it helped her face the situation first hand. She is more confident in taking turns now. She failed early in practice and learned from it. She will definitely become a good driver soon.

Biology and medical science also depend upon the same philosophy. Animals (including humans) have a robust defense mechanism called anti-bodies, which prevent any foreign micro-organisms from entering our bodies and making us ill.

However, if the micro-organisms are too strong and fast, they can cause deadly diseases. Vaccines are weakened disease-causing micro-organisms, which help our body prepare against a real attack. When vaccines are introduced to our bodies, our immune system is on an attack, and it fails for the first time. This is why we get a bit of sickness after vaccination. However, that is under a controlled environment, and we know we will recover from this sickness. This helps our body to learn and be ready for a future attack.

Failing is not always as bad as it sounds.

Lazy Loading

Wow, I am going to justify another negatively perceived notion in a row. Being lazy is generally considered an act of waste. But when we talk about software programming, being lazy is considered being thoughtful and resourceful. The philosophy of lazy loading says we should delay making a decision (or performing an action) until it is absolutely necessary.

We all have experienced on sites like twitter or quora, on initial load the websites show a small list of items (tweets/stories), but all of them are not loaded at once. Initially, a few of them are loaded, and as we scroll down, more items are downloaded. This saves the utilization of bandwidth and other resources.

This article explains the effect of lazy loading brilliantly and why we see some blurred images on websites before the real ones load.

I went to a supermarket to buy some groceries. I love the fruit muffins from a particular bakery, and on that particular day, they were on an awesome sale. At the price of 2, I could have 5. Although at that time, I needed only one pack, the discount made me purchase more than I needed at that time.

So, post-dinner that day, we had our share and kept the rest of the cake(s) in the storage area for later consumption. Long story short, something happened, and we had to travel for next week. And because the trip was sudden, we completely forgot about the cakes. On return, the cakes had rotten. Lessons learned the hard way. Invest your time and money only when it is absolutely necessary; else it might go waste.

Single Responsibility Principle

The ‘S’ in SOLID principles stands for the Single Responsibility Principle. While you can read more about SOLID principles here, the Single responsibility principle states that there should be one and only one reason to change for a class. This allows the application to be manageable and modifying components when required. This provides a focused mindset for developers to work upon, and it brings out the best code.

To get the best results in our personal life, we should focus our mind and energy on a single task at a time. Breaking a big job into smaller tasks helps in focusing on one item at a time. This will make the job more manageable, and we will be able to bucketize different types of functions. This helps us identify our progress for a particular goal.

We will be able to prevent our emotions from impacting the results. The setbacks at the office should not govern our behavior at home. Also, troubles at home should not affect our capabilities in the office. Similar to implementing SOLID principles, compartmentalization of thoughts is easier said than done. But with practice, both can be achieved and are helpful in the long term.

Design Patterns

Design patterns are solutions to common problems, which are solved already by others. These solutions have been used by other developers and have undergone different use cases. Design patterns are documented problems and solutions which repeat during the application development and can be used in different applications.

In case of problems, we talk to experienced people, mentors, and gurus. It is essential to speak to experts. People who have more experience than us in related fields can guide us better.

Our parents, teachers, seniors at the office, and even friends who have more experience than us in a particular field can help us. There are proven books and blogs on almost all of the topics and even sites to connect to experts in case paid expertise is required.

I love youtube. Btw youtube contains more than cat videos. There are so many interactive videos on almost all the topics that learning becomes fun.

Design patterns come with a context, and they might not be useful out of context. One should be intelligent enough to know which design patterns are applicable in their context and what advantages are they going to bring. Similarly, not all teachers will be helpful in all situations. We should be mindful enough to identify which path of learning suits us and should choose the one that fits best.

Environmental Effects

Even the best-written software applications are dependent upon a lot of environmental effects. The RAM or CPU power of the machine, Internet speed, or even other applications running on the same machine. Even if you have an application to monitor your server’s performance, it will impact the performance of your server. It will consume some resources for analytical purposes.

A bug in the operating system can bring your application down. There are thousands of hackers with the sole purpose of finding loop-holes in your app and bring it down. That is bound to happen. Not everything can be tested right at the start. Test cases will be missed; impacts will occur. However, if we learn and keep improving our test environments, our application will keep on becoming robust and strong.

Humans are emotional and fallible. A lot of factors controls our actions. Our past experiences, financial conditions, health, and even if we are under observation or not control the outcome of our efforts. While we can prepare ourselves to perform under the worst conditions, many times, we will fail to predict the futuristic outcome. And that is okay. As long as we keep on improving ourselves, we can become a better human.

--

--

Mohit Kanwar
Xebia Engineering Blog

I am a software developer and learner. I love to read code written by other people, understand the logic and the architecture. I love “Why”s.