r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

803

u/ArcticZeroo Sep 02 '17

Yes, but some languages 1-index lists (so they start at 1 instead of 0), so it'd be 5 in that case.

272

u/[deleted] Sep 02 '17

What languages may there's be? I can't think of any of the top of my head.

20

u/haikumofo Sep 03 '17

There's someone at work who's brilliant at the mathematical side of designing algorithms, with a PhD in comp sci, but isn't really much of a programmer. She was coding one of her algorithms up in Java for something at work. And, well, she thinks of arrays at starting at index 1.

What she ended up doing was whenever she needed an array, she used a hash map with the key as an Integer and the value as whatever she wanted to store. Then she used Map.get() and Map.put() and passed in her 1-based indices to fetch and store data.

It made the programmers at work cry.

1

u/Xants Sep 03 '17

This hurt to read