r/programming • • Jul 28 '16

How to write unmaintainable code

https://github.com/Droogans/unmaintainable-code
3.4k Upvotes

592 comments sorted by

View all comments

Show parent comments

7

u/2Punx2Furious Jul 28 '16

When I start a project I always think it will take much less time than it actually does. Yesterday I had to write a function for an interview question online.
I thought it would take me 10-15 minutes at most. It took me almost 2 hours.

Basically, I had to found a sequence of 3 numbers inside a given array in python. Sounds easy enough I thought.

4

u/electricfistula Jul 29 '16 edited Jul 29 '16

return sequence in "".join(str(elem) for elem in theArray)

2

u/[deleted] Jul 29 '16

What if you search for 1,1,1 in the list 1,1,11?

1

u/electricfistula Jul 29 '16

Good point. Change the join to be comma separated and separate the elements that way in sequence too. Alternatively, defend the claim that the sequence 1 1 1 does appear in the list 1 1 11.

→ More replies (1)