This blog series often talks about the complexity of software, and why it can be buggy and hard to maintain. No better example than Easter. Everybody knows when Easter arrives, just look at the calendar. Yes, it’s odd that it’s on a different date every year, but whatever.

Let me try to shed some light on why the Easter date falls when it does. And as you’re reading this, imagine you have to put this into flawless code. Please note there are multiple methods, all leading to the same result (sort of). Here below, I’ll take you through the Gauss method.

*Tip: Read the following diagonally, it’s quite detailed and mind-boggling. You’ll either love it or find it extremely boring (which is exactly the point).*

First of all, you need to calculate the so-called “golden” number of the year. For this, we have to divide the year by 19, take the year minus this division, and add 1. This is related to the fact that the earth and moon every 19 years are in the same relative position. So, there you go, already lost 80% of the readers!

Then calculate the number for the century; this is the year divided by 100 plus 1. So, for 2020, it’s 21. Then correct for years that aren’t leap years: for this, take the 21, multiply it by 3, then divide it by 4, take the integer number and subtract 12. In this century, this results in the number 3.

Then do some moon correction: take the century number, multiply by 8 and add 5, divide it by 25, take the integer and subtract 5. This number is 1 in our times.

Then look for the Sunday, multiply the year (so 2020 now) by 5, divide it by 4 and take the integer, then subtract the previous number 3 and another 10 for good measure. If I’m not mistaken, this number is 2512 for this year 2020. Now, take the epacta, which is the golden number times 11 plus 20 plus the 1 we calculated above. Subtract the 3, divide by 30 and take the rest. If the rest happens to be 24 or 25 and the golden number is bigger than 11, than add 1. Then take 44 minus this number, if the result is smaller than 21, then add 30.

Really, I’m not making this up. We’re not done yet, it goes on…

Take the last number and add the previous, divide by 7, take the integer and of the rest, subtract that from the previous last number plus 7. Now, if the result is bigger than 31, subtract 31: the result is the date in April. If the number is smaller or equal than 31, that’s the date in March.

No doubt, you’ve forgotten all of this already, and you’ll never calculate Easter like this. But we now know several things:

– First of all, the actual date of a very Christian day is very celestial indeed, but maybe in a different way than you’d expect.

– Second, it clearly demonstrates that some things are a lot more complex than you’d think.

– Third, and here’s where I finally get to my point related to software engineering, it explains why software engineers simply take libraries to do certain things for you. Imagine you had to program this for your HR system – there’s a good chance you could find yourself taking a day off all on your own, while other people are wondering why you’re eating that many Easter eggs in the middle of autumn.

Hopefully, the library you chose for calculating holidays is correct and up-to-date and doesn’t have any liabilities or vulnerabilities. You may end up with a security issue on your Easter holiday! Maybe you could call it an Easter egg? Keep your libraries safe and up-to-date!