Dharma For Developers: Consciousness in Buddhism

This is part of a series describing the Dharma in terms familiar to developers. To do this we will use Java code and UML design as a way of describing then analysing the Buddha’s teachings.


Today we will discuss the Buddhist concept of “consciousness” or using our shortened term “c12” because there is a “c” followed by 12 letters. Consciousness refers to the consciousness that travels from life to life as a part of the death and rebirth (reincarnation) process.

By describing consciousness we will be able to demonstrate that there was no creator god and there is no such thing as death, all in a few lines of Java!!


The concept of consciousness is this: one moment of consciousness gives rise to the next moment of consciousness. In other words, one moment of consciousness is the result of a previous moment of consciousness and it is also the cause the another moment of consciousness.

In this way the Buddhist concept of consciousness is very similar to a “linked list” in computer science. The key code would look like this in Java:

package net.happyops.dharma4devs;

public class C12 {
  private C12 previous;
  private C12 next;
  private int moment;

  private C12(C12 previous, int moment) {
    this.previous = previous;
    this.moment = moment;

  public C12 createNext(int moment) {
    this.next = new C12(this, moment);
    return this.next;

  public C12 getNext() {
    return next;

  public boolean isPresent() {
    return (next == null);



The linked list is illustrated above in UML. The calling client code would look like this:

present = present.createNext(moment);

The code discussed so far gives us two insights into the nature of consciousness in Buddhism:

1. There was no first moment of consciousness. This means that there was no beginning and no creator god. The previous moments of consciousness stretch back and back from today to yesterday, from 2018 to 2017, from this life to the previous life, and so on with no beginning. In other words this means that both death and rebirth are real as part of a stream of consciousness. If you set a moment of consciousness and say “that was the beginning” then any child will ask: “what came before that?” or “what was the consciousness doing before that?”

2. There will be no last moment of consciousness. One moment of consciousness innevitably leads to the next moment of consciousness. Therefore, there is no such thing as death because consciousness keeps on going from the present life to the next life as one moment of consciousness gives rise to the next moment of consciousness.

Love, @happyops