Buddha.js — understanding Buddhism through JavaScript

Dulitha Wijewantha
2 min readFeb 19, 2016

--

Here is a crazy idea, can we understand a 2000-year-old philosophy through JavaScript code execution? A recent discussion we had on whether code can represent literature got me wondering whether we can represent philosophy and complicated arguments through code. After all, code is concise, code executes and code never lies.

So how are we going to do this? Buddhism consists of several teachings.

  • 3 Universal Truths
  • 4 Noble Truths
  • Noble eightfold path

I consider everything else in Buddhism to be a construct on social structure. The Buddha, after all was a brilliant man. Since he wanted his main teachings to stay relevant for years and years to come, he instructed practical guidelines on how to conduct life. This, in turn, is how after 2000 years, a mad chap is interested in writing the teachings in JavaScript.

Class Hierarchy

What good is writing JavaScript if we don’t use the new ECMA6 class structures to represent the world.

Variable names

Since I am trying to express a story as well as a philosophy, I decided to use variable names to literary advantage.

var siddhartha = new Human(“Siddhartha”);
var truth = new EverythingChange("Everything changes");
siddhartha.learn(truth);
var status = siddhartha.enlighten();
if (status){
var buddha = siddhartha;
}

After Siddhartha learns the truths, he enlightens. Only after enlighten is he considered a buddha. So by this construct, Buddha is a Human.

Code execution

Another useful tool when communicating an idea via code is actual execution. To express the whole Energy and Matter debate, I used 2 variables holding a finite amount of mass and energy. By using JavaScript setInterval, I was able to create the illusion that mass converts to energy, and energy in turn, converts to mass.

I am at the moment going through the Universal truths. If anyone is interested in contributing, please visit buddha.js GitHub page, fork and send a PR.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Dulitha Wijewantha
Dulitha Wijewantha

Written by Dulitha Wijewantha

I am a Tech Entrepreneur storytelling 📣 my experiences about 🚀 Business, ❣️Relationships, ✨ Life and 🕊 Philosophy.

No responses yet

Write a response