Live data from Hacker News

Twenty five thousand dollars of funny money

rachelbythebay.com

171–175 of 175 posts

Re: Twenty five thousand dollars of funny money

#171

Earlier quoted context omitted.

In the mid-2010s I worked at a company that switched from using raw ints to refer to database rows to using (in C# terms) "Id ". Across the entire codebase, we discovered an entire class of bugs that only never cause any issues because all the important rows in all the important tables had Id 1 (e.g. Currency 1 was USD and Country 1 was USA) - so in a few places where the ints got mixed up, the correct row was still…

Oh wow. Was there a “stomach sank to the floor” sudden feeling upon discovery?

Not really. The whole thing was kept together with tape and silly string anyway, and I bet it still is now, more than 5 years on.

Re: Twenty five thousand dollars of funny money

#172
post #82

Earlier quoted context omitted.

The way that things work at this particular company is that you typically test changes in this codebase on your dev machine, but usually the dev machine talks to a prod database. The prod database is too large to practically have a second copy sitting around for testing. Also, if you tested on some pristine small test database you're going to end up missing bugs that would only manifest with actual prod data.

I get it but that just seems really dangerous. I hope they have a lot of guard rails and roll back support or something.

They do. Feature flags are part of the culture, you'll typically gate in a very small set of objects that could initially receive any new treatment.

Re: Twenty five thousand dollars of funny money

#173
post #112

One of the first programming languages I learned was TI BASIC on the TI-89. It had an excellent units (refinement types) system: you could define an expression as a "unit" by prefixing a variable with an underscore, and it came with a bunch of built-in units. A unit expression could thereby automatically convert between types as needed, outputing the base unit. E.g. `5_dollars + 8_cents` would output `508_cents`. The…

Looks neat. Of course you can do this in c++.

Of course, templates are sufficiently complex metaprogramming to achieve this. But it's not a language built-in, or even part of the standard library.

F# has a refinement type system built in (which allows this), and of course Haskell and Idris are sufficiently capable in their type systems to trivially support it, but none of those are particularly mainstream general-purpose programming languages. Mainstream languages pretty much all need some sort of library for it, which is unfortunate since they're extremely useful in many common programming problems.

Re: Twenty five thousand dollars of funny money

#174
This one brought up yet another tech memory to share from the past. I was the founding architect of a real-time payments company in the mid 1990s which at the time was processing for a very well known, even to this day, ‘use your email to pay’ company. My position as the architect and critical core software developer brought me into many problems that were others, both in business and in technology. As the leading technology based payment processor at that time along with our large volume we had a relationship with a bank that had another smaller processor which suffered a breach, one of the first widely reported. This smaller processor was "consumed" by us, unknown why nor can I recall atm but back then it was much different working with the large card brands and banks, and we therefore were transferred all their assets including source code. I was tasked with finding the areas of compromise within the software systems designs having already rearchitected our core systems to XML and microservices long before such ideas were even considered. In performing a source code review of what was a monolith written entirely in Visual Basic 6 I discovered whoever had written it decided that they would treat themselves to much greater than 25K of real fiat currency. Someone had added to the if statement on checking the credit card number that upon matching a specific series of numerics no outbound card brand API call was made and this transaction was auto approved, no other checks, and this code was in production. Those reading this far can likely deduce the potential of such a single if statement.

Re: Twenty five thousand dollars of funny money

#175
post #112

Earlier quoted context omitted.

Looks neat. Of course you can do this in c++.

Of course, templates are sufficiently complex metaprogramming to achieve this. But it's not a language built-in, or even part of the standard library. F# has a refinement type system built in (which allows this), and of course Haskell and Idris are sufficiently capable in their type systems to trivially support it, but none of those are particularly mainstream general-purpose programming languages. Mainstream languag…

In C++, you can do this with custom literals, not meta programming: https://en.cppreference.com/w/cpp/language/user_literal

One would have to make a library with various classes representing various units, plus the (implicit) conversion between them. It´s probably something that exists somewhere.

Post reply on HN