Skip to main content

Object-Oriented Trinity - Part 1

If you have read any of my limited Bio information, you may have noticed that I am a Software Engineer. It was my first career, from which I took a hiatus for about a decade to do other things. One of those other things was becoming an ordained Anglican priest.

I was recently reminded of a somewhat whimsical paper I wrote in seminary, while working on my MDiv and preparing for the priesthood.

Our assignment was to write a letter to a fictional friend, explaining the Trinity in some creative imagery. The doctrine of the Holy Trinity is and to some extent has always been one of the more gnarley in Christianity.

Drawing on my first career of software development, my paper sought to use Object-Oriented concepts to shed light on this great mystery of faith. In a series of posts (Three would be the right number, no?), I will somewhat adapt that paper to this different forum, and to my ever-growing and evolving understanding of both the Trinity and Object-Oriented programming and design. Hopefully you will find this exercise somewhere between amusing and thought-provoking.


Dear Christian, thanks for your letter. It's always great to hear from you. It sounds like your CompSci career is really taking off, congrats on your new job! It sounds like they really value your design and coding skills.

You asked some interesting questions about the Trinity. Of course, you are wrestling with a topic that your namesake Christians have wrestled with for centuries. Here's an idea: let me make use of your OO skills and knowledge, to see if they can shed any light on the topic.

The first point to hold onto about the Trinity is that it says that God is One. Three parts but one whole. That unity, that One-ness is key; don't lose that piece.

In the Trinity, Christians are not claiming to worship three gods; we insist that there is one God, and only one. There are no others, nor can there be. There is only one such divine Being, and this one Being has created the entire universe and everything in it.

This one God, Christianity proclaims, is a particular, identifiable Being. It is not an abstract notion of divinity, but a specific entity that we can know, and know about, because if has self-revealed some things.

This immediately brings up questions about what has been revealed, how it was revealed, how we can know it, etc. But let's set them aside, they are topics for another day that will take us away from our Trinity topic.

Now, let's turn to Object-Oriented programming and design. For starters, think of the Singleton design pattern. What are some of the characteristics of a Singleton?

A Singleton is a Class with exactly one Instance.

A Singleton is global in scope, spanning the whole of the application's ecosystem.

From the perspective of our application's sub-system, this Singleton object is never created or destroyed, but always exists as this single thing. It is certainly not created by our sub-system, because programmatically the Singleton has a private constructor. The individual components of our system do not create the Singleton, but they access it through a well-defined access method.

So in our Object-Oriented software world, God is like a Singleton. God has just one single instance. There is only one God.

This one God is also global in scope. Universal even. Spanning all of time and space.

Just as a Singleton is not created by our sub-system, so God is not created by us, but has provided a well-defined interface to God. Again, this is the orthodox Christian position - individual results may vary!

Analogies are never perfect, especially for a mystery like the Trinity, and this one is no exception. For example, in OO, the Class defines the Object, meaning it gives shape to what information and actions a given object instance is bounded by. Whereas in God’s case, the Object in many ways defines the Class. Christian theology would say that there is no God-state which is not entirely defined by the God who is One.

Next time I write, we can dig into the Trinity's Three. If the Trinity says God is One, how can Object-Oriented software design analogies shed light on the flip side that says that God is Three?

Blessings until next time,
Steve

Popular posts from this blog

How to do Git Rebase in Eclipse

This is an abbreviated version of a fuller post about Git Rebase in Eclipse. See the longer one here : One side-effect of merging Git branches is that it leaves a Merge commit. This can create a history view something like: The clutter of parallel lines shows the life spans of those local branches, and extra commits (nine in the above screen-shot, marked by the green arrows icon). Check out this extreme-case history:  http://agentdero.cachefly.net/unethicalblogger.com/images/branch_madness.jpeg Merge Commits show all the gory details of how the code base evolved. For some teams, that’s what they want or need, all the time. Others may find it unnecessarily long and cluttered. They prefer the history to tell the bigger story, and not dwell on tiny details like every trivial Merge-commit. Git Rebase offers us 2 benefits over Git Merge: First, Rebase allows us to clean up a set of local commits before pushing them to the shared, central repository. For this

Java 8: Rewrite For-loops using Stream API

Java 8 Tip: Anytime you write a Java For-loop, ask yourself if you can rewrite it with the Streams API. Now that I have moved to Java 8 in my work and home development, whenever I want to use a For-loop, I write it and then see if I can rewrite it using the Stream API. For example: I have an object called myThing, some Collection-like data structure which contains an arbitrary number of Fields. Something has happened, and I want to set all of the fields to some common state, in my case "Hidden"

Git Reset in Eclipse

Using Git and the Eclipse IDE, you have a series of commits in your branch history, but need to back up to an earlier version. The Git Reset feature is a powerful tool with just a whiff of danger, and is accessible with just a couple clicks in Eclipse. In Eclipse, switch to the History view. In my example it shows a series of 3 changes, 3 separate committed versions of the Person file. After commit 6d5ef3e, the HEAD (shown), Index, and Working Directory all have the same version, Person 3.0.

Code Coverage in C#.NET Unit Tests - Setting up OpenCover

The purpose of this post is to be a brain-dump for how we set up and used OpenCover and ReportGenerator command-line tools for code coverage analysis and reporting in our projects. The documentation made some assumptions that took some digging to fully understand, so to save my (and maybe others') time and effort in the future, here are my notes. Our project, which I will call CEP for short, includes a handful of sub-projects within the same solution. They are a mix of Web APIs, ASP MVC applications and Class libraries. For Unit Tests, we chose to write them using the MSTest framework, along with the Moq mocking framework. As the various sub-projects evolved, we needed to know more about the coverage of our automated tests. What classes, methods and instructions had tests exercising them, and what ones did not? Code Coverage tools are conveniently built-in for Visual Studio 2017 Enterprise Edition, but not for our Professional Edition installations. Much less for any Commun

Scala Collections: A Group of groupBy() Examples

Scala provides a rich Collections API. Let's look at the useful groupBy() function. What does groupBy() do? It takes a collection, assesses each item in that collection against a discriminator function, and returns a Map data structure. Each key in the returned map is a distinct result of the discriminator function, and the key's corresponding value is another collection which contains all elements of the original one that evaluate the same way against the discriminator function. So, for example, here is a collection of Strings: val sports = Seq ("baseball", "ice hockey", "football", "basketball", "110m hurdles", "field hockey") Running it through the Scala interpreter produces this output showing our value's definition: sports: Seq[String] = List(baseball, ice hockey, football, basketball, 110m hurdles, field hockey) We can group those sports names by, say, their first letter. To do so, we need a disc