Re: Looking for a way to convert dec to bin
- From: "Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Mar 2007 00:15:47 -0500
I know you're not a .net fan but with a try catch it can be done very
cleanly, eg:
dim x as new connection
x.open "Blah"
try
'do stuff including exit sub
finally
x.close
end try
Yes, there are distinct advantages to some of .NET's stuff, I don't deny it.
My main objections to .NET are more to do with the lack of real upgrade path
from VB6 and the fact that it's often produces fairly sluggish code. The
language changes themselves I actually like, for the most part...but I tend
to side more with the VFred camp, who see it as a new language that
should've been called something else in the same way that Delphi wasn't
called Pascal.
We've already had several examples that were much cleaner with exit for,
here's one:
For each Customer in Customers
If Customer.Name = "Tanya" then exit for
Next
If Customer Is Something then
'DoStuffToCustomer
End if
This is a fundamental disagreement between us then. When I see a For Next
or For Each loop, I see something that I expect to run from start to finish.
When I see a Do or While loop, I see something that I expect to finish
conditionally (ideally with all conditions in the loop, or if not, a
loop-ending condition). While the For loop you've shown may be shorter, and
at the three-line level, might be easier to read (still debatable to my
mind), in a larger loop, if I'm skimming and I see "For Each Customer" then
I want to see something that iterates...well...for each customer. It's not
"clean" to my way of thinking.
But in any event, we're really just talking about stylistic differences. As
long as others can reasonably understand your code, the choice of whether to
use a loop that's a couple of lines shorter or longer, or to "convert from
dec to bin" in 20 lines or 5 or 1 is truly irrelevant (though even Rick
agreed that the one-liner was NOT reasonably understandable <g>). About the
only thing this rather long-winded debate has truly done is to establish
that we're all long-time programmers, each with our own skills and our own
ways of doing things. The rest is just semantics (literally, come to think
of it).
Rob
.
- Follow-Ups:
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- References:
- Looking for a way to convert dec to bin
- From: Kardon Coupé
- Re: Looking for a way to convert dec to bin
- From: Kardon Coupé
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Jeff Johnson
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: J French
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Larry Serflaten
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Re: Looking for a way to convert dec to bin
- From: Robert Morley
- Re: Looking for a way to convert dec to bin
- From: Michael C
- Looking for a way to convert dec to bin
- Prev by Date: Re: Looking for a way to convert dec to bin
- Next by Date: Re: Looking for a way to convert dec to bin
- Previous by thread: Re: Looking for a way to convert dec to bin
- Next by thread: Re: Looking for a way to convert dec to bin
- Index(es):
Relevant Pages
|