---
title: "Righteousness Explained for Programmers"
date: "2026-05-21"
featured_image: "/assets/img/posts/righteousness-explained-for-programmers.png"
featured_image_alt: "UML-style diagram showing a Human type being transformed into ChildOfGod through inheritance, with sin changing from identity to action"
category: "undervisning"
---

If you understand object-oriented programming, you should understand this.

### The problem: a failed type check

Every `Human` object is created with a `sin` property. It's not a bug — it's inherited. All the way from the original instance. Some people struggle with this, especially when they look at children. But even a toddler doesn't need to be taught selfishness — they come with it. No one teaches a two-year-old to say "mine!" It's already in the source code.

```
┌────────────────────────────────────┐
│             Human                  │
├────────────────────────────────────┤
│  String name                       │
│  Bool hasSin = true                │
│  Bool isHoly = false               │
│  Bool hasEternalLife = false       │
│  Void doPrayer(words)              │
│  V̶o̶i̶d̶ ̶d̶o̶M̶i̶r̶a̶c̶l̶e̶(̶a̶c̶t̶i̶o̶n̶,̶ ̶t̶a̶r̶g̶e̶t̶)̶   │
└────────────────────────────────────┘
```

Notice that `doMiracle` is struck through — a plain `Human` cannot perform miracles. But `doPrayer` is available to everyone. Any human can pray.

Now, Heaven has a strict type check at the gate:

```
function enterHeaven(Righteous $entity) { ... }
```

A raw `Human` object will fail this check every time. `hasSin = true` and `isHoly = false` — it doesn't satisfy the `Righteous` interface. No amount of patching, self-improvement, or calling your own methods can change that. You can't refactor your way out of original sin.

### The solution: a new creation

This is where the gospel becomes code.

God doesn't wrap you in a decorator. He doesn't put a holy cover over an unchanged sinner. He does something far more radical — He **creates a new object entirely**.

The `God` class uses the Singleton pattern — there is exactly one instance, fully implemented, with no abstract methods you can override. And He has a factory method:

```
┌────────────────────────────────────┐
│            God (Singleton)         │
├────────────────────────────────────┤
│  static God $instance              │
│  static bornAgain(Human h)         │
│  Void doMiracle(action, target)    │
│  Bool isHoly = true                │
│  Bool hasEternalLife = true        │
└────────────────────────────────────┘
```

When you call on God, He calls `bornAgain()`. The old `Human` object doesn't get patched or wrapped — it **dies**. And a completely new object is created:

```
// The old you:
$old = new Human("you");        // hasSin = true, isHoly = false

// You cannot do this yourself:
$new = new ChildOfGod("you");   // ❌ private constructor

// Only God can:
$new = God::bornAgain($old);    // ✓ the old dies, a new creation is born
// $old is now dead (Galatians 2:20)
```

### The new type: ChildOfGod

Here's what `bornAgain()` returns — not a wrapped `Human`, but a genuine `ChildOfGod` that **inherits from God**:

```
┌────────────────────────────────────┐
│            God (Singleton)         │
├────────────────────────────────────┤
│  Bool isHoly = true                │
│  Bool hasEternalLife = true        │
│  Void doMiracle(action, target)    │
└────────────────────────────────────┘
                 ▲
                 │ inherits
                 │
┌────────────────────────────────────┐
│           ChildOfGod               │
│        implements Righteous        │
├────────────────────────────────────┤
│  Bool isHoly = true     // inherited│
│  Bool hasEternalLife = true        │
│  Void doMiracle(action, target)    │
│  Void doPrayer(words)              │
│  Void doAction(choice)  // free will│
└────────────────────────────────────┘
```

Look at what changed. This is not a wrapper around the old you. The old `Human` is gone — *"the old has passed away; behold, the new has come"* (2 Corinthians 5:17). The `ChildOfGod` object **inherits directly from God**. It shares His nature. `isHoly = true` is not a covering — it's your actual property now. You *are* holy. You *are* righteous.

This does not make you God. God is the Singleton — there is only one instance. But you are His child, and children share their parent's type. Jesus is no longer the only begotten Son — He is now the firstborn among many brothers and sisters (Romans 8:29). The family grew.

Jesus said it directly:

> *"Is it not written in your law, 'I said, you are gods'? If he called them gods to whom the word of God came — and Scripture cannot be broken — do you say of him whom the Father consecrated and sent into the world, 'You are blaspheming,' because I said, 'I am the Son of God'?"* — John 10:34-36

### But what about sin?

Here's the key insight — and where many people get confused.

In the old `Human` class, sin was a **property**. It defined what you *were*: `hasSin = true`. It was your identity. You couldn't remove it any more than you can remove a field from a compiled class.

In the new `ChildOfGod` class, sin is no longer a property. It's an **action**. You have a method called `doAction(choice)` — and that method accepts both `"holy"` and `"sin"` as arguments. You have free will.

```
$you = God::bornAgain($old);

$you->doAction("holy");    // natural — aligned with your new nature
$you->doAction("sin");     // possible — free will remains
$you->doAction("holy");    // your nature hasn't changed
```

A `ChildOfGod` *can* still sin. But sinning doesn't change your type back to `Human`. Your identity is settled. When you call `doAction("sin")`, it doesn't flip `isHoly` back to `false`. You are still a child of God — one who made a bad call, not one who lost their inheritance.

The difference is this:

```
// Old Human:
class Human {
    Bool hasSin = true;        // identity — you ARE a sinner
}

// New ChildOfGod:
class ChildOfGod extends God {
    Bool isHoly = true;        // identity — you ARE holy
    Void doAction(choice) {}   // behaviour — you CAN choose
}
```

Sin moved from **what you are** to **what you can do**. That's the whole gospel in one refactor.

### The type check — revisited

And now, the type check at Heaven's gate:

```
enterHeaven($childOfGod);   // ✓ passes — IS Righteous
enterHeaven($human);         // ✗ TypeError
```

The `ChildOfGod` doesn't pass because of a wrapper. It doesn't pass because of a hack or a workaround. It passes because it genuinely *is* a `Righteous` type — through inheritance from God. That's polymorphism: a `ChildOfGod` can be accepted anywhere a `Righteous` object is expected, because it truly satisfies the interface.

Not covered. Not faking it. *Transformed*.

&nbsp;

---

&nbsp;

This came to me while driving home from work as a programmer one day. I suddenly saw how much the patterns we use in software — inheritance, type checking, the difference between properties and methods — mirror the language the Bible uses about our identity in Christ.

We weren't wrapped in something holy while remaining sinners inside. The old object died. A new one was created — one that inherits directly from God. Holy by nature. Righteous by type. With free will intact.

And when the type check comes, we pass. Not because of what covers us, but because of what we've become.

I realise that many won't fully understand this. But if you know a programmer — pass it on. It might be the explanation that finally clicks.

&nbsp;

---

&nbsp;

### Ready to call the factory method?

If this made sense to you — not just technically, but personally — then you already understand what's being offered. The question is whether you want to make the call.

There's no magic syntax. No required format. You just talk to God honestly. Something like this:

> *God, I understand that my old self can't pass the type check. I can't fix it myself. I'm asking You to call `bornAgain` on me. I believe Jesus died and rose again so that I could become a new creation — Your child, not just a patched-up human. I receive that now. Thank you for the new identity. Amen.*

Or simply:

> *God, I know I can't make myself right with You. I believe Jesus died for me and rose again. I ask You to forgive me, make me new, and receive me as Your child. I give my life to You. Thank you for loving me. Amen.*

That's it. If you meant it, you're a new creation now. Welcome to the family.

&nbsp;

---

&nbsp;

### Scripture references

**The old self dies — a new creation is born:**

- *"If anyone is in Christ, the new creation has come: the old has gone, the new is here!"* — 2 Corinthians 5:17
- *"I have been crucified with Christ and I no longer live, but Christ lives in me."* — Galatians 2:20
- *"We know that our old self was crucified with him so that the body ruled by sin might be done away with."* — Romans 6:6
- *"You have taken off your old self with its practices and have put on the new self, which is being renewed in knowledge in the image of its Creator."* — Colossians 3:9-10
- *"Put off your old self... and put on the new self, created to be like God in true righteousness and holiness."* — Ephesians 4:22-24

**We are children of God — sharing His divine nature:**

- *"To all who did receive him, to those who believed in his name, he gave the right to become children of God."* — John 1:12
- *"For those who are led by the Spirit of God are the children of God... The Spirit himself testifies with our spirit that we are God's children. Now if we are children, then we are heirs — heirs of God and co-heirs with Christ."* — Romans 8:14-17
- *"He has given us his very great and precious promises, so that through them you may participate in the divine nature."* — 2 Peter 1:4
- *"See what great love the Father has lavished on us, that we should be called children of God! And that is what we are!"* — 1 John 3:1
- *"Because you are his sons, God sent the Spirit of his Son into our hearts, the Spirit who calls out, 'Abba, Father.' So you are no longer a slave, but God's child; and since you are his child, God has made you also an heir."* — Galatians 4:6-7
- *"Is it not written in your law, 'I said, you are gods'?"* — John 10:34

**Jesus — the firstborn among many:**

- *"For those God foreknew he also predestined to be conformed to the image of his Son, that he might be the firstborn among many brothers and sisters."* — Romans 8:29
- *"Both the one who makes people holy and those who are made holy are of the same family. So Jesus is not ashamed to call them brothers and sisters."* — Hebrews 2:11

**We ARE holy and righteous — by identity, not by covering:**

- *"But you were washed, you were sanctified, you were justified in the name of the Lord Jesus Christ."* — 1 Corinthians 6:11
- *"God made him who had no sin to be sin for us, so that in him we might become the righteousness of God."* — 2 Corinthians 5:21
- *"He has reconciled you by Christ's physical body through death to present you holy in his sight, without blemish and free from accusation."* — Colossians 1:22
- *"You are a chosen people, a royal priesthood, a holy nation, God's special possession."* — 1 Peter 2:9
- *"For he chose us in him before the creation of the world to be holy and blameless in his sight."* — Ephesians 1:4
- *"Through the obedience of the one man the many will be made righteous."* — Romans 5:19

**Sin is an action, not your identity — free will remains:**

- *"No one who is born of God will continue to sin, because God's seed remains in them; they cannot go on sinning, because they have been born of God."* — 1 John 3:9
- *"My dear children, I write this to you so that you will not sin. But if anybody does sin, we have an advocate with the Father — Jesus Christ, the Righteous One."* — 1 John 2:1
- *"For sin shall no longer be your master, because you are not under the law, but under grace."* — Romans 6:14
- *"Walk by the Spirit, and you will not gratify the desires of the flesh. For the flesh desires what is contrary to the Spirit, and the Spirit what is contrary to the flesh."* — Galatians 5:16-17
