As someone who is interesting in both programming and religion, I've often found it helpful to construct metaphors in code to illustrate religious concepts.

Below, I'd like to present a few of the ones I've come up with.

Big Fat Disclaimer: None of these metaphors is perfect, and some of them are far from it. But all of them illustrate a certain approach to talking about theological matters in a language that is comfortable to software engineers. So please consider them more like conversation starters than serious arguments.

Eternal security

The phrase "once saved, always saved" is a succinct summation of the doctrine of eternal security, also known as perseverance of the saints, which asserts that once a person becomes a Christian, they have the assurance of eternal salvation, and that assurance is permanent; there is no way to lose it.

This doctrine is held by some Christians  most notably those in the Reformed tradition and those influenced by Calvinism, including many evangelicals  and rejected by others, such as Catholics and the Orthodox, who believe that it is possible for Christians to reject salvation (e.g. through mortal sin or apostasy).

One programming metaphor we can use to represent this is a constant:

// Eternal security in Javascript if (hasBecomeChristian === true) { const isSaved = true; if (isSaved) { sendToGoodPlace(); } } else { sendToBadPlace(); }

Once that isSaved constant is set, its value cannot be changed. In fact, you could refactor this code to take out the isSaved constant, because hasBecomeChristian is always going to be synonymous with isSaved :

// Refactored eternal security if (hasBecomeChristian === true) { sendToGoodPlace(); } else { sendToBadPlace(); }

In contrast, in Catholicism, which rejects the doctrine of eternal security, the code looks more like this:

// Catholic view of salvation in Javascript let isSaved = false; while (isAlive === true) { if (hasBeenBaptised === true) { isSaved = true; } if (hasCommittedMortalSin === true && hasReconciled === false) { isSaved = false; } } if (isSaved) { sendToGoodPlace(); } else { sendToBadPlace(); }

In the above example, isSaved is not a constant but a variable whose value can change over time.

Catholicism basically holds that while we are given the gift of salvation at baptism, it is possible to reject that gift through mortal sin, which separates us from God. However, we also have the ability to become reconciled to God, typically through the sacrament of reconciliation, which restores our relationship with God and the gift of salvation.

Holy Communion

Many Christian denominations incorporate the reception of Holy Communion into their services.

There is some disagreement, though, about what Jesus meant at the Last Supper when he instituted the practice.

Some denominations, such as Catholicism and Orthodoxy, believe that when the bread and wine are consecrated, they cease to be bread and wine and become the body and blood of Jesus. Catholics call this "transubstantiation," and the Orthodox use other terminology to mean essentially the same thing.

# Transubstantiation in Python class Bread: def __init__(self): self.isDivine = False class Body: def __init__(self): self.isDivine = True substance = Bread(); assert substance.isDivine == False if consecrated: substance = Body(); assert isinstance(substance, Bread) == False assert isinstance(substance, Body) == True assert substance.isDivine == True

Some Protestant denominations, such as Lutheranism, hold that Jesus is really present in Holy Communion, but that it does not cease to be bread and wine. Instead, Jesus' body and blood are present "in, with, and under the forms" of bread and wine:

# Lutheranism's doctrine of the Real Presence in Python class Bread: pass class Body: pass class HolyCommunion(Body, Bread): pass hc = HolyCommunion(); assert isinstance(hc, Bread) == True assert isinstance(hc, Body) == True

Other denominations, including many Baptists, treat Holy Communion as mere symbols of Jesus' body and blood, a view called memorialism.

Trinity

The Christian concept of the Holy Trinity is a tricky one to represent by metaphor. The shamrock metaphor popularly attributed to St. Patrick? That commits the ancient heresy of partialism. The water metaphor in which the three common states of water (solid, liquid, gas) represent the three persons of the Trinity? That commits the ancient heresy of modalism. Pretty much every common analogy has its problematic aspects.

But there is one programming metaphor that I like, because although it doesn't capture the full mystery of the Trinity, it does not (as far as I can tell) commit any of the most famous heresies.

It's best viewed in diagram form, but here it is in code:

// Holy Trinity in Javascript const Father = []; const Son = "0"; const Spirit = "\t"; const God = 0; console.assert(Father == God); console.assert(Son == God); console.assert(Spirit == God); console.assert(Father != Son); console.assert(Son != Spirit); console.assert(Father != Spirit);

Impermanence

Several Eastern religions, such as Buddhism and Hinduism, have core doctrines that assert that all things are impermanent. In fact, according to these doctrines, not only is nothing eternal, but everything is changing all the time. Nothing ever stays the same.

The antithesis of this view was held by the Greek philosopher Parmenides, who asserted that nothing changes. Like, ever.

That might sounds absurd, because we clearly see things around us changing all the time. But what if things only appear to change because we are temporal beings who can only perceive one slice of temporal reality at a time? Just as the two-dimensional beings of "Flatland" see three-dimensional beings as shape-changers because they can only view them in cross-section, perhaps all of existence is one eternal, unchanging thing that we mere mortals perceive as changing because we can't take it all in at once.

Let's set up some code that illustrates how these views differ:

// Permanance vs. impermanence in PHP $population = array( array(2015, 321000000), array(2016, 323400000), array(2017, 325700000), array(2018, 327200000), array(2019, 329500000) ); // Impermanence for ($i = 1; $i < count($population); $i++) { echo $population[$i] != $population[$i-1] ? "CHANGED

" : "UNCHANGED

"; } // Permanence echo $population != $population ? "CHANGED

" : "UNCHANGED

";

If we're iterating through each slice of time, it's clear that one slice will not necessarily equal another slice. In fact, depending on the precision of the physical and temporal scales you're using, you might even be able to say that one slice will necessarily not equal another slice.

But if we're looking at existence more holistically, it's clear that the parent array does not change. It is never redefined or mutated. It just is.

Free Will

The above argument for permanence is a convenient lead-in to the topic of free will, a concept that is foundational to many religions.

Is determinism true? Are our actions the result of our own free choices, or are they merely the necessary and inevitable result of everything that has come beforehand? If an omniscient God already knows what choices we will make, then it would seem we lack the ability to choose otherwise, and that puts free will into question, too.

What's at stake here? Well, if free will does not exist, can we really be held responsible for the bad choices we make?

I know the question of free will is one that is confronted in numerous world religions, but because I'm most familiar with its treatment in Christianity, I'll focus there.

Many Christian denominations admit some form of divine predestination. There is both Biblical evidence for such a view, as well as evidence from reason, as a byproduct of God's omniscience. In the Bible, predestination is often symbolized by the Book of Life, into which God has inscribed the names of those who will enter heaven.

But there is, broadly, a significant divide between Christians who believe that divine predestination renders free will utterly impossible and those who believe that free will and God's foreknowledge of our choices can be compatible.

Out of Calvinist theology we get the doctrine that none of us has the ability to do anything good whatsoever except by God's grace, and also that God's grace is irresistible. Which means that if God withholds his grace, we lack the freedom to choose good, and if God supplies his grace, we lack the freedom to choose evil. Seems like a pretty robust denial of free will. (Calvin, for what it's worth, made a distinction between necessity and coersion. If God witholds his grace, we sin out of necessity, meaning we do not have the means to do otherwise. But that doesn't mean, Calvin argues, that God forces us to sin. It's still we who make the choice, but because of our depraved nature, we always make the wrong choice.)

The alternative to this view asserts that our choices are indeed free: We can choose to respond to God's grace, which enables us to do good, or we can reject that grace and do evil instead. Divine predestination, in this view, is merely God's foreknowledge of which of those choices we will freely make.

Granted, that doesn't completely resolve the paradox of whether any action can be said to be free if God already knows what we will choose. There are some very interesting arguments that attempt to resolve that paradox. For instance, one associated with St. Thomas Aquinas sidesteps the issue by acknowledging that we cannot choose any action other than the action God knows we will choose  but God, being omniscient, knows which option we would choose if we could choose it with absolute freedom, and through his omnipotence has the ability to motivate us to choose that option.

That's a little too complex an argument for me to express in a programming metaphor, though, so instead I'm going to try to illustrate just the Calvinist view and the opposing view, in broad strokes.

// Free will in Go func getChoice(options []string, preferences []string) string { if len(options) == 1 { return options[0] } else { // Choose from either option based on one's own preferences return makeChoice(options, preferences) } } func evaluateCalvinist(hasGrace bool)string { if hasGrace { return "do good" } else { return "do bad" } } func evaluateCompatibilist(hasGrace bool)string { var options []string options = make([]string, 2) options[0] = "do bad" if hasGrace { options[1] = "do good" } var preferences []string preferences = make([]string, 2) preferences[0] = "increase pleasure" preferences[1] = "increase holiness" var choice = getChoice(options, preferences) return choice } func main() { var hasGrace bool = false var choice = evaluateCalvinist(hasGrace) fmt.Println(choice) // always returns "do bad" hasGrace = true choice = evaluateCalvinist(hasGrace) fmt.Println(choice) // always returns "do good" hasGrace = false choice = evaluateCompatibilist(hasGrace) fmt.Println(choice) // always returns "do bad" hasGrace = true choice = evaluateCompatibilist(hasGrace) fmt.Println(choice) // returns "do bad" or "do good" based on the person's own preferences }

Moroni's Promise

The Book of Mormon, which members of the Church of Jesus Christ of Latter-Day Saints consider to be a sacred text, is said to be founder Joseph Smith's English translation of ancient writings that had been engraved on gold plates in the fifth century, buried in present-day New York, and revealed to Smith by an angel in the early 19th century.

Like the Bible, the Book of Mormon consists of several sub-books, the last of which is purportedly written by the prophet Moroni. In a passage known as Moroni's Promise, the prophet says that if anyone reads the text and prays to God to reveal whether it is true, God will make the truth known to them.

One thing that's always interested me is whether perceiving a "yes, it's true" answer to that prayer is sufficient to trust the veracity of the Book of Mormon.

Is it as simple as:

// Moroni's Promise in Rust let answer = pray_for_answer(); if answer == true { println!("The Book of Mormon is true!"); } else { println!("The Book of Mormon is not true!"); }

I don't think it's that simple. What really matters is not whether any one sincere person hears a "yes" but whether every sincere person hears a "yes":

// Improved Moroni's Promise in Rust let mut all_true = true; let all_answers = get_all_answers(); for answer in all_answers.iter() { if *answer == false { all_true = false; } } if all_true == true { println!("The Book of Mormon is true!"); } else { println!("The Book of Mormon is not true!"); }

Why should a single "no" invalidate Moroni's Promise? Because it means that God has given two mutually exclusive answers to two different people. Assuming God can't lie, we have to conclude that our personal interpretation of an answer to this prayer, however sincere it might be, is not an effective way to discern the truth of the Book of Mormon.

LDS adherents might answer that anyone who receives a "no" must not have fulfilled the conditions of the promise  perhaps they didn't study the text with enough focus, or they didn't pray with enough sincerity, or they didn't wait long enough to receive a "yes" answer, or they misinterpreted an answer they perceived to be "no." That strikes me as a "No True Scotsman" approach to counterexamples, but since I'm not LDS, I guess I'm not a true Scotsman either.

Divine Attributes

There are several attributes traditionally associated with God in classical, Western theism. Among them are omniscience, omnipotence, and omnipresence.

Sometimes these divine attributes are pitted against each other, or even against themselves, as is the case with this well-known puzzler:

Can an omnipotent God create an immovable object?

Other versions of this paradox make the challenge more explicit: "Can God create an object too big for him to move?"

The standard answer to this paradox is that the omnipotence traditionally ascribed to God means that he can do anything that is logically possible. That means he can create an object with a square shape and an object with a circle shape, but not an object whose shape is simultaneously square and circular, because that's a logical impossibility.

I actually prefer a different answer to the paradox, one that offers a smart-alecky answer to a smart-alecky question.

Yes, an omnipotent God can create an immovable physical object. And that object can be the size of a tennis ball.

The only constraint is that no other physical objects can exist simultaneously. The universe  by that I mean the entirety of physical existence  must consist of that tennis ball and nothing else.

I'd argue that object would be immovable, because when we move things, we always move them relative to something else. If there is no "something else," then the object will be immovable.

-- Immovable object detection in SQL SELECT id, EXISTS(SELECT * FROM existent_objects WHERE id != eo.id) AS moveable FROM `existent_objects` eo; -- For a database with one row, this will yield: -- | id | moveable | -- | 1 | 0 | -- For a database with more than one row, this will yield: -- | id | moveable | -- | 1 | 1 | -- | 2 | 1 |