Wednesday, March 1, 2017

On Kaliyug and the Simulation Principle

There's a growing belief among some physicists, that reality as we know it, is a computer simulation. This is called the Simulation Hypothesis or the Holographic Principle.

If we are indeed running inside a simulation, then the ancient concept of the four Yuga cycle (A Yuga is an epoch that has four age cycles, namely Satya yuga, Treta yuga, Dvapara yuga and Kali yuga) can be a plausible outcome based on my experience developing software for the last decade and half.

Satya yuga (Golden age)

In the beginning, teams were small - often just the founders and a couple of founding engineers. Everyone was competent and worked remarkably well together. Good ideas were ample. The product was the MVP, features were small, C was prevalent, tests were abundant and interfaces were simple. The system was easy to reason about. The mean time to failure was very large and things ran quite smoothly.

Treta Yuga

As the product gained traction, requirements and complexity increased, as did team size. Leaders emerged in the company, some of which became power hungry with dreams of world domination. They put unreasonable pressure on their teams in order to comply with their dreams. Under pressure, virtue and common sense began to fray and skirmishes increased. C++ and STL modules became commonplace. Automation increased and freed up people to implement more and complex features. As coverage decreased, bugs began to creep up and the system failed with more frequency. Core dumps by themselves weren't useful anymore and copious amounts of instrumentation and tracing was added which caused performance to suffer and changed timing characteristics of the system. The first Customer Support Department was established.

Dvapara Yuga

Narcissistic leaders gained power and employed incompetent yes-men. Team dynamics became toxic as fights over recognition got increasingly unethical. Positioning, visibility, revenue were guidelines for promotions while doing the right thing was punished because it usually made timelines longer. APIs got hairy and impossible to reason about. Testsuites needed testsuites of their own. Java, Ruby and Python were now used and scalability and high performance became an engineer's wet dream. Exception handling became the rule and state machines became probabilistic and asynchronous. Race conditions were 'fixed' by adding sleeps. Deadlocks were 'fixed' by introducing 'finer grained' locks. System stability was now a thing of the past and there usually was a top level exception handler that said "Unknown error! Please contact customer support". Customer Support Department size was now nearly 30% of the company size.

Kaliyug (Age of Vice,  Today)

In the present time, megalomaniac leaders, sexual harassment, discrimination, intellectual property theft are rampant. Ignorant, pompous and selfish engineers have taken over the workplace. Stackoverflow cut-pastes without reading documentation is the modus-operandi. API references, classic books and beautiful source code has become a thing of mythology. Javascript takes over the world. Plugins, IDEs, frameworks to write a hello-world program download gigabytes of data from servers around the world. Debugging memory leaks, race conditions, deadlocks, performance bottlenecks, writing unit tests and refactoring are all handled automatically by the IDE now. 

Algorithmic complexity is alchemy and no one has heard of quicksort in living memory. Filesystems and databases now store only JSON data and all interfaces are HTML and CSS, including the one in your cloud-connected, always-on, smart-toilet with retina display, built-in subwoofers, a 64 megapixel selfie camera with AI based blemish-removal and automatic posting to social media. Of course, this can be a pain in the, well, behind, because if the wifi is slow or down, the toilet can't download the cloud-configuration detailing your personal temperature, pressure, angle and other comfort settings. This means that it'll fall back to defaults - 350 degrees Fahrenheit water at 2400 PSI. At other times, if the volume of the speakers is too high, the subwoofers will create a tsunami-like effect that'll necessitate a complete bathroom remodel. Another one of the 'killer' features of this 'cutting-edge' toilet is that it'll analyze the 'output' for anomalies and use AI to automatically deliver a treatment. The toilet can perform a large number of treatments including automatic enemas and hemorrhoid cauterization. Cutting edge, indeed. Of course, the company is trying to suppress reports of exploding toilets and miscellaneous mutilation as 'fake news'.

Aftermath

The company, which is now worth trillions has over a million employees, of which 38% are in the customer appeasement department, 35% are in the litigation department, 10% work the suicide hotline and remaining 17% are on extended sick leave. The company's board of dictators are arrested for 'unprovoked surgery and disembowelment' and confined to a Facility for the Incurably Deranged. The suicide hotline gets shut down causing 94% of the population to kill themselves.  Customers who have been (literally) backstabbed by the company's flagship product storm the premises and the resulting battle quickly escalates to a global apocalyptic event. Due to a bug in the 'phone home' feature, all toilets around the world upload terabytes of core 'dumps' at the same time causing the internet to implode. All that remains are the mouldering remains of servers and a few toilets playing 'Let it go, let it go, Can't hold it back anymore'.

Rinse and Repeat

From the wreckage emerge a few people with total amnesia. They get together and decide to rebuild the world based on truth, perfection and virtue. This is the beginning of a new Satya yuga and the next version of the simulation starts all over again.