Tuesday, September 17, 2019

SOLID principles for Object Oriented Programming, with LIQUID and GAS

In Object oriented programming, the SOLID principles play an important role in designing the solutions and structuring the code.

For a quick recap, below is what SOLID briefly stand for:

  • S - Single-responsiblity principle: A class should have one job, and only one job.
  • O - Open-closed principle: Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification
  • L - Liskov substitution principle: Every subclass / derived class should be substitutable for their ancestor classes
  • I - Interface segregation principle: No client should be forced to depend on methods it does not use.
  • D - Dependency Inversion Principle:1) High-level modules should not depend on low-level modules. Both should depend on abstractions (e.g. interfaces). 2) Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions

But solid also happens to be a state of matter. To make matters fun, here are 2 more acronyms that can be used in software development, to complete the three commonly found earthly states of matter :)


  • L - Learnability: The program/module/class/method should support enhanced learnability of anyone using / extending it
  • I - Input validation: All inputs must be validated to avoid any security and other bugs
  • Q - Quality control: Code should be structured so that ways to keep checks on regression and maintain strict quality can be easily ensured. i.e., tech debt should be kept within viable limits
  • U - Understandability: Code is modified and debugged more number of times than freshly written, and it must thus be easily understandable for the next person. Conventions needs to be followed consistently
  • I - Integration: Code in isolation is limited in the impact it can have, and so must be so structured to promote easier integration within other projects / modules etc.
  • D - Defect averse: defects have a way of creeping in, so code should be properly tested and structured in a way to minimise code smell and defects.


  • G - Great readability: Code is read a lot more than it is written, and to save time, should be readable.
  • A - Avoid Anti-Patterns: While using design patterns and other strategies is good, one must know when to avoid the common anti patterns
  • S - Security promoting: Unsafe security practices should be avoided at the offset. As Mad eye moody says, Constant Vigilance is the way to avoid security nightmares.

Monday, September 02, 2019

Waterfall vs Lean vs Agile vs Scrum vs Kanban

If you work in software development, chances are, you've heard of all the terms above.

Over the years, all of these terms have turned into buzzwords, with people using them witout even understanding what they really stand for. So, its common to hear things like waterfall is bad, or asking that a scrum team adjust their changes for newer requirements, or use kanban boards to keep track of stories.

In this post, let's have a look at what all these terms stand for.


This represents a unidirectional flow of development process, where various steps are taken one after the other, in order. So, first goal is to do requirement collection, next an analysis of those requirements, followed by designing of solution, which is finally coded, implemented and integrated, to be released to the customer.

Waterfall works great when the requirements are static. That is, they are the same on the day of delivery, as given on day of initiation. However, most business requirements and projects are not static. Each of the steps above take time by themselves. Businesses are today much more dynamic, and even the customers are lot more demanding. Which is why, taking feedback becomes a necessity, and this is what is the achilles' heel of waterfall model is.


So people looked into other domains to find out what stands out in other industries to make the process more efficient, and the final product less defective. One existing mecahnism they found was the Six Sigma and Lean management.

Six Sigma is a disciplined, statistical, data-driven approach for continuous improvement and eliminating defects in a product. The six sigma method was inspired by happenings at Motorola. Soon, within the larger industry, most notably Japanese carmakers, lean management starting taking hold. Lean management stood for eliminating waste, and this principle got adopted to the software industry. (Just like how design patterns were originally inspired from construction industry, or how biology inspires many genetic algorithms).


However, lean also did not fulfill all the aspirations. For, technology is ever changing, and in the technology world, the tools, the requirements, the customers, and the product, all change very quickly, as compared to other industries. So, the existing strategies started feeling heavy, with all the business requirement documents, technical requirement documents, technical specification, change management document, and a lot of other processes.

Many lightweight software development frameworks starting coming up to the fore, to counter such heavyweight methods, as, one size does not fit all. The result was an umbrella of methods, like Scrum, Extreme programming etc. Even later, newer methods such as Behavior Driven Development, Test Driven Development, Kanban etc kept coming up.

Agile gained popularity as this umbrella above, with the coming up of the Agile Manifesto.


Scrum is one of the agile methods. Scrum is a software development framework. By that, it means that Scrum provides a designated structure in which a Scrum team must function - it provides the roles (product owner, scrum master, scrum team), the meetings, and even what interactions should happen between the different members.

Today, scrum has come up as one of the popular agile framework for software development, with its focus on incremental delivery and constant iterations to deliver a requirement every spring end


Kanban is a lean management tool that got picked up from the car maker Toyota. Kanban is used to achive JIT (Just In Time), and the focus of Kanban is to keep Work in Progress (WIP) to the minimum. It is very useful in projects where the work can be heavliy broken down into equal sized tasks. However, many do not consider it to be a complete software development method.

Sunday, September 01, 2019

The ORID technique for Focused Conversations and Learning

Reading upon some resources for better scrum setups, I came across an acronym - ORID - for managing retrospectives better.

The general problem with retrospectives is that people keep jumping to conclusions, or keep repeating the same things in different words.

But even during meetings involving larger number of people, such as postmortems, reflections, Root cause triaging etc, conversations degrade in quality, and at times, people fail to arrive even at the common interpretations of the same set of events. Thus, objectivity takes a hit, and it is hard to arrive at good action items that everyone will agree to. 

Things keep dragging on, until the initial momentum slows down, and is finally lost by cherry picking the top few low hanging fruits that work for everyone.

So, what is a good way to keep the discussion focussed, when people want to have good learnings from a common events and decide on what to do based on them?

One answer is ORID. In this post, I will explain the understanding I built from reading around various sources, and thinking back on situations I've observed.

ORID stands for 4 steps in questioning the shared event:

  • Objective
  • Reflective
  • Interpretive
  • Decision

ORID is driven by a facilitator experienced in the method, such that the participants may not even feel like the conversation is structured. It is a group exercise, in which everyone together forms the cohesive unit, hence also being useful in scrum which is naturally about one team. A lot of the output of ORID depends on how the facilitator structures the questions and modulates the discussions. Being a 4 step process that requires carrying context, ORID requires uninterrupted time, which can be a constraint in different setups.

In the first Stage, Objective, the group tries to remember the event and sequence of events that happened. From these, the facts are distilled, which all can agree upon to be facts. The facilitator has to keep an eye out for the discussion spiraling out of the objective into emotional territory - that is a later stage. The facts are stated and heaped together, but no analysis happens. So effectively, people tell what they heard, saw, know, read etc, but not what they feet, think, imagine, worry, doubt etc.

In the second Stage, Reflective, the emotions are dealt with. How do people feel about the topics - these can be positive, negative, apprehensive, or mix of other emotions. The focus here is to get the gut reactions of individual members, which may or may not be supported by facts of the first step. The idea is to get all the fears and concerns out in the open.

In the third stage, Interpretive, the focus is on the larger stakeholders/actors. By now, all people are aware of various facts about the events, and about the way others feel about them. So more or less, everyone has an idea of what others think. However, the focus is not the individuals, but taking a broader perspective. For example, What does this mean for the organization? for the business unit? for the individual teams? for classes of people involved (leadership, developers etc)? This step is all about analytical phase, but seen from the Point of view of different hats, and not an individual

In the fourth and the last stage, Decision, the group decides. The idea is to to think about the future, get concrete action items, so that they can actually be put into practise. The focus can vary from the practically achievable to the best course of action, given the resources.

Tuesday, August 20, 2019

Humanity and global warming

Humans are the black swans of earth's history. Global Warming is a cyclical phenomena (It isn't the first time that earth is heating up due to the natural green house effect), yet humans have managed to achieve that in less than 200 years what earlier would take thousands of years, taking away the time for adaptation for all other species. No species in recorded history (that humanity is aware of) could do so much damage, in so small a time.

Quantifying the impact of humanity on global warming in the world

The UN estimated that of the over 8.7 million total plant and animal species, there are over 1 million species which are at risk of extinction. All of that impact is caused by the activities of just 1 species: Homo Sapiens.

Imagine 1 man wiping off over a tenth of the living population. Does Genghis Khan and his army come to mind?
Imagine 1 man wiping off millions. Does Adolf Hitler  and his Nazis come to mind?

That is what humanity as a single species is brutally doing to the other species of planet earth.

Some analogies to understand the standing of humanity in th world

Humans have an estimated Population of 7.57 billion today across the world.
Assuming an average mass of 62 kg per human (as per wikipedia), the total mass of humanity would be = 7.57bn *62kg = 469 billion kg

The density of human body is close to that of water, (70% of human body is anyway water). Hence we can approximate that 1 kg of human mass is equal to 1 Litre of water.
So the combined volume of all humanity = 469 billion litre = 469 * 10**9 * 0.001 m3 = 0.469 km3.

In comparison, the volume of the black sea is 547,000 km3, and the total volume of water on planet earth is 1.386 billion km3.

So in essence, humanity is not even one in a millionth mass of the black sea, and not even one in a billionth mass of the waters in all the seas, and yet one has to wonder at the damage we are doing.

Any solutions?

Microplastics are everywhere - its choking the life out of many of the larger animal species. Humanity as just one species is enough to destroy life for all other species on the planet. The fight against global warming is a loosing war. Already islands are submerging, the coastlines are receding, climate patterns are changing world over with the heatwaves in Europe, polar vortex in US, rains are becoming erratic with many parts of India flooded due to heavy concentration of rain.

For all their talent, humanity is yet to invent a time machine which could allow us to go back in the past, and make better sense prevail.

No matter how much or in which ways humanity reacts, much will depend on how Planet earth will react. Weather patterns today are chaotic enough to not be predictable by even many advanced computer simulations. Rains, winds, heatwaves, snowfalls, clouds - these are directly going to impact global food security in the years to come, with ripple effects on many other industries such as travel, infrastructure, communications and energy security.

Paris summit of 2015 did try to take us on a path to control (and later remedy) the global warming, but with the withdrawal of US in 2018, its agenda has hit a roadblock now. It is high time the leading nations of the world came together to solve the menace of global warming, overcoming their petty differences, as otherwise, there soon might be no conceivable world to squabble over.

Saturday, April 13, 2019

General Elections 2019

As around most other elections these last few years, the election campaigns have begun with shrill accusations and far fetched promises. The incumbent NDA government is facing a combined opposition, with many regional parties suggested to give a stiff fight in the elections for the 17th Lok Sabha.

In this post, I will try to analyze the major trends that in my opinion will be witnessed in these elections:

1. Election promises and cash freebies

Farmer distress is real, and the message was delivered to BJP and Congress alike by the verdict of the Vidhan Sabha election results of 2018 in 5 key states such as Madhya Pradesh, Rajasthan, Chhattisgarh. This resulted in formation of the PM-KISAN scheme (6000 per annum basic income to farmers), farm loan waiver across 17 states since 2017 (estimated at ~50 billion dollars), and now promises of a basic income support (NYAY) of Rs. 6000 per month to poor families by Congress.

Even for the unorganized workers, the pension scheme (PMSYM) promising pension of Rs.3000 per month is a step in same direction, since workers of age < 40 years are eligible and thus can reap benefits after 20 years only.

2. Dusk of Rahul Gandhi’s and Dawn of Priyanka Gandhi’s political career

Junior Gandhi has been heavily trolled for years now. A section of Congress had always yearned for Priyanka Gandhi to take command of the party, given her organizational and oratorial commands, and her uncanny resemblance to Indira Gandhi. With the election results win in 3 key states in 2018 assembly elections and with the general expectation that from the previous tally of 44, Congress tally is expected to go up to 70-80, Rahul Gandhi will get an opportunity to take a reduced role in a resurgent Congress and leave command in the hands of a more capable Priyanka Gandhi.

3. Nationalistic fervor and comatose rafale scam

The BJP has well capitalized on the surgical strikes in Balakot in a response to Pulwama suicide attack masterminded by Jaish terrorists based out of Pakistan. The narrative that Indian air force bombed terrorist camps in Pakistan territory (going beyond PoK) and in the dogfight managed to shoot down a 5th generation F16 with a 3.5th generation Mig21 has been bought by Indians. The opposition has been mostly rendered toothless now on the rafale scam with no incriminating documents brought on record so far, other than alleged parallel negotiations which could’ve made the deal costlier. In a way, Modi Shah duo has managed to take complete steam out of the Rafale scam narrative that was a major agenda item for Congress for past 1 year, for the purpose of these elections. The law will continue taking its own course on finding if there were any actual irregularities, but for the purpose of these elections there should not be much spillover effect now.

4. Modi vs Combined opposition

During the state elections in 2018, one of the interesting election slogans in Rajasthan was “Modi Tujhse Bair nahi, Rani teri Khair nahi” (Modi we have no problem with you, but the queen Vasundhara will not be spared). The slogan is an interesting insight on how the average voter might vote - many see the humbling defeat of BJP in the recent assembly elections as enough of a punishment/lesson, and may vote for the incumbent. The fact that direct benefit schemes like PM-KISAN was launched also helps BJP in an image makeover vis a vis farmers. Even though demonetization failed in its stated objective of bringing black money to surface (while having some other unstated benefits), many voters still consider Modi to be a better leader than the projected/absent alternatives for a better development of India. This sentiment is going to hurt the opposition in its final tally.

5. Transition of Congress party from a national party to the national glue

The Congress of today is not even a shadow of its formal self of the 1950’s, when towering leaders of Indian independence movement were all part of it. So, many regional parties (like AIADMK, DMK, JDU, JDS, Trinamool, BSP, SP, BJD, AGP, NCP, TDP, Shiv Sena etc), and a national party (BJP) have now taken over the space vacated by it over the past 70 years. However, being the oldest party, Congress still has a large recall value for the lay Indians. Thus, the party is today acting more like a glue holding the other regional parties together in a combined opposition, rather than being the challenger in its own right.

6. The downfall of AAP

Aam Aadmi party has a sub altern core base that will continue supporting it in the next few elections to come. However, with the antics of incessant Dharnas and honesty certificates in the first half of its tenure, with an insistence on a Congress alliance for Lok Sabha election, and reports of cash hoarding by one of its MLAs, the party is steadily moving away from its core ideology of clean politics on which it was founded during the Anna Hazare movement. With exit of intellectual political brains like Yogendra Yadav, and Bhushans, AAP is slowly becoming a shadow of its former self, and will continue disenchanting its urban supporters.

Given the party largely uses clean donations to function, it is going to be squeezed further in the future for its party funding. Even otherwise, with its stellar performance in 2014 Delhi elections where it won 67/70 seats, its tally is bound to come down, which will strengthen the narrative that the party is on a downward trend.

7. NDA vs Mahagathbandan?

BJP has managed to swallow its (IMO vainful) pride and has accommodated key allies in Bihar(JDU, LJP), UP(Apna Dal, Nishad Party), Maharashtra(Shiv Sena), Punjab(Akali Dal), Tamil Nadu(AIADMK) and north east (North East Democratic Alliance with AGP and others).

Given that 1) TDP is not contesting in Telangana 2) YSRCP may gain some seats in Andhra, and 3) BJD has stayed away from both BJP and Congress, there is further room for NDA to cobble up post election allies amongst Jagan Mohan, KCR, and Naveen patnaik. There is a definite appearance of NDA coming back to power, though for BJP to get a majority if its own seems almost a miracle at this point (But then, so was it the last time in 2014).

On the other hand, Congress has been hit by its inability to have seat sharing arrangements in UP, and Delhi/Punjab. Even in other states such as Maharashtra (NCP), Bihar(RJD, RLD), Karnataka(JDS) and West Bengal(CPI), its partners have driven hard bargains, thus Congress having to surrender 2-3 extra seats in every state. Thus in terms of political arrangement, BJP appears to be on a much stronger footing than Congress.

8. The social media effect

Social media is an echo chamber, and once a high decibel argument enters inside, it gets reverberated incessantly. BJP realized it early on, Congress and other parties have caught on well to it now. However, with the Cambridge Analytica and US election meddling by Russia already disclosed in 2016, most of the social media companies are going to be extra vigilant about avoiding another PR nightmare created by a non state actor again. Thus while the ability to influence will hopefully be limited, the basic echo chamber character of the social media sites is bound to produce hyper amplification of opinions. With the Jio launched price wars having brought 4g internet in power of many lay Indians, social media effect is here to stay, and election campaigns in future will continue to get shriller and more divisive.

9. Fake news

There is a popular meme: “On the internet, nobody knows you are a dog”. Similarly, on the internet, nobody knows if the news is authenticated or validated or not. Thus in an environment of social media supported echo chambers, fake news gets propagated unchecked. One just needs to view one such post, before the automated algorithms start showing similar news posts with higher frequency, since most social media sites are algorithmically designed to grab more eyeballs.

10. Right is the new centre

With its successful election wins from 2014 to 2017 in the national elections as well as in many state elections, the BJP was able to project an aura of invincibility. This led to the Congress adopting tones of Soft Hindutva (for the first time in its history of existence in independent India?). Temple runs by Congress president, Flip flop and agitations against Sabarimala verdict of Supreme Court, Usage of NSA against Cow smugglers, schemes for temples and cows in newly won states of Rajasthan and MP in 2018 state elections seem to be a new normal. This has pushed the other right wing party further right, where many unfortunate comments can be seen in news today. However, by this step, there is also the perception of space vacated from the centre. This could explain why Congress/Rahul Gandhi may have decided to also contest from Wayanad (Kerala) against a candidate from left - to give the projection that it is still a party of centrism.

Sunday, October 21, 2018

Book Review: Indira - India’s Most Powerful Prime Minister

There has been a lot of brouhaha in the press that current situations in India are comparable to the emergency years of 1970’s. A lot of debates, like those around right to privacy around Aadhaar, cross border surgical strikes, appointment of judges in apex court, and patriotism in an environment of mob lynchings end up in cries of increasing authoritarianism and rights of press being curbed. Intellectuals routinely associate above generalizations with the emergency era of India.
I’ve been curious for a while about the emergency and the polity of India before it, and so picking up a book about the person at the center of it all - Indira Gandhi - seemed the best option to learn more. For a contemporary reading, I picked up this book by Sagarika Ghose.
Important disclaimer: This book is a biography of Indira Gandhi, so naturally, it tries to paint a rosy picture of her achievements and choices, while shedding limited light on her shortcomings and failures. Also, the author has intermittently pushed in her own narrative sections that eulogize Mrs Gandhi - which make for a boring read because of their patronizing nature. Other than these two issues, the book makes for a good reading of the events in the mid 1960’s - mid 80’s
The book talks extensively about her multiple prime ministerial terms, and those of Morarji Desai, Nehru, and Shastri as well. It goes into details of emergency, and also sheds light on role of Sanjay Gandhi during emergency, and how he came to be. But as pointed by many, it is silent on many things like her nuclear agenda and establishment of RAW.
Overall, I think the book makes for an interesting read only if you are not aware of the topics before hand. The book would have made for a much better read if the author included more facts and happenings, and cut down on the eulogies that are injected throughout the book. But otherwise, the book provides very good outline to understand the events of the decades which overlapped with Indira Gandhi’s prime ministership. Overall Rating: 3/5

Sunday, May 13, 2018

Flipkart - Walmart deal: What Snapdeal lost, and lessons for entrepreneurs

The market is all buzzing with the Walmart Flipkart deal that happened last week. And why shouldn't it be, at $16bn USD, this is the biggest acquisition deal to have happened in India ever. The fact that the fortune #1 company is involved in it, investing in the e-commerce sector that it couldn't crack on its own, in an emerging economy like India, is only going to help the investor sentiment for Indian companies in general. But I am not writing this post to cover this deal - there is enough coverage out there already.

Note: Back of paper calculations follow, with lot of hindsight knowledge.

As I was reading through the news, I couldn't help wonder that Flipkart's valuation has almost doubled from $11.6bn in July 2017 to $22bn in less than an year. And how Snapdeal has missed the proverbial bus, spectacularly.

Here is a breakup of all funding raised by Snapdeal (all figures in USD):
$12M Nexus Venture, Indo-US (Kalaari) Venture Partners
$45M Bessemer and existing
$50M eBay and existing
$75M Softbank
$133M eBay, Kalaari Capital, Nexus Venture, Bessemer, Intel Capital and Saama Capital
$105M BlackRock, Temasek Holdings, Premji Invest and others
$647M Softbank
$500M Alibaba, Foxconn and SoftBank
$200M Ontario Teachers' Pension Plan
$17.5M (INR 113 crore) Nexus Venture
Total: $1.8 billion USD overall

Once valued at $6.5Bn, Snapdeal had been offered a USD $950M payout by Flipkart in June 2017. If Snapdeal had agreed, Flipkart could be having a better cumulative market share at around 45% compared to the 34% it has currently (at that time, Flipkart + Snapdeal stood at 37+14 % respectively). It would also have a wider reach amongst sellers, at least at around 300K vs the 100K it is believed to have currently. Snapdeal was a pure marketplace play, and it alone had 300K sellers. Finally, Snapdeal wouldn't have needed to sell FreeCharge, UniCommerce, and Vulcan Express to keep itself financially afloat. Without the sale at a steep discount of USD $60M from the purchase price of USD $400M, Freecharge would have been a readily available platform to complement UPI based PhonePe.

Given that Walmart's deal would have included private valuations of Myntra and Jabong as well within the final numbers, its anyone's guess how having Snapdeal in the clutch would have led the investors getting an even better valuation for the Flipkart group of companies. Even with a doubling up of valuation that already happened, Snapdeal's potential value would stand at ~ USD $1.8Bn today.

My optimistic guess is that the deal would have happened at a USD $25-26bn valuation if Snapdeal was also included, since having Snapdeal in kitty would have made Flipkart the market leader by a huge margin (compared to just the 5-7% lead it has right now over Amazon), with a stronger seller base, giving an ~2.3 multiplier.

In terms of the personal fortunes made, the founders of Snapdeal were reported to be making ~INR 250 Crore at the time of deal, having already made ~150 crore from previous stake sale. The Walmart deal would have meant that within an year of stay at Flipkart, they would be getting double the value they were initially receiving. Given Walmart is not keen on retaining non - core founders (Sachin Bansal to exit), it could have been an easy way out for Snapdeal founders as well. Employees of Snapdeal wouldn't have needed to be laid off, since Flipkart would have retained most of them.

Finally, the investors would stand to exactly recover the base investments they made in Snapdeal. Investors after all, like everyone else, want good return on their money. Snapdeal founders deciding at the last minute to kill the deal didn't really help anyone, probably except themselves. Its funny to see that a stake projected worth USD $450M is now being sold for INR 40 Crore, at almost 1/60th of the price when it could have been a very different story for the first investors who put their trust and money in you.

While Snapdeal isn't dead yet - it actually reported an increase in number of transactions - to me, there are 3 important lessons here for all entrepreneur's to remember:
  1. Never underestimate the deal making abilities of a Power Investor, in this case, Softbank (PowerInvestor:Investing::10XProgrammer:Coding)
  2. Good things happen to those who wait. Shortsightedness can (literally) prove costly in the startup world
  3. While coming on top at the first position is best, a position at the pedestal is still worth more than being an also-ran.
PS: I'm an ex Amazon techie, but wasn't high up in the food chain to know any of the sensitive market penetration details or strategies involved. All the content is my opinion alone, and builds from publicly available information.