Zen and the art of software engineering

John Pradeep Vincent
6 min readFeb 12, 2020

This blog is an attempt to pay homage to the classic book “Zen and the art of motorcycle maintenance” by Robert M Pirsig.

Let me ponder over the ideas in the book in the context of problem-solving & writing code.

There are various layers and dimensions to the book, but one central theme that resonates throughout the book is the exploration of the question “what is quality?”

How do you measure the quality of a solution/code?

If quality is in the code, then it could be measured- But I don’t think you have an algorithm to which you can provide your code and it can output the measured quality of the code.

Hence Quality is not objective, it cannot be measured objectively.

If quality is the construct of the mind, then it becomes a sense of preference and taste of the observer.

Hence Quality is not subjective.

But Quality is real! you know it when you are in contact with it, but it’s so elusive that you can’t accurately define it or measure it.

Any attempt to define a good quality code results in an act of listing down all the characteristics of the code, the design principles and patterns it possesses, but never accurately defining what Quality really is.

“The Tao that can be named is not the eternal Tao” — Lao Tzu

So what exactly is Quality? Can it be defined? Can it be attained by everyone?

We cannot use logic to identify if the code/solution is of good quality or not, because Quality is in itself an axiom, which is self evidently true but cannot be proven, it’s not deduced but accepted.

Even my attempt to tag Quality as an Axiom is wrong, Quality is not “an” Axiom, but the source of all Axioms

When Godel came up with his incompleteness theorem, what I think he encountered was Quality!

Godel’s theorem proves that all formal systems are incomplete in order to be consistent, which means that there may be infinitely many “truths” that are unprovable in the framework of a formal axiomatic system.

Quality is the source of all axioms, we don’t doubt the axioms and accept it as true, we build all our knowledge above the foundations of these axioms which arise from quality.

Quality is beyond the reach of the human mind, it cannot be limited by logical definitions, it’s presence can only be experienced.

Quality cannot be grasped using intellect.

Bushido

How does one produce quality solutions/products?

It all depends on the attitude of the person, the only way to tap into quality is to transcend your mind and become one with Quality.

A Samurai devotes his life sincerely to a set of moral values and pursues perfection in his craft without expecting any reward

This selfless action to one’s craft is a way to become one with the quality!

In Indian philosophies, this is referred to as the practice of yoga.

The word “yoga” nowadays is misused to refer to a form of physical exercise, but the original yoga refers to various practices that may lead one to self-realization, there are various types of yoga, the one that I am interested in this blog is the yoga of “selfless action” a.k.a “karma yoga”, where one devotes oneself to perfection of his craft and performs all actions without expecting the fruit of the action.

Selfless action is not an easy thing to do, our minds are so conditioned to look for external validations and chase after pleasure and run away from fears.

All actions one does with his mind is either to move away from fear or move towards a pleasure!

We identify ourselves as our minds and become slaves to it, we are on an autopilot mode which is driven by external events and impulses.

Selfless action is the exact opposite, where you know that you are not your mind and you act not for a reward, not for any recognition, not for money nor for external validations, You just devote yourself to your craft sincerely, you just become one with what you do, some people these days call this the “flow state”

Only those who perform actions this way can produce outcome of high quality.

Only those who overcome their mind and act in devotion can be at peace!

Only those who transcend their mind can unite with Quality.

You cannot “try” to do selfless actions, you cannot try to attain quality, trying is from the mind, you need to stop trying, selfless action should be effortless!

In order to produce art, one needs to rise above one’s mind.

Sometimes people get so attracted to this idea of selfless action and “desire” to attain it, but this is a trick played by your mind, it’s a trap! Be aware of such games your mind can play.

You need to examine the source of every desire when it arises, not with the intellect but with an honest and sincere examination.

when you perform your actions selflessly, Quality expresses itself through you!

you don’t produce quality, it just flows through you!

You become a channel for quality to express itself.

you transform from a person who just wants to get things working into a person who acts selflessly, who becomes a channel for quality to flow through.

you become a person who cares about your actions!

Quality and design patterns

As a developer, you will be aware of all the popular design patterns, I am not going into details about the patterns but would like to explore the metaphysical significance of patterns and it’s relationship to the Quality.

If you are aware of Plato’s Allegory of the Cave, design patterns and Quality have a very similar relationship as that of the shadow and the reality in the cave allegory.

Design patterns are the shadows projected by quality itself.

For any problem, there are always many solutions at our disposal, but only a few solutions have a sense of harmony with the context of the problem.

Christopher Alexander explores this sense of harmony in his book “The timeless way of building

If you are not aware of Christopher Alexandar’s works, the idea of design patterns in software engineering is borrowed from his idea of the patterns language

The harmony that a pattern brings to the problem is nothing but the presence of Quality!

Quality permeates Classic & Romantic understanding

In Rober Pirsig's book, he explores two types of human understanding.

One is the classical understanding, where a person is interested in the underlying form- The internal details of a compiler, the white papers, the internals of operating systems, hardware schematics, kernels, device drivers, bytes, I/O, etc etc.

Another is the romantic understanding, where a person is interested in the immediate artistic nature of the solution- meaningful variable names, smaller functions, concise syntaxes, appealing format of the code, sensible distribution of responsibilities, beautiful abstractions, etc.

In order for you to be a good software engineer, you need to have a balanced understanding of both classical and romantic understanding.

You should not prefer one over the other.

Quality is present as much in the classical world as it is in the aesthetic/romantic world.

What is important is your attention to the problem at hand, and a sincere, selfless pursuit of quality using both the classical and romantic understanding.

Stuckness

Another interesting observation from Pirsig’s book is the idea of stuckness.

when you are solving a problem, you usually apply your intellect and mind to the problem and desire to arrive at a logical conclusion of the solution.

However, oftentimes you may hit a hard wall! You can’t figure out which way to go, you have no more hypothesis to test, you have no more ideas at your arsenal to execute, you are basically stuck!

you can get frustrated with this state, but one can make an interesting observation in this state of stuckness- what is stuck is not your pursuit of solving the problem, it is the mind! The mind is just a repository of acquired knowledge and solutions to familiar problems.

when you encounter a problem you have never seen before, the mind exhaustively tests all the known hypothesis for hours and hours and then runs out of ideas and eventually gets stuck.

One needs to embrace this state, as it is the end of one’s mind and the beginning of one’s self in search of quality, you are now going to tread the territory of quality to access new truths/axioms/patterns.

Summary

If there is one thing that I want the reader to take away from this blog is the motivation to recognize quality in your daily work.

Quality arises not from the mind but in the absence of mind.

Quality is experienced when one pursues to perfect his craft with absolute devotion expecting no reward, recognition or self-gratification.

Quality cannot be chased, it will arise when one examines his mind and acts selflessly in whatever he does.

--

--