Skip to content

u/lordofwhee

In this archive from Jul 2011 to Jan 2023

0
posts
41
comments
0
media
151
score

"Because it's always been done that way" is a very poor argument, so I'll instead focus on the idea it's more useful represented as a numeric type.

What are you likely to do with a tracking number once it's been created? I know a lot more about computers than I do the package shipping industry so I'll just have to guess. There's the initial generation and label printing. In the first case it's irrelevant (though apparently, based on other comments in this post, it's common for parts of a tracking number to have specific meanings. Concatinating variable-length strings is trivial, concatinating an integer less so in every language I've ever seen), in the latter case numeric would be useful for barcode generation or RFID chip programming, but if the number is printed on the label it must be converted to text. Then there's sorting. It's just a simple comparison so whether it's a string or numeric type is irrelevant, except maybe to the device reading the label (though I don't even know if you can get memory chips so small it would matter much).

Then we have the actual delivery. I have to make yet more guesses here, but it makes more sense to me that the portable scanner/reader used to mark a given package as 'delivered' would simply store this information rather than be part of a complex system to send it immediately. Additionally, how many packages are delivered on a delivery run? I have no idea, so I'll just guess it's less than 100 and use 100 for my calculations. This post is about a fedex tracking number, which apparently is 12 digits, so I'll use that for tracking number length. Since we're talking about decimal numbers you need 4 bits per digit. That means a numeric representation is 48 bits. Assuming nobody is insane enough to use a multi-byte character encoding, a string representation is 104 bits (12 digits plus a NULL byte). For our theoretical 100 packages that'd be 48*100/1024 ~= 4.69Kb for numeric, 104*100/1024 ~= 10.16Kb for a string. Is ~5.47Kb of memory worth much? Can you even get chips that small these days?

Also, while I was looking through some old boxes to see if any of them did indeed have the tracking number printed on them, I found this on a UPS label from a couple years ago. Not likely they store actual letters in a numeric type (granted I'm assuming they're non-constant but the presence of unchanging characters on a label printed by an embedded device, thus wasting memory anyway, is sort of an argument in my favor), so clearly UPS disagrees with you.

1 points

You keep arguing as if this data spends most of its time in embedded systems. It does not. Mostly it'll sit in a DB somewhere and that will be refrenced by systems occasionally recieving data from something like an RFID reader or barcode scanner. The tracking number is on an embedded device for the time it takes to send an update to the DB or recieve a reply as to where the package is meant to be sent or some such query, which takes a very short amount of time. This being the case, it makes far more sense to represent the data as it is actually used: as a string. The additional memory requirement is irrelevant on modern systems, especially considering the transient nature of tracking numbers and the uselessness of them if a bug like this happens.

I have a feeling you deal mostly or entirely with embedded systems and are seeing things only from that perspective, when in reality it's mostly general-purpose systems that have to deal with actual operations with tracking numbers.

0 points

We're talking about a handful of cycles. Literally picoseconds. And no, shifting is an operation performed on only one register (From Intel's system programmer manual, may 2012, volume 2B page 4-506), and it doesn't care what the data represents. Once you start shifting bits by hand you're taking representation into your own hands.

Bit masking is not numeric, either. It's bitwise (specifically, bitwise AND). In other words, datatype agnostic. The operation has no notion of what the data it's operating on represents nor does it need to.

0 points

You can take substrings very easily in any reasonable language. Additionally I would be astonished if an embedded device were generating tracking numbers since they must be unique, at least for the time they're in use, and that's a job for a database, not an RFID reader. Even if it were the number should be converted to a string as soon as it hits a general-purpose device (which I would imagine would be almost if not literally immediately).

Oh, I almost forgot. Masking is not even a numeric operation.

4 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.