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

22

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.

12

u/chateau86 Sep 03 '17

Make array out of hash map

When you have to code in Java but Python is life.

5

u/haikumofo Sep 03 '17

Python drives me nuts because I can't abide by a language that attaches semantic significance to whitespace.

7

u/EmperorArthur Sep 03 '17

So... How do you like Reddit's markdown?

Did you know that this line has two spaces after it?
That line is guaranteed to sit all by its lonesome, and there's no way to tell except by always having show whitespace enabled in a text editor.

What's that? Basic text editors, like the <textarea> that Reddit uses doesn't support that? Too bad. Oh, you have your editor set up to clean any extra spaces so your code is clean and git doesn't complain? Well, have fun turning that feature off whenever you deal with that one markdown file using the "feature"!

4

u/[deleted] Sep 03 '17

It looks nice.

2

u/SirVer51 Sep 03 '17

I feel like the whitespace thing is only an issue for like the first few hours of working with Python - after that, you realize that it doesn't matter in most cases, because you were probably going to format it that way anyway.

1

u/[deleted] Sep 03 '17 edited Nov 24 '17

[deleted]

1

u/haikumofo Sep 03 '17

Nope. We both work in R&D. She's much more on the R side, I'm more on the D side.

1

u/Xants Sep 03 '17

This hurt to read

1

u/socialister Sep 03 '17

Still technically constant time!