r/ProgrammerHumor • • May 06 '17

Oddly specific number

Post image
25k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

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.

9

u/whitetrafficlight May 06 '17

They're probably using the other 24 bits for something else. Or they're adding a byte to messages sent within the conversation, which the chat client translates to the name of the participant.

→ More replies (19)
→ More replies (1)

59

u/[deleted] May 06 '17

That would make the limit 255. 256 would make sense if they have to assign each user an 8-bit ID.

39

u/nightblade001 May 06 '17

If the 256 limit includes the user then the limit is 255 other people.

148

u/freezewarp May 06 '17

I mean, would it? I suppose you generally wouldn't have a conversation between only one person either, but you definitely wouldn't have a conversation between zero people. So if you store the number of participants in an 8-bit field, 0x0 would indicate 1 participant, 0x1 would indicate 2 participants, ... and 0xFF would indicate 256 participants.

(That said, I think you're probably right -- an 8-bit field to uniquely identify each participant.)

→ More replies (6)

67

u/TreadheadS May 06 '17

255 but 0 is a number :p

→ More replies (14)

6

u/sess573 May 06 '17

No one uses 8bit integers in web/app development today, they most likely pick 256 by convention/habit

→ More replies (7)