Re: Multiple returns vs. Single exit
Peter Booth <[email protected]> Sun, 30 Dec 2007 23:44:45 -0500
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
Almost always coding standards seem to waste much more time than they
save. The most effective "standard" I have seen wasn't a standard.
Instead of a tedious dry document that describes "this is what we
expect our coders to do" we simply named a single (large) component as
our "Gold Standard that illustrates how we do stuff around here"
Alternately you could frame a sheet of paper that simply says
"Don't write shit code!"
Peter Booth
Ralph Waldo Emerson (1803–1882)
QUOTATION: A foolish consistency is the hobgoblin of little minds,
adored by little statesmen and philosophers and divines.
On Dec 28, 2007, at 3:50 PM, Mark Gorokhov wrote:
> Throwing exceptions is OK, but "continue" is discouraged.
>
> Mark G.
>
> -----Original Message-----
> From: Discussion of advanced Java topics.
> [mailto:[email protected]] On Behalf Of Mann, Ivan H
> Sent: Friday, December 28, 2007 3:44 PM
> To: [email protected]
> Subject: Re: [ADVANCED-JAVA] Multiple returns vs. Single exit
>
> These standards remind me of the COBOL programmer I knew who read a
> "coding standard" that constants should not be used in code. What
> this
> meant was that a value used (for example) to indicate a tab location
> should be used in a variable so that if the value were to change you
> could change it in one place rather than have to look for all the
> locations that used "5" and decide if they were tab stops or not.
>
> Instead of understanding this, he sat down and punched up a deck of
> cards (this is an old story) like this:
>
> Set one to 1.
> Set two to 2.
> Set three to 3.
>
> and so forth, up to 200. Then, he duplicated this deck and put it
> into
> every program he wrote and instead of using "5" to indicate the
> tabstop
> he used "five". If he ever needed a constant outside of his range, he
> punched a new card and added it to the standard deck he carried
> around.
>
> What he wound up with was harder to read than the original and no
> easier
> to maintain. Each program took about a foot more space in the card
> drawers (like I said, an old story) and took noticably more time to
> compile.
>
>
> A question: did the person who created this standard also forbid
> throwing exceptions? One of the reasons exceptions were put into
> programming languages was to allow cleaner ways to exit from methods
> under error conditions. Just curious.
>
> Ivan Mann
>
> ===================================
> This list is hosted by DevelopMentor(r) 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
>
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com