Swiss cheese model to understand test coverage


I often get into a debate with people about the type and the extent of testing that has to be done for software. One of the key arguments I hear is that developers should focus on creating only the happy path and leave the rest to the testers to find or have SDETs write extensive automated tests while developers can skip unit tests and focus only on writing useful code.

I have used the swiss cheese model to explain to people about the need for layered coverage instead of concentrating all the effort onto one layer. I first heard this term while watching an air crash investigation episode in nat geo. The narrator explains that though there are millions of parts in commercial airliners, the chance of getting into an accident is far lesser than motorcycles.

How an aircraft with millions of parts is able to get back on to the sky within a few hours after landing from a long trip? The answer lies in layered testing. The pilot has a pre-flight checklist, the ground staff do a routine check for visible damages, the maintenance crew notice the hours of usage and do preventive maintenance, there is a strong network of weather monitoring and routing, ATCs manned with trained staff and modern radars, aircrafts fitted with collision avoidance systems, a long series of protocols for ground and sky movements etc.

It is the same across many engineering and medical disciplines. The risk of something slipping through all the layers of test is very rare and if it happens then it is immediately plugged. In software engineering it is a combination of static checks, unit tests, integration tests, automated ui tests, heuristics & exploratory tests, performance tests etc. No one type of test can be removed altogether and replaced by another. We need the layers to move fast and yet deliver what is required.

Image courtesy: Davidmack, Swiss cheese model of accident causation, CC BY-SA 3.0


Spending, Savings & Investments

When you open the newspaper in the morning, mostly the front page ad will be by some builder luring buyers with a remarkable investment offer that is bound to appreciate in value with unheard levels of return on investments. One question I always wondered about was ‘why don’t these people hold on to their assets instead of selling if the prices are always upwards and skyrocketing’.

Many of the investment opportunities are nothing but spending disguised as investment. Buying a new flat involves taxes, registration, premium, loan fees, interest etc. It is good to buy one to live, but buying solely for investing that too on loans is nothing but a huge spend. We have grown up to see property yielding good returns, but that was largely due to the developments and migrations that happened to some of the cities. Stories of selling inherited houses and making a fortune were told to us which primed us into thinking that buying a property is an investment.

Investment is something that always carries a risk, for example cost of property during 1980s in North Chennai suburbs (like Minjur) and South Chennai suburbs (like Urapakkam) were same, but people who invested in the south reaped the benefits. The risk here was non development, the risk surfaced for some buyers and they ended up just getting inflationary returns. Investment needs knowledge of the market, environment, a bit of knowledge about the economy, a good amount of time and some dose of luck. There is a lesson for investing, do not put all your eggs in one basket but property is such an investment that it is a large egg which sucks up all your savings and locks it up.

Savings does not carry a big risk, but in the long term it definitely erodes away with inflation. Savings can be treated as a low risk investment with a very less return on investment, does not require much market knowledge, it is to cater to short term finance cushion. One should have around 3-6 months of expenses in readily drawable savings, anything more will be eaten by inflation.

What is safe then? Nothing is safe, we need to spend prudently and at the same time invest and save in different baskets to offset the risk of exposure in one area like real estate to the other like stock markets. Don’t succumb to greedy marketing and planned obsolescence, many things last really long.

Baskets for savings (immediate liquidity)

Bank deposits (fixed or savings bank), inflation will eat it over time.

Hard cash and foreign currency, if you travel often. Forex might move with inflation but hard cash will be eaten by inflation from day 1.

Gold, it can be held long as it does not lose too much value but gives less RoI.

Baskets for investments (Risk involved, but always pays over long periods like 15-20 years)

Stocks & mutual funds, equity should be held very long to reap the benefits of compounding and shield from short term market fluctuations.

Plots & farm lands in the fringes of the cities, will take a long time to sell and depends on the development around. If you are lucky could land in a major windfall.

Rental real estate, only if the rental yield is around 7+ % of the cost of the purchase and that too purchased outright without loans.


A comfortable house in a locality that brings peace,  when bought on loan; should not burden more than 40-50% of family income as it has a long repayment period. Keep in mind the high costs associated with registration, taxes and fees. Long term returns in the current market conditions pegs flats bought on loan to perform the worst in terms of RoI, treat it as if you are buying a car for yourself not an asset.

A good vehicle, as many people commute a lot. Better to avoid a loan and go for outright purchase which will make people negotiate hard and keep the existing vehicle for long. If you go for a loan then buy only if your outflow is around 20% of your family income and you can finish it off in 2 years.

There are plenty of marketing going on to make us spend a lot more than necessary like changing home appliances every few years, expensive and lifestyle brands etc. Create a budget for spending and try to stay within it as much as possible. Your spending budget per month is best limited as 3 times the rental rate in your area. The rest should be saved and invested.


During my school days, I have noticed doctors prescribing glucose to patients with weak digestion due to a recent illness. I was curious and asked one of the elders about glucose and got to know that it readily provides energy, you need not to wait for it to digest like food. I got so impressed that I decided to have glucose instead of food. Bought a box of glucose from my pocket money and started having it instead of my regular meals. Just within a day I fell sick because of not having enough food.

I did not realise why I fell sick but the elders at home scolded me a lot and made me eat regular meals. A few years later I studied more about the digestion system and nutrition in my biology class. We do not need just energy like how cars need only fuel to run, we need a balance of minerals, nutrients, some complex compounds and energy food in terms of not only glucose but also complex carbs, fat, protein and also undigestible roughage.

Undigestible roughage? Why would someone eat something that cannot be digested, I came to know later that it is as necessary as any other nutrient you have because our systems are designed to process food moving through the digestive system and roughage is the train that passes through the system unbroken. We are not machines, we are an assembly of symbiotic cells.

On a parallel; for people who are deep into work and only work for a long while, we can see them taking a wild break sometimes not even returning back to the same intensity that they were involved earlier. Similar to our digestive systems, our mind also requires roughage; we can’t keep hammering on high intensity work for ever to achieve great heights. Our mind should get a sense of living through the days instead of working through the days. Roughage for the mind can be anything that is done in leisure but not on targets and deadlines. It can be reading, gardening, walking around, playing etc. Go ahead and go easy on those long days. Find the balance, have enough roughage.


All work and no play makes anyone a zombie.


Speed or efficiency?

I went to a restaurant for a buffet which was a bit crowded. I thought the service at some of the live counters will be slow but was surprised that the people at the counters were able to serve large number of customers in a short span of time, especially the salad counters.


I was curious so visited one of the salad counters to see how was it possible for them to serve that many people at once. It was shocking to see that in the name of speed the person at the counter was cutting fruits in such a way that about half of them got thrown away along with the skin and the seeds. If this person had maximized the fruit content then it would have taken 4-5 times the amount of time taken now on fast cuts.

It is very clear that the restaurant can afford to waste as much of half of the food because they still gained from servicing a lot more people than operating efficiently. It was optimized for time not cost.

This is something people don’t understand while choosing tradeoffs, people often choose both cost and speed as key without giving a second thought that both cannot go hand in hand. If the same set of people had to do things much quicker and at a larger scale there has to be expenditures in tools, training and also some change in processes where there will be huge wastes before optimization kicks in. This is what happens in software development teams, often there is a tight budget and an impending doom if something does not happen; leading teams to easy burnouts.

I did not include the word quality here as it is non negotiable, you can do things quick and cheap but with a poor quality of work like serving the fruits with seeds still intact or skins not peeled well. That is not work done, there is no work without quality; eventually it drives away customers.

Next time when you have a debate about speed consider moving the cost sliders.




Max out

Often I come across questions like ‘is that what the max you can do in that situation?’. During these moments I get tempted to ask questions like ‘I saw you walking to my desk now, why did not you run?’.

I sense that people have misunderstood maximum to be optimal. Optimal is sustainable, maximum is usually followed by a recovery. A spike needs a dip because it is a zero sum game, there is nothing called sustainable peak performance; a peak has to be followed by a trough. heart-rate-1375324_1280

Managers always had a lot of coercive power and traditionally management was done by giving standard operating procedures and instructions. People needed to follow the instructions by the dot and put in the required number of hours without questioning as the supervisor had defined the tasks such a way that not much skill is required to produce a good output. As the output was directly proportional to the number of hours worked with strict supervision, people were made to work as long as possible with scheduled small breaks in between.

This works well as long as the output of a person’s work is directly proportional to the number of hours worked. Does it apply in software development? Nope, it is tough to correlate productivity with the number of hours worked on the task. Not just software, any knowledge work requires people to feel bored once in a while to get to a more innovative state of mind. Knowledge work also requires a healthy state of mind and body.  The proverb ‘An idle person’s mind is a devil’s workshop’ was coined when work meant only physical. There is no way to measure productivity just like no one can ever master a language 100%.

What stayed was the coercive power of the managers and the impression of long working hours & weekend work as productivity indicators. Some managers have gone to the extent of installing software that detects and logs activities which rewards pointless usage of computers while a lot has to be done with discussions, thinking, writing/drawing on paper & sometimes the answer flashes when there was nothing to do after an intensive bout of concentration at the problem in hand.

Maxing out is an option while we are playing sports like athletics where there is a disproportionately long recovery period that makes someone to push themselves so much so that they injure themselves to achieve peak performance. There is another place where maxing out is required, when people are fighting against each other, maxing out is never a peace time activity.

Horizontal gene transfer

Inheritance has played a big role in how kingdoms evolved and civilisations sustained. People passed on their wisdom to their future generations and created a sustained momentum of progress. The progress was largely confined within the family, a great medical practitioner will pass on the knowledge to the kids and make sure they memorise a lot of things and do not pass on the trade secrets to others. Slowly greed took over and instead of greater good, personal wealth and wellness took top priority. This is when territorial population got slowly disrupted by invaders who learnt to break the fragile unity and encouraged personal growth by turning people against their allies and eventually they also fell prey to invasion.


We think the world belongs to humans, it does not. It belongs to microbes. They are everywhere, in huge numbers and very very resilient. They are inside us, outside and have even learnt to live in hostile conditions. I also read in the newspapers about bacteria developing antibiotic resistance and quite difficult to treat if people get these resistant strains. I was curious on how bacteria develop resistance and stumbled on an article which explained about ‘Horizontal gene transfer‘. Bacteria do not just inherit the resistant genes vertically from their parents but also from other types of bacteria, virus, fungi (the list goes on) which may not even be virulent.

Learning and co-operating with others is what makes someone resilient along with their peers, this is what I inferred from my readings about horizontal gene transfer. If we concentrate only on personal growth and well being then it is just a short amount time before we lose out to groups which learn together. Personal growth is useful only when others around us also grow and sustain that momentum. There is a nice story about growing good corn, a farmer shares the quality seeds with neighbours to make sure cross pollination happens with healthy corn.

Winning alone and winner takes it all is a greedy task, it pushes people into damage control mode and work in transactions. People won’t remember us for our transactions, there is nothing to reciprocate in a transaction. It looks like we will not have a resilience building horizontal gene transfer equivalent for humans. We may eventually fizzle out of existence trying to outsmart each other.

You can only run, you cannot hide

Recently I read an article about NSA’s efforts in identifying Satoshi Nakamoto, who created bitcoin and remained elusive. NSA had spent a lot of resources at its disposal to create a writeprint to for billions of texts around the world and zero in on Satoshi.

Fingerprint plays a huge role in investigations as they provide a reliable identity which is difficult to change, before that identity was based on photographs, height, mole marks etc. So the quest for fingerprinting grew and now it is possible to get voiceprint, writeprint and can work on anything to create a unique signature about a person.

privacy-policy-2499720_640I read about this first in Simon Singh’s Code book, the book talks a lot about how cryptographers had to constantly be on the run to come up with new techniques just to be broken by cryptanalysts who find chinks in the armour, it is a never ending game. One of the interesting reads was about a fingerprinting technique called fist, which is a style arising due to the telegraph operator’s way using the telegraph key. While the messages were encrypted, the operator’s fist gave away the identity of the german troops and by radio frequency analysis the location was also identified. The messages which were encrypted was of no use to the British, but the location and identity proved to be vital  which was invaluable when there were no satellites.

I never took privacy and security seriously, but the more I read about and hear from friends the more insecure I feel. If someone is determined enough and have resources at hand, it is going to be an easy task to violate someone else’s security and privacy. More and more tools to break will be freely available and new technology is going to make current military grade encryptions cakewalk to break. If we need privacy we need to keep running, there is no place to hide.

p.s. Also read about ‘Dolphin attack‘ which takes vulnerabilities to new levels.