Live data from Hacker News

Source code for Dutch DigiD app released under Dutch Open Government Act

github.com

101–110 of 161 posts

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#101

This function is interesting: https://twitter.com/jeroenfrijters/status/161520407458818048...

It's easy to read, simple to maintain, and performant code. Maybe one of those newer switch expressions would make the code even clearer, but they already left the redundant lower bound checks in so I think the way this looks is quite intentional.

Much easier to read than `int count = (int)Math.Floor(percentage / 10); return new String("#", count) + new String("-", 10 - count));` in my opinion and not worth writing a custom progress component for.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#102
post #9

It’s a great app. I mean, there can be challenges, but generally extremely effective. I suppose openness will enhance security over time?

The company making this clearly doesn't want to open up development, this code was released because the government was forced to. They stripped the commit history and some hard coded details and I don't think they'll develop on this repo either.

Some extra eyes on the current code might fix some small issues, but I doubt this is going to improve the app much.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#103

Earlier quoted context omitted.

I vaguely suspect that this is a product of the sort of environment where you have to fill out a form in triplicate to get the static analyser to let you concatenate strings (which, to be clear, may not be inappropriate for something like this). I do object to the variable being called ‘percentage’ tho, as it clearly isn't one.

I have no idea where all of you got the idea that percentages go up to 100. It's in the name: PER centage, meaning x/100 [0]. For instance if you want 20% that could also be expressed as a fraction such as 20/100, which turns out is the same as 2/10 or 0.2. I do think they should remove the redundant statements in the conditions and also have an assertion that guarantees percentage to be [0, 1]. > The term "percent"…

20 percent means, literally, 20 per hundred; it's equivalent to 0.2 or 2/10 or 1/5 or whatever, of course, but if `percentage==0.2` then that fairly clearly, on the face of it, should mean "0.2 per hundred", ie 0.2% or 0.002.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#104

Earlier quoted context omitted.

I vaguely suspect that this is a product of the sort of environment where you have to fill out a form in triplicate to get the static analyser to let you concatenate strings (which, to be clear, may not be inappropriate for something like this). I do object to the variable being called ‘percentage’ tho, as it clearly isn't one.

This is likely an effect of translation more than anything. While the Dutch are generally very competent English speakers and writers, their expertise tends to end the conversational level. Anything technical in its conception takes decades of intense every day use to intuit. Source: native English speaker working in the Netherlands with a team of Dutch people. They are all really smart people, but they tend to err o…

Nah, I was half-joking. This one is a really common bit of confusing naming in English, as well.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#105

Earlier quoted context omitted.

It's pretty pathetic how many people feel the need to dunk on this bit of code just because it's not how they would write it. There's nothing really wrong with it. I'm sure the author was aware of alternative, perhaps more concise solutions using a string builder but they chose to be clear instead. So many big egos in software.

I'm pretty sure they weren't because of the redundant conditionals which simply defy logic. If there was only one check for every if statement, honestly I could give this a pass since it's at the very least simple, but by adding one extra redundant check for every statement you just created 9 new places where a bug could appear. Furthermore, using Unicode characters to represent progress is the true smell here. There…

If I had to show a progress bar for less than a second in a screen the user will only open up once per 10 years (it's NFC code for scanning passports/ID cards), I wouldn't bother writing a reusable custom progress bar component either.

Sure, you can do it better, but why would you? There are other, more pressing issues in this code (that probably also don't warrant spending extra time on refactoring).

Those redundant checks are highlighted in every IDE I can think of. I can only assume they're there for readability.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#106

Earlier quoted context omitted.

maybe EU countries could save a bundle and co-develop these apps. might also improve quality / ensure best practises are available to all etc.

This is the baffling side of the EU to all outsiders/newcomers. When I first moved here, that was my first thought as well. There is just so much in common, why repeat everything everywhere instead of single effort with branches everywhere?! (police force, consular services, Identity services, and pretty much any Government paperwork one can think of, transportation services etc). However, the population is very loca…

That’s the downside - and beauty - of federalism. EU is very diverse with different cultures, language, and behaviours.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#107
post #74

Earlier quoted context omitted.

What's the purpose of the code you're entering from the app? Isn't that a bit superfluous/couldn't the app open a communications channel with the server via the QR code you scan and provide that itself?

Then the app relies purely on the ssl cert of the server, for mitm mitigation. This way, the qr can contain a signed reply to the code, which adds a layer.

Wait, I don't get it. I understand that the server is signing a challenge with a key presumably known to the client. But why can't the app submit the challenge programmatically upon scanning a QR code? It would still verify the signature!

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#108

Speaking as an immigrant from America, I really like DigiD! I wish the US had something even remotely similar. The fact that we do not have a standardized national ID easily available to everyone is embarrassing. DigiD has some minor annoyances, but it's a helluva lot better than some alternatives I could think of.

> The fact that we do not have a standardized national ID easily available to everyone is embarrassing.

Why? I’ve lived in a European country with common national IDs, in the US, and in a European country without national IDs, and I’m not sure that the absence of it is “embarrassing.” Note that in most European countries it’s an identifier of citizenship, not residence, with other ID cards such as residence permits, drivers licenses, or municipal registrations indicating residence. Therefore, it’s far from sufficient for many common use cases that depend on residence, and the countries that don’t have one such as the US or the UK typically use passports (or ad-hoc solutions such as US/Canada enhanced drivers licenses) for travel.

I agree that digital IDs can be very useful.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#109

Earlier quoted context omitted.

I have no idea where all of you got the idea that percentages go up to 100. It's in the name: PER centage, meaning x/100 [0]. For instance if you want 20% that could also be expressed as a fraction such as 20/100, which turns out is the same as 2/10 or 0.2. I do think they should remove the redundant statements in the conditions and also have an assertion that guarantees percentage to be [0, 1]. > The term "percent"…

20 percent means, literally, 20 per hundred; it's equivalent to 0.2 or 2/10 or 1/5 or whatever, of course, but if `percentage==0.2` then that fairly clearly, on the face of it, should mean "0.2 per hundred", ie 0.2% or 0.002.

It really shouldn't. 20% means _literally_ 20 / 100 so if you need to express that numerically (as you do in code since % is reserved for modulo) you write that as 0.2. That is still a percentage, just in numerical decimal form instead of in the form of a fraction, the value is exactly the same and it didn't stop being a percentage.

If I write 0.2 in a piece of paper and give it to someone and tell them that's a percentage it should be pretty obvious that means it's 20%. If you do the same but you write 0.2% then of course it's 0.2%.

If they really wanted to they could've written the comparison using the numbers as fractions in the comparisons such as percentage < 10/100 which would be perfectly reasonable, but again, that resolves to 0.1, so you might as well right it in decimal form already.

Re: Source code for Dutch DigiD app released under Dutch Open Government Act

#110

Earlier quoted context omitted.

maybe EU countries could save a bundle and co-develop these apps. might also improve quality / ensure best practises are available to all etc.

This is the baffling side of the EU to all outsiders/newcomers. When I first moved here, that was my first thought as well. There is just so much in common, why repeat everything everywhere instead of single effort with branches everywhere?! (police force, consular services, Identity services, and pretty much any Government paperwork one can think of, transportation services etc). However, the population is very loca…

> There is just so much in common, why repeat everything everywhere instead of single effort with branches everywhere?!

I think you misunderstand the history of the EU project: its goal is what you describe, but it must be balanced with respecting the autonomy of each individual nation inside the union. It can only work if all involved governments agree to do it. Which is an incredibly difficult thing to achieve.

What we have now is the progress we have managed to make so far. If it does not appear like much, well, you should have seen what things were like before the EU, especially regarding red tape.

Post reply on HN