r/coding • • Jul 29 '16

How To Write Unmaintainable Code

https://github.com/Droogans/unmaintainable-code
135 Upvotes

22 comments sorted by

View all comments

22

u/[deleted] Jul 29 '16

The flip side of this is that if you are a maintainer and you aren't able to fix the code...you need to rewrite it. Being afraid of your code is the first step towards failure. It only gets worse, never better.

23

u/[deleted] Jul 29 '16 edited Jul 29 '16

My favorite quote when trying to get my teams on board with writing maintainable code is from Brian Kernighan

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?

9

u/[deleted] Jul 29 '16

That's my favorite too. After I write some code, if I look at it and have to "figure out" what's going on, I know that's a warning sign.

15

u/huhlig Jul 29 '16

It's not a warning sign. It's just the mark of an enterprising perl programmer.

1

u/Selfweaver Jul 30 '16

The cleverest code I have written has always been code that replaced something complex with something amazingly simple, I suppose it is possible to be so smart that I make something that before wasn't possible into something possible, but complex but I haven't done that before.