My rule of thumb is to use strings for all IDs that belong to external systems. A bunch of people got burned in the same way a few years ago when Flickr photo IDs rolled past 32 bits.
Still surprised people use incrementing ints for ids over uuids for web apis that may become immense. http://www.ietf.org/rfc/rfc4122.txt uuids are made just for this purpose, string based, never bigger than 40 characters (with dashes and curly braces). Most products use uuids or Microsoft's name for them guids.
Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
31–40 of 48 posts
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#32That's truly, truly dumb on twitter's behalf. They should have started with using the whole numeric range and/or switched to string ids long ago. As I have suggested in a post 9 months ago, and as I would have designed this system at any date since 2002 or so, the twit ID would be composed of userid bits + time bits. In the post below I suggested 32+32, but other divisions are acceptable depending on your "bot user"…
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#33My rule of thumb is to use strings for all IDs that belong to external systems. A bunch of people got burned in the same way a few years ago when Flickr photo IDs rolled past 32 bits.
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#34My rule of thumb is to use strings for all IDs that belong to external systems. A bunch of people got burned in the same way a few years ago when Flickr photo IDs rolled past 32 bits.
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#35Earlier quoted context omitted.
Agreed. And also, there's not a lot of manipulation/math to be done on these IDs once they come back to the client. They're only used again when an operation happens on a tweet (favoriting it, replying to it) and in that case you're just taking the ID and sending it back to Twitter.
not really. You (can) use since_id and max_id in many places, which means you need them to be ordered (and trivially so). This is of course doable with strings too, once you decide what the ordering is.
In a more practical application, a timeline comes back and the top-most and bottom-most IDs are stored. When a user gets to the bottom an API call is made to load more so you look at the bottom-most ID. If they want to load new tweets you look at the top-most ID. No math needed, just looking up values. They could've been strings all along and it wouldn't have mattered much.
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#36Earlier quoted context omitted.
Still surprised people use incrementing ints for ids over uuids for web apis that may become immense. http://www.ietf.org/rfc/rfc4122.txt uuids are made just for this purpose, string based, never bigger than 40 characters (with dashes and curly braces). Most products use uuids or Microsoft's name for them guids.
I prefer my ID's universally unique. I worry that globally unique ID's won't scale as we begin to colonize other planets. (yes, its a joke.)
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#37Earlier quoted context omitted.
-1. With hindsight it's easy to make a comment like yours, but many clients rely on the status_id to be monotonic. You would be changing behavior in a way that breaks apps. Twitter doesn't want to do that.
-1 all you like. It's engineering, not hindsight -- when building a system, I always ask myself "how does this scale" which usually translates to "on what attribute does this shard". Look at e.g. YouTube and many other sites around the same time. They knew what they were doing; Twitter didn't. I _have_ actually designed such a system in 1999, that used 48 bits, and it worked perfectly well. (Only had 28 bits for the…
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#38I'm going to take the opposite position of most commenters here and decry the fact that almost all programming languages get arithmetic wrong. Adding two positive numbers should never result in a negative number. Adding a one to an integer should result in the next largest integer. There are new languages created all the time that don't have built-in support for arbitrary precision integers or rational numbers. They…
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#39Earlier quoted context omitted.
not really. You (can) use since_id and max_id in many places, which means you need them to be ordered (and trivially so). This is of course doable with strings too, once you decide what the ordering is.
Tweets come back ordered newest to oldest so there's nothing to order if you don't want to. And accessing since_id or max_id just to send it back to Twitter is exactly what I was referring to: no math to be done, just storing & accessing a value so it doesn't have to be in number format. In a more practical application, a timeline comes back and the top-most and bottom-most IDs are stored. When a user gets to the bot…
I don't understand how saying you're gonna access the timeline without looking at the values denies that.
Moreover, I did not object to using strings, I said you only want them to be orderable.
Re: Twitter IDs to roll past 53 bits in a couple days (may break javascript apps)
#40Earlier quoted context omitted.
64 bits is enough to have everyone on Earth send over a billion Tweets and still have enough room to find a new solution. That sounds like more than enough to me.
The problem is they added a timestamp and people assumed they would not need the full 64 bit ID. IMO, it's not a bad idea on their part. A 32 bit UNIX timestamp * 2 ^ 32 + a 32 bit sequential id let's them track up to 4.2 billion tweets a second and should work just find up to the year 2106. Edit: As to why it's a good idea, you can have different systems handing out ID's without stepping on each other’s toes or even…
And once you've done that, why not just go all out and use UUIDs?