Finding the Trinity in Programming

Adapted from

What is the Trinity?

When you think about it, the Trinity is rather difficult to explain. And while we might never be able to fully describe an eternal, all-powerful being, creating some kind of analogy is beneficial. We often come up with models to help explain complex ideas and so a good model can be crucial to understanding the complex idea. Jesus taught in parables to help us understand spiritual matters, so let’s try to develop a good model to understand the nature of God as best we can. 

Certainly there have been many metaphors for the trinity before, for example comparing the trinity to the substance of water. Water can exist in 3 states just as God exists as 3 distinct persons. However, this model is rather simple and doesn’t address the nuances of God’s nature we see from scripture. Let’s consider programming concepts as a way to develop a more accurate model.

God is a Developer

I think we can agree that the Creator God is an expert builder and masterful artist. As such, I think it’s fair to characterize Him as a senior programmer. One might even say He is the software architect. As such, I think humanity’s relatively recent discovery and implementation of Computer Science concepts through software engineering is no accident. God is inviting us to a wonderful deeper insight into how He thinks and how he built the universe.

He certainly built our existence with code and used several languages. A basic layer of logic that guides our universe could be said to be the atomic or subatomic layers, perhaps akin to Assembly. All the laws of mathematics and physics obey certain laws, which are written somehow into the fabric of our existence. And then things get really interesting with living things: we have DNA, a high level language in comparison.

Programming Crash Course

If you’re not a developer, let me explain a few things. When programming, at some point all the code and logic we write must get compiled to 1s and 0s so the computer can understand and execute the instructions. Assembly is the most basic language, which just has words representing combinations of 1s and 0s. Every other language, even one which lets you do many things with a simple line, must ultimately get “compiled” and converted to this Assembly language so the computer can run it.

In essence, the high level language must still follow the laws of the lower level language. Similarly, our cells, while they have their own behavior dictated by DNA, must still adhere and follow the laws of physics to exist in this reality.

Why this Matters

So what am I saying? I am saying that by studying programming, we can gain new insights into our existence and God’s character, just as one might achieve by studying other arts and sciences such as writing and mathematics. Whether you are a writer or a software engineer, it is worthwhile to study writing or computer science to better understand yourself, your world, and your creator.

The Code

So with that, let’s look at the Trinity as explained using Object Oriented programming principles expressed in the Swift language. Object oriented programming is the idea that we can describe and define the idea of a thing, separate from the actual thing itself. A class is like a blueprint, a way to describe the behavior and description of a thing without being the thing itself. An object, sometimes called an “instance,” is the actual thing the blueprint describes. It’s created when a specific instance of the class is put into the program.

For those who study philosophy, it’s actually quite similar to Plato’s theory of forms. Objects and matter in the world, are just like “objects” in code. The idea or “form” or true essence behind the specific instance are like “classes” in code.

What is so fascinating, is when a programmer writes a Class they are now participating in the creation of the essence of a thing in a way Plato could only have dreamed of. This is incredible, and unprecedented in the history of humanity’s creative endeavors. I would argue this “creation of forms” in software is a more complete analogy to the creative work God has done than even that of mathematics, physics, writing, sculpting, or filmmaking. While there is math and physics in programming, its the completed piece of software that offers an entirely unique experience of interactivity. The logic and creation of software is getting close to the logic that creates our very existence.

Trinity in Code

To describe the trinity using code, we must discuss two more programming concepts, subclassing and class extensions. As shown in the figure below, an example of a class might be an “Animal,” which  describes a certain kind of living organism. A subclass might be a “Mammal.” It inherits all attributes of the animal, but also has some specific or unique characteristics. Some classes are never expressed as an instance; they are a concept only. For example, there is no such thing as a “mammal” in the world. Instead, a subclass of a Mammal, a “Dog” might have an instance that  you call fido. Furthermore, a “final” class cannot be subclassed again, keeping that class separate.

Let’s review and apply to the concept of the trinity:

  1. Classes are not instances, they describe the essence of the thing, as such they are eternal
  2. God, the base class, is never used directly, but expressed through one of its 3 equal and distinct subclasses
  3. Those classes are never subclassed again, and therefore marked final, keeping God’s holiness.
  4. In programming, classes always start with a capital letter, instances with a lower-cased letter.



Let’s walk through it

God is the super class, but all 3 forms of the Trinity inherit from it. This shows they are equal, yet they express unique,  distinct characteristics of God. This also shows God can be all 3 forms of himself at all times: just because a subclass such as Father or Spirit exists God never ceases being God. Likewise, the Son is not lacking any of God’s attributes as the Son inherits all the same attributes the Father and Spirit inherit.

Furthermore these are classes, not objects, which is appropriate as they are eternal.

Names of God

I use enums to help describe the many names of the Son. Each one shows his different attributes  and is merely a title to explain his character more simply just as an enum helps make code more readable.

It’s important to note these describe the Class Son and not the instance godSaves. These names describe his eternal nature. The instance godSaves was never a father, for example, but the Class Son is because he inherits all attributes of the Class God (which are also passed to the class Father).

I imagine a lot of confusion and apparent contradictions in the Bible can be better understood when we realize God was not talking about instances of certain things but rather the eternal Class the instance is formed after. For example, how can Jesus say with confidence “The Sabbath was made for man, not man for the Sabbath.” – Mark 2:27 ESV and know he is not at odds with the Ten Commandments and Exodus 20:8-11 ? It is because he understands the Sabbath is an eternal rhythm of rest and gratitude toward God and the day or nature of one’s work is just one of many particular instances of that eternal class. In fact looking at how Jesus deconstructs the ten commandments in the beatitudes in Matthew 5 we see him unravel the superficial “instances” of the actions and get to the heart of the issues expressed as eternal “classes.”

Yeshua: the God-Man

The first object or instance of the eternal class God is expressed as the subclass Son and named godSaves. This name is appropriate since  it is the meaning of his name and best describes this object. The name “Jesus” on the other hand, is simply the localized English version of his name.

When we refer to him primarily through localized names like Jesus, it can be unhelpful to those new to the faith and lead some to believe this Jewish man was a European man when he was not. First and foremost, he relates to and saves all kinds of humans, not just one particular race. We would do well to remember this when talking to others about God Saves and not perpetuate silly myths about the power of the English name “Jesus,” missing the true power found within the meaning of that name. The power is in trusting that God alone saves, not saying the name “Jesus” at the end of a prayer as if it were magic.

Wrap up

In summary, we can see the man born 2000 years ago does not lose any of his eternal divinity but is rather an instance of that divinity with humanity added. In a handful of lines, software code eloquently describes our creator in a way that volumes of books struggle to do the same.

So what have we learned? God is a developer, and since he is a God of order he uses a kind of logic and programming when he made the universe. Studying computer science therefore can be helpful in understanding our God and our own existence. Furthermore, many programming paradigms can be very helpful to interpret certain aspects of scripture.

What do you think?

If you are a believer, I hope you can see that programming serves as a powerful tool to better understand our creator and explain theological concepts. I think pastors, teachers, and especially those who consider themselves theologians should make a point to study computer science. Have I convinced you?


For the developers reading this, another way to express the trinity could be to use class extensions rather than subclassing. Particularly if you built out the model further where God was the base class for all things (not a final class) and all classes inherited from him. This would help explain passages in the Bible, which say we have God living inside us (e.g. Psalm 82:6 and John 10:34) and perhaps provide further insight to Colossians 1:16. This approach would be similar to NSObject in Apple programming frameworks. Which do you think is the better analogy?



1 thought on “Finding the Trinity in Programming

  1. Taylor B

    Amazing! As a developer myself, this is incredibly insightful, interesting, and encouraging

Join the Conversation