Re: Multiple returns vs. Single exit

Jeff Kesselman <[email protected]> Fri, 28 Dec 2007 16:02:03 -0500
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
I aught to add though that I am not in favor in general of such tight
coding rules as your team seems to be using.  I believe fundamentally
that coding is art and you shoudl hire good artists and allow them their
own style.

There are sometime a few things you want to mark as "usually harmful",
especially with young engineers.  A good example came when I came in to
run a shop that was doing CD-I work. CD-I was inherently multi-threaded
with a  minimum of three different time bases in the machine at once.
(the 60hz tick of the screen, DMA rate of the data streamign off the
drive, and the CPUs own click tick.)  Not understanding multi-threading,
they had gotten into the very nasty habit of throwing sleep()  at race
conditions to "fix" them.  I outlawed that in the shop.  (This was C++
code under a version of OS/9, not Java, where waiting has some
legitimate use.)



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