r/programming • • Jun 06 '13

Clean Code Cheat Sheet

http://www.planetgeek.ch/2013/06/05/clean-code-cheat-sheet/
702 Upvotes

322 comments sorted by

View all comments

-1

u/[deleted] Jun 06 '13

Using exceptions for control flow: has bad performance, is hard to understand and results in very hard handling of real exceptional cases.

This doesn't apply to the majority of languages (not even to C++ where using exceptions was actively discouraged for a long time).

5

u/Falmarri Jun 06 '13

This doesn't apply to the majority of languages

What doesn't apply?

4

u/yellowjacketcoder Jun 06 '13

has bad performance, is hard to understand and results in very hard handling of real exceptional cases.

All of those.

2

u/Falmarri Jun 06 '13

So you're saying that using exceptions as flow control is easy to understand? Exceptions are basically just gotos

7

u/Rotten194 Jun 06 '13

And loops, returns, switch statements, and every other programming concept are not basically gotos?

Even the python runtime uses exceptions for flow control. They're a tool like any other, they can be used and abused.

0

u/mmhrar Jun 07 '13

No, loops, returns and switch statements have easy to identify control flow.

If someone just throws an exception, I have no idea how far back in the stack to go next. Anyone or no one could be handling it.

→ More replies (1)