Re: Multiple returns vs. Single exit

Jeff Kesselman <[email protected]> Fri, 28 Dec 2007 15:57:08 -0500
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
The problem with absolute coding standards is the same exact problem
there is with beaurcacricies and all 'one size fits all" solutions.

One size *doesn't* fit all cases.

The best solution to this I think I've seen is a very old one, but one
that I intend to bring back in if I ever run such a development team
again.  Thats the alibi book.

In this variation you have a standard, but you recognize that sometimes
there are exceptional cases.  In those cases the engineer is required to
make a notation of the exception they are making, why they are making
it, and the date and time it was made in some form of standard
documentation.

Some modern forms could be either a standard in-line for for alibi
comments or a Wiki page.  Part of making it work correctly though is
that it should be just enough of a  pain in the butt that the engineer
has to decide if she really feels its worth the extra effort.








Mark Gorokhov wrote:
> Our company has a coding standard which prohibits multiple returns from
> a method. I think that mandating to use a single exit from a method
> makes code less readable but I have to follow this standard.
>
> It seems to me that there is no agreement on this. Search returns many
> entries.
>
> Vote for multiple returns:
> http://ivan.truemesh.com/archives/000611.html
> http://peripateticaxiom.blogspot.com/2006/03/functional-style-and-multip
> le-returns.html
> http://mail.python.org/pipermail/tutor/2004-December/034134.html
> http://www.javapractices.com/topic/TopicAction.do?Id=114
>
> Vote for a single exit:
> http://jroller.com/fra3k/entry/code_improvement_guidelines
> http://www.extragroup.de/weblog/hmk/archives/002997.html
> http://www.extragroup.de/weblog/hmk/archives/002999.html
> http://whatimean.wordpress.com/2007/02/08/multiple-return-points-are-bad
>
>
> History & discussions:
> http://osdir.com/ml/programming.language-of-the-year/2005-01/msg00043.ht
> ml
> http://www.codecomments.com/archive205-2004-12-340086.html
> http://www.leepoint.net/JavaBasics/methods/method-commentary/methcom-30-
> multiple-return.html
> http://onthethought.blogspot.com/2004/12/multiple-return-statements.html
>
>
> This question is definitely not an advanced one but I'm interested in
> your opinion.
>
> Thanks
> Mark G.
>
> ===================================
> This list is hosted by DevelopMentor®  http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com