r/programming • • Nov 15 '16

The code I’m still ashamed of

https://medium.freecodecamp.com/the-code-im-still-ashamed-of-e4c021dff55e#.vmbgbtgin
4.6k Upvotes

797 comments sorted by

View all comments

Show parent comments

51

u/[deleted] Nov 16 '16

That's the wrong abstraction. The actual parameter should be a coordinate.

79

u/Kalium Nov 16 '16

Nah. It should be a Location, which has coordinates as attributes.

123

u/blueshiftlabs Nov 16 '16

Nah, make it take a Destructible, and have Baghdad implement it so that it can destroy itself.

464

u/Kalium Nov 16 '16
free(Baghdad); // destroy Baghdad

68

u/oblio- Nov 16 '16

BDD. Bush Driven Development.

→ More replies (1)

22

u/bliow Nov 16 '16

Savage.

19

u/sporifolous Nov 16 '16

I spit all over myself laughing at this.

23

u/epicwisdom Nov 16 '16

I feel like most people aren't getting the memory management joke.

7

u/Malfeasant Nov 16 '16

I got it, and I've barely dabbled in C/C++...

→ More replies (7)