woo-besluit-broncode-digid-app/NFCService.cs at master · MinBZK/woo-besluit-broncode-digid-app
Posted by jpluimers on 2026/02/03
This method sparked a lot of discussion on social media:
private static string GetPercentageRounds(double percentage)
It is part of [Wayback/Archive] woo-besluit-broncode-digid-app/NFCService.cs at master · MinBZK/woo-besluit-broncode-digid-app which was published after a request according to the Dutch Open Government Act (WOO: Wet Open Overheid).
Even though it services the iOS app, it is written in C# not Swift despite it being client-side code, but that’s not why it sparked a lot of discussion costing more man-hours than the code is worth.
This is the code:
private static string GetPercentageRounds(double percentage)
{
if (percentage == 0)
return "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪";
if (percentage > 0.0 && percentage <= 0.1)
return "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪";
if (percentage > 0.1 && percentage <= 0.2)
return "🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪";
if (percentage > 0.2 && percentage <= 0.3)
return "🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪";
if (percentage > 0.3 && percentage <= 0.4)
return "🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪";
if (percentage > 0.4 && percentage <= 0.5)
return "🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪";
if (percentage > 0.5 && percentage <= 0.6)
return "🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪";
if (percentage > 0.6 && percentage <= 0.7)
return "🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪";
if (percentage > 0.7 && percentage <= 0.8)
return "🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪";
if (percentage > 0.8 && percentage <= 0.9)
return "🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪";
return "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵";
}
I agree with Jeroen Frijters that this is not just visually interesting code. In fact very it is good readable code with very few flaws. Almost all reactions to his original tweet (the second one below) that proposed code were harder to understand, took longer to write and had a similar amount of errors.
Three of his mot spot-on tweets are:
- [Wayback/Archive] Jeroen Frijters on Twitter: “I was starting to feel a bit guilty about how much programmer time I wasted with my last tweet, but then I realized that the people arguing on Twitter about trivial code probably do the same at work, so it may be a net gain to distract them.”
- [Wayback/Archive] Jeroen Frijters on Twitter: “@david_m_gilbert Agreed. If I encountered this code I wouldn’t change it, but on a pre-commit review I would ask to remove the unnecessary comparisons and change the first comparison to
<= 0.” - [Wayback/Archive] Jeroen Frijters on Twitter: “Asking ChatGPT about the edge cases of the method. It’s refreshing not having to worry about it’s ego when telling it it is wrong.”
Later he elaborated on this [Wayback/Archive] Thread by @JeroenFrijters on Thread Reader App:
People love making assumptions though. Many assumed I thought it was it was horrible code. I don’t think it’s great code, but I certainly wouldn’t rewrite it if I encountered it.
If I were to review this pre-commit, I would ask for the first condition to be <= 0, remove the redundant conditions and add an else to the last if. This would make it visually more consistent and easier to see everything matches up.
I would also add an assertion at the top to document the expected range of percentage.
From the replies to my tweet I learned a number of things:
1) Many are eager to argue about or “improve” the method, but are too lazy to lookup the context of were it is used.
2) Floating point comparisons are scary to some programmers.
3) Dunning-Kruger is real.
If you want to look at all of the code yourself, the repository is at [Wayback/Archive] MinBZK/woo-besluit-broncode-digid-app.
Via
- [Wayback/Archive] Jeroen Frijters on Twitter: “It’s been quite the week in my Twitter notifications. More than 6M “impressions”. I had no idea this method would trigger all this. I simply thought it looked funny and visually interesting.”
- [Wayback/Archive] Jeroen Frijters on Twitter: “The Dutch government was forced to release the source code of their DigiD digital authentication iOS app. It is written in C#.
github.com/MinBZK/woo-besluit-broncode-digid-app“
–jeroen








Leave a comment