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

2.9k

u/progfrog Nov 16 '16

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." -- Nathaniel S. Borenstein, computer scientist

523

u/verydapeng Nov 16 '16

right, never hardcode anything!

307

u/ilion Nov 16 '16

I don't know... big difference between the two. This seems like scope creep and could put this out of sprint.

166

u/Razzal Nov 16 '16

Well what if we remove all safeguards and security, think you can squeeze it into a demo-able form by Friday?

148

u/ilion Nov 16 '16

Sure, we'll put a security story in the backlog to be done in Q4 where it can safely be de-prioritized eternally. I estimate it at ∞.

71

u/Atario Nov 16 '16

This thread is making me itchy

61

u/mortiphago Nov 16 '16

if you're getting agile itchiness try taking a waterfall shower

→ More replies (1)
→ More replies (15)
→ More replies (17)
→ More replies (21)

58

u/d4rch0n Nov 16 '16

Then you go and spend 16 hour days and finish the DestroyCity procedure and product is like... "okay great, that's good, but we were reallllly looking for a CommitGenocide"

38

u/ZeroPipeline Nov 16 '16

This is the truth. The method executes and every building, brick, sidewalk, and piece of infrastructure vanish in a faint puff of smoke, leaving only the people behind. And you take the blame for not eradicating them too because somehow hazy requirements are your fault.

→ More replies (3)
→ More replies (9)

138

u/NoMoreNicksLeft Nov 16 '16

Why write a DestroyCity procedure when I can write a city administration software product in Visual Basic?

You people overthink these things.

0

u/[deleted] Nov 16 '16

[deleted]

83

u/fiah84 Nov 16 '16

woah there that's against the Geneva Convention

38

u/Sarcastinator Nov 16 '16

Why over-engineer it? We already have a working Excel 97 worksheet for this.

→ More replies (10)

238

u/green_meklar Nov 16 '16

You know, just in case someone else wanted to destroy a different city.

156

u/caskey Nov 16 '16

Yeah, you don't want to lose the follow up contracts to retarget the software.

104

u/c1e0c72c69e5406abf55 Nov 16 '16

Oh but that is simple my friend, the front end is just one button hard coded with the parameter Baghdad.

59

u/artanis2 Nov 16 '16

You don't tell the client that...

78

u/c1e0c72c69e5406abf55 Nov 16 '16

Well of course not, we need to bill the new subroutine out for that new city at 80% of the cost we billed the first one, I mean it took so long that first time we might be able to reuse some of the code/knowledge but not all of it.

→ More replies (2)

147

u/goal2004 Nov 16 '16

Nah, that's short term thinking still. It'd have to be Destroy<T>(T obj).

115

u/memeship Nov 16 '16

I mean, cities, or specifically locations, are a pretty specific type of target. So maybe more like:

class CityDestroyer implements Destroyer 

51

u/RunasSudo Nov 16 '16

IDestroyer.java

AbstractDestroyerImpl.java

CityDestroyer.java

DestroyerFactory.java

→ More replies (2)
→ More replies (2)
→ More replies (28)

28

u/[deleted] Nov 16 '16

The "code" for DestoryCity was "written" by Physicists, not Software Engineers.

Although I suppose there is code somewhere that can fire nuclear missiles at any location that's given to it as a parameter.

36

u/caedin8 Nov 16 '16

Some software engineer somewhere wrote that. I wonder how he sleeps at night

→ More replies (10)
→ More replies (1)
→ More replies (54)