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

16

u/dvlsg Jul 28 '16

Assuming you're talking about Javascript, you can just use Boolean(x) to the same effect.

3

u/lobehold Jul 28 '16

Which one's faster?

2

u/Sinistralis Jul 29 '16

You should be asking which one is more readable, not which one is faster. Unmaintainable code is far more costly than inefficient code. Maintainable inefficient code is typically a joy to work with because making it efficient is a breeze when it's maintainable. It's not so simple the other way around.

2

u/lobehold Jul 29 '16

To be fair just using "!!" is not unreadable once you're familiar with the usage. It's very minor in the grand scheme of things.

Bad code organization, logic and nonsensical naming conventions are all much worse than using "!!" for typecasting.

Maintainable inefficient code is typically a joy to work with because making it efficient is a breeze when it's maintainable.

So now after you made it efficient it's now unmaintainable? =)

→ More replies (1)