• Dennis (unregistered)

    Storing customer IDs as number types is not just "not ideal", it is WRONG, TRWTF, and the source of all these issues.

    I'd like to hate on Microsoft, but this is not their fault.

  • Dennis (unregistered) in reply to Dennis

    Oh, and "I like to prefix" is also just wrong. Either you always pad to a specific width, or you never prefix.

  • Dennis (unregistered) in reply to Dennis

    Sorry, I was a bit unspecific: Storing as floating point numbers (no matter the precision) is wrong. Proper integers are fine.

  • Officer Johnny Holzkopf (unregistered)

    Consideration: If we can't do arithmetics with them, they are not numbers, no matter how we call them. Let's say we have customer 123 and customer 456, can we do something like "customer 123 + customer 456" to get customer 579? What if we substract 100 from customer 12345? Do we have 3 times customer 23456? What is 1/12th of customer 9876? Would that make any sense? No? Then: Those are strings (or maybe even a specific native or constructed datatype), but not numbers, no matter if we "implicitely" consider them integers, floats our doubles just because they could look like those. It can even start with plain words, thought about carefully, maybe: "customer ID" (an ID doesn't imply it's a number) instead of "customer number", and on the other hand, customer IDs like "003.0278854", "CT8879556", "187/9965/0002774" wouldn't be called "numbers" either. Sadly, we routinely say things like "phone number" and then use integers... Language enables thinking. And that should have been possible decades ago.

  • Daniel Orner (github)

    The only main reason you'd use numbers instead of strings is for storage size... if customer IDs are guaranteed to always be integers (e.g. they're auto-increment IDs), they use way less storage than a string, and things like indexes are much more performant. Obviously depends on the scale of data you're working with, how big the strings/numbers are, and how important performance is.

  • ttlanhil (unregistered) in reply to Officer Johnny Holzkopf

    re: phone numbers Technically... you can int-divide and modulus telephone numbers to get area code and local part (which should be done with substrings)

  • (nodebb) in reply to ttlanhil

    For some countries. There is no standarized international phone number structure. For instance in the US a1-771-* is a number tied specifically to the D.C. area but in Chile a 56-2-* is a landline number while a 56-9-* is a mobile number and there is no regional coding. In other places like the UK the area codes vary in length, for instance London is 020 and Oxford is 01865, so good look using a modulus there unless you also coded the length rules. And some places are even weirder because the number of digits in a phone number varies, i.e. mobile numbers being either longer or shorter than landline numbers, although this rarer and generally only found in developing countries that have a mix of outdated and modern telecom infrastructure.

Leave a comment on “Floating Along”

Log In or post as a guest

Replying to comment #703496:

« Return to Article