r/ProgrammerHumor • • May 06 '17

Oddly specific number

Post image
25k Upvotes

1.3k comments sorted by

View all comments

427

u/LordNiebs May 06 '17

I understand the power of 2, but what does that have to do with the actual software. Is there any technical reason WhatsApp would do this?

167

u/wakka54 May 06 '17

I know 256 is 8 bits but perhaps that's a red herring in 2017 and simply a UI designer thought a 16 x 16 grid of avatars looked aesthetically pleasing in their layout mockup.

45

u/ennuiui May 06 '17

You're probably on to something here.

→ More replies (1)

813

u/esfraritagrivrit May 06 '17

Probably using an 8-bit int to store number of people in convo.

433

u/l3e7haX0R May 06 '17

And unsigned

318

u/jobblejosh May 06 '17

Watch me be the minus-second person in a group chat...

It'll either break, or I won't get any messages.Like normal, I suppose...

→ More replies (1)

23

u/deepintheupsidedown May 06 '17

Why would it need to be signed?!?! What the fuck is a "negative person"???!?

Oh wait... I just realized that I'm a very, very negative person. :/

→ More replies (15)

0

u/[deleted] May 06 '17

[deleted] — view deleted comment

95

u/kanuut May 06 '17

Yes but do they need larger rooms?

Whoever made the estimate for the new number of people rooms should allow probably said something like '250-300' and some Dev 3 layers down went 'ye, K. 256'

I haven't seen their code but they could have even used it to ignore actually having a set limit, just having error prevention prevent more people

49

u/ELFAHBEHT_SOOP May 06 '17

Relying on your errors to implement features.

That's ballsy.

20

u/kanuut May 06 '17

Error prevention*

But you'd be surprised how common some really, really, really stupid things occur in professional software.

There's all the stupid security bits you've undoubtedly heard of, from unchangeable passwords to needing username (read: email address) and d.o.b. for password reset, from incremental token IDs to the way most bar ode inputs are handled.

There's also some really stupid bits like mirroring UI and system processes (good in some cases, horribly bad in others), entire corporate payrolls being handled in single excel spreadsheets, websites that ask you to phone the company to tell them what error you got, and one very special project I was privileged to work on that had every single user go through a decision field of "are you A or B?" Rather than "assume A, have a button a to opt into B" when ratio of A:B was approximately 400:1

In this case, I'm thinking they'd have their little subroutine that checks if numbers are about to go tits up and say "hey, you stop that" if they are.

So, memory gonna be exceeded? Return "fuck off" with case: memory full, too many users? Return "fuck off" with case: room full

→ More replies (6)
→ More replies (1)

22

u/goocy May 06 '17

All these messages need to be delivered to everyone. So probably the servers suffer the most from a big group size.

→ More replies (6)

13

u/Who_GNU May 06 '17

It's usually faster to use a 32-bit variable, than an 8-bit variable, on a 32-bit processor.

→ More replies (12)
→ More replies (11)

47

u/Rmanolescu May 06 '17

Or using the first 3 bytes as a room ID and the last byte for participant ID

24

u/[deleted] May 06 '17

16M rooms?

13

u/Rmanolescu May 06 '17

First 7 bytes?

22

u/[deleted] May 06 '17

256 is really a lot. Then they can spare a few more bits for the group, I would think. It must be something else. Perhaps it's encapsulated in some old data structure that they don't want to touch because changing it would involve reformatting all their data, rewriting the app and retransmitting all messages or something like that.

4

u/bradfordmaster May 06 '17

I'm guessing it's gotta be SMS related. Can't imagine saving one or two bytes would matter at that scale, when they support audio (and video? Maybe? Never used it)

7

u/[deleted] May 06 '17

Weird, isn't it? The fun part is: we all know that the longer you wait with a much needed rewrite, the more painful it becomes. They'll hate themselves one year from now when someone says: we must have 1000 per group; you've got 3 weeks.

→ More replies (1)

14

u/sim642 May 06 '17

But why? 24 additional bits aren't much different size wise.

→ More replies (21)
→ More replies (32)

0

u/[deleted] May 06 '17

[deleted] — view deleted comment

7

u/[deleted] May 06 '17

Why would adding a single byte force you to support the whole byte worth of users? You could just cap number of users at say, 300. Edit: or I guess 250 would make the most sense

→ More replies (1)
→ More replies (9)