Exceptions are most certainly not a branch for free! As discussed here: http://stackoverflow.com/questions/2184935/performance-cost-of-coding-exception-driven-development-in-java The cost of building an unused stack trace seems extravagant to me, especially as part of an expected control flow.
They also act as a "shadow type system". This kind of thing has been long-discussed in the C++ community, where checked exceptions are almost never used: http://www.gotw.ca/publications/mill22.htm <http://stackoverflow.com/questions/2184935/performance-cost-of-coding-exception-driven-development-in-java> On 22 September 2010 12:22, Miroslav Pokorny <[email protected]>wrote: > How is either any better than letting catching an exception or letting the > code continue in the original spot. One gets a split off into a everythings > ok here a file, or jump to there and process the problem ? Using Either ends > up being "more" code because we get the branch for free with > exceptions...And given FileCreation failed is an exception the flow will be > most likely at least a bit different. Continuing on and checking later does > not seem to make much sense most of the time. > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- Kevin Wright mail / gtalk / msn : [email protected] pulse / skype: kev.lee.wright twitter: @thecoda -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
