Programming with Tao

I have been reading Tao Te Ching, a very famous Chinese classic text written by an ancient master a few millennia ago, translated and interpreted into various languages over the years by scholars. I am reading an English interpretation by Stephen Mitchell. A loose translation of the title is “The Way”, which is commonly referred to as Tao or Taoism. My interpretation of Tao philosophy is that it is a way of conducting one’s own action and non-action to achieve internal and external harmony with ourselves and with our environment. The text isn’t prescriptive; it is up to the reader to interpret, reflect and apply its teachings.

Here is one passage that the Masters wrote:

Act without doing;
work without effort.
Think of the small as large
and the few as many.
Confront the difficult
while it is still easy;
accomplish the great task
by a series of small acts.
The Master never reaches for the great;
thus she achieves greatness.
When she runs into a difficulty,
she stops and gives herself to it.
She doesn’t cling to her own comfort;
thus problems are no problem for her.

A common theme in the text revolves around the exertion of effort. This is my interpretation as applied to software development.

Act without doing;
work without effort.

When you get a feature request or a bug report, do you rush into coding? Probably not. You would hopefully start with some analysis of the feature to understand what needs to be done and whether it needs to be done or not. You would try to reproduce the bug report so that you can theorise where the problem is. After all of that, you form a plan. Do you start with tests? Do you work with a designer to create mockups? Do you ask followup questions? Once you have a clear idea of what to achieve, you can start coding. By not rushing in, we respond without jumping into coding. When we code, we code only for what is truly required, thus working without effort by minimising re-work.

Think of the small as large
and the few as many.

The small details in the spec require as much attention as the big ones. Sometimes, it is the small and seemingly trivial features that cause the most implementation pain and wasted effort.

Confront the difficult
while it is still easy;

Almost every application depends on something fundamental for it to work. For web applications, this could be security concerns such as authentication and authorization or it could be the customer’s user experience with the product. The foundations are laid when there is nothing on the ground. The core concerns are implemented while the application is bereft of features.

accomplish the great task
by a series of small acts.

Rome wasn’t built in a day. Break large tasks into smaller tasks. I like to break tasks down until it is something I can reasonably accomplish in a few hours.

Don’t write thousand line god functions or classes. Try applying the Unix principles of designing small, modular units that are composable. Large maintainable programs are built out of smaller units.

The Master never reaches for the great;
thus she achieves greatness.

I think it means that you should focus on the work you are doing, and to do the best that you can. When you are done, review your work, be critical of it and ask yourself how you would improve on what you accomplished. Could you have restructured your code differently? Could you have written less code to achive the same outcome? Did you write tests?

When she runs into a difficulty,
she stops and gives herself to it.

When working on a project, there are going to be plenty of times where you end up with a roadblock. It is tempting to give up and call for help from a colleague. Don’t give up as soon as things get a little bit difficult. Apply some effort into solving the problem on your own before asking for help. Consult the documentation. Read the source code of the library or framework if the documentation doesn’t help. Revisit your assumptions. Do you have a clear understanding of what you are trying to do?

She doesn’t cling to her own comfort;
thus problems are no problem for her.

Everyday, someone is out there publishing a new tool, research paper, project, etc. In this industry, we have to keep learning and expand our skill set. If you only know one programming language, learn another. If you only know one programming paradigm, learn another. If you only know one framework, learn another. There are also online courses that you can take to polish your skills in areas like algorithms and data structures.

The more you learn, the more adaptable you become. The more you know, the easier it is to identify appropriate solutions. When you only have a hammer, everything looks like a nail.

I hope you enjoyed my interpretation. Of course, most of what I wrote is mostly common sense, but sometimes a reminder is all we need to stay on the right course.