48 votes
Accepted

What is a good way to indicate that a number is not something you can count with?

You can use a wrapper class/struct around your string to communicate the intent of the value. It will also allow you to validate inputs and achieve compile time safety, depending on the language you ...
Ccm's user avatar
  • 634
31 votes

What is a good way to indicate that a number is not something you can count with?

It sounds like you are already using string data types for these numbers (maybe in a data model or UML model or some code), but you want to prevent another dev to convert those strings accidentally to ...
Doc Brown's user avatar
  • 201k
10 votes

What is a good way to indicate that a number is not something you can count with?

What you're dealing with here is a non-technical problem, it's a human one. There are technical solutions to be found here, but they don't cover the problem in its entirety. To repurpose an old saying,...
Flater's user avatar
  • 45.6k
4 votes

What is a good way to indicate that a number is not something you can count with?

Use a string datatype, and maybe communicate permissible values in the documentation using regular expressions.
Hans-Martin Mosner's user avatar
2 votes

What is a good way to indicate that a number is not something you can count with?

What you have are identifiers that just happen to be numeric. If you type them as identifiers, not numbers, then nobody is ever going to confuse the two. There is of course no way to prevent ...
Ian Kemp's user avatar
  • 399
2 votes

What is a good way to indicate that a number is not something you can count with?

For example, create a class PhoneNumber and a class CreditCardNumber (careful about storing the latter), obviously without any method to turn it into a large integer. That prevents people from doing a ...
gnasher729's user avatar
  • 42.7k
1 vote

What is a good way to indicate that a number is not something you can count with?

I use a lot of numbers which aren't "numbers". From account-numbers to patient-id numbers country codes to the codes for human sexes. Strictly speaking, Users can't work directly with ...
Phill  W.'s user avatar
  • 11.9k

Only top scored, non community-wiki answers of a minimum length are eligible