Happy Trinity Sunday!
For those not familiar, Trinity Sunday is the day in the Church liturgical calendar that celebrates the great mystery of the Holy Trinity, the doctrine that Christians worship a 3-in-1 God.
God the Father. God the Son. God the Holy Spirit. Three Persons and One God. As introductions go, Wikipedia's is a bit heavy, but the whole doctrine is one of the great mysteries / paradoxes / intellectual conundrums of orthodox Christianity.
This year, as Trinity Sunday approached, I was thinking thoughts related to job interviews. One of the classic entry-level programming tests for such interviews is the FizzBuzz challenge, in which one is challenged to print the numbers 1 to 100 but, if the number is a multiple of 3, print "Fizz", if a multiple of 5, print "Buzz", and if a multiple of both 3 and 5, print "FizzBuzz"
I am not going to offer a solution to either FizzBuzz or my variation. A simple internet search will reveal implementations in dozens of different programming languages. And you, dear programmer, should be able to bang out an implementation in your language of choice in a matter of minutes, right?
So, in honour of Trinity Sunday, here is a Trinitarian Variation of the FizzBuzz problem:
Trinity-Fizz-Buzz Challenge:
Print the numbers 1 to 100. But in the following situations, print the text instead:
Other variations on this Trinity-Fizz-Buzz (TFB) challenge:
FizzBuzz is a classic test because it does at least two things:
They still apply to the TFB above. It fits the FizzBuzz mold in that sense. If anything, it amps up the code duplication aspect. We've gone from 4 cases in FizzBuzz to 8 in TFB, making the brute-force approach a bigger hassle.
On the other hand, a test with such obvious association with a particular faith perspective is likely to contravene loads of diversity policies at the company level, and have possible legal and human rights implications.
So I will end as I began, by wishing you, whatever your faith perspective, a happy Trinity Sunday! May you spend it contemplating some of the great mysteries of our existence, whether that be the Christian Trinity, the mystery of love, are we alone in the universe, or another of the big questions inherent in our life, death, and everything in between.
For those not familiar, Trinity Sunday is the day in the Church liturgical calendar that celebrates the great mystery of the Holy Trinity, the doctrine that Christians worship a 3-in-1 God.
God the Father. God the Son. God the Holy Spirit. Three Persons and One God. As introductions go, Wikipedia's is a bit heavy, but the whole doctrine is one of the great mysteries / paradoxes / intellectual conundrums of orthodox Christianity.
This year, as Trinity Sunday approached, I was thinking thoughts related to job interviews. One of the classic entry-level programming tests for such interviews is the FizzBuzz challenge, in which one is challenged to print the numbers 1 to 100 but, if the number is a multiple of 3, print "Fizz", if a multiple of 5, print "Buzz", and if a multiple of both 3 and 5, print "FizzBuzz"
I am not going to offer a solution to either FizzBuzz or my variation. A simple internet search will reveal implementations in dozens of different programming languages. And you, dear programmer, should be able to bang out an implementation in your language of choice in a matter of minutes, right?
So, in honour of Trinity Sunday, here is a Trinitarian Variation of the FizzBuzz problem:
Trinity-Fizz-Buzz Challenge:
Print the numbers 1 to 100. But in the following situations, print the text instead:
- print "Father" if the number is a multiple of 2
- print "Son" if the number is a multiple of 3
- print "Spirit" if the number is a multiple of 5
- if the number is a multiple of more than one of those factors (2, 3, 5) print all appropriate words, with no spaces between them.For example, print "FatherSonSpirit" if the number is a multiple of 2 and 3 and 5
Other variations on this Trinity-Fizz-Buzz (TFB) challenge:
- If the classic Father - Son - Spirit terminology is not to your taste, substitute Creator - Sustainer - Redeemer instead;
- At first I considered multiples of 3-5-7 instead of 2-3-5, but then the FatherSonSpirit combination would never occur between 1 and 100. So I stuck with the 2-3-5 primes as factors. But for more numbers, fewer text entries, try different factors like 3-4-5;
- Require in the problem statement that "Father" always come first (since the Son is "begotten" of the Father and the Spirit "proceeds" from the Father ;)
FizzBuzz is a classic test because it does at least two things:
- it gives a challenge that falls outside the patterns of many school assignments;
- its conditions seem linear but cannot be implemented linearly without code duplication
They still apply to the TFB above. It fits the FizzBuzz mold in that sense. If anything, it amps up the code duplication aspect. We've gone from 4 cases in FizzBuzz to 8 in TFB, making the brute-force approach a bigger hassle.
On the other hand, a test with such obvious association with a particular faith perspective is likely to contravene loads of diversity policies at the company level, and have possible legal and human rights implications.
So I will end as I began, by wishing you, whatever your faith perspective, a happy Trinity Sunday! May you spend it contemplating some of the great mysteries of our existence, whether that be the Christian Trinity, the mystery of love, are we alone in the universe, or another of the big questions inherent in our life, death, and everything in between.