Multiple returns vs. Single exit
Mark Gorokhov <[email protected]> Fri, 28 Dec 2007 14:52:23 -0500
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <6BD989BB73712F41B1EDD1B8A32EA4C3087E33BC@EXCHANGEVS1.comtechtel.com> |
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