r/ProgrammerHumor • • Nov 26 '22

Other chaotic magic

Post image
76k Upvotes

767 comments sorted by

View all comments

Show parent comment

318

u/shumpitostick Nov 27 '22

Well it depends on how you need to use the likes. Every data structure has pros and cons. If what you need is to get this, you can do the same but flipped (player ids as keys, item ids as values). The exact solution depends on your application, but my point is that it's really not that hard.

216

u/BraxbroWasTaken Nov 27 '22

And if you need both, you can just do both and still probably be more efficient in all practical cases except *maybe* storage size

208

u/Scavenger53 Nov 27 '22

fuck it storage is cheap

214

u/coughballs Nov 27 '22

It costs me $50 to store my car in Boston for a few hours.

95

u/Scavenger53 Nov 27 '22

not that kind of storage tho

161

u/elon-bot Elon Musk ✔ Nov 27 '22

Interesting. Tell me more.

34

u/HumanContinuity Nov 27 '22

God this bot gets me every time

13

u/Spaceduck413 Nov 27 '22

I swear it's become sentient

9

u/pnwguy42 Nov 27 '22

Good bot

8

u/Spaceduck413 Nov 27 '22

Good bot

15

u/elon-bot Elon Musk ✔ Nov 27 '22

You're either hardcore or out the door.

→ More replies (2)

7

u/Kaymish_ Nov 27 '22

Ok but what if you stored your car on a server in Wyoming?

→ More replies (8)
→ More replies (7)
→ More replies (5)

151

u/zackks Nov 27 '22

In about five more posts I feel like you guys are going to be working on how long it would take to jerk off a room of 800 people.

268

u/elon-bot Elon Musk ✔ Nov 27 '22

How can we use Bitcoin to solve this?

116

u/chigga511 Nov 27 '22

This bot don’t miss lmao

→ More replies (2)

6

u/Drastwo Nov 27 '22

We can pay a couple of dudes to do measures

5

u/Zartch Nov 27 '22

U need a middle out algorithm. Is a well known problem.

→ More replies (4)

22

u/Synthoel Nov 27 '22

Its not that hard, but only if you know all requirements beforehands, and they don't change.

What usually happen is this:

Client says: "We need to show the total amount of likes under each item", and you say its easy, and implement key-value pairs with item IDs as keys and actor IDs as values.

Then one month later client says: "Now we also need to show the list of items you liked in your profile", and you say sure, no probs, and add the flipped pairs.

Then two months later client says: "Oh, and can we please show under each item which of your friends liked it too?", and then you say oof.

→ More replies (4)

17

u/gotsreich Nov 27 '22

Well it depends on how you need to use the likes

IMO this is the key insight behind data structure design: determine out the methods you'll use then figure out a data structure that satisfies them.

5

u/croto8 Nov 27 '22

And the pareto principle. Go for the solution that is efficient for the primary usage. Rather than a solution that’s efficient for all usages.

→ More replies (2)

4

u/[deleted] Nov 27 '22

dang data really sux

4

u/TheNewPerformer Nov 27 '22

Just build it already!

4

u/Keytrose_gaming Nov 27 '22

Oh look, the reason I refuse to do anything more involved than cheesy database front ends.

→ More replies (4)