Re: Looking for a way to convert dec to bin

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • RE: loops
    ... I have the following piece of code which checks the customer and product ... I have now realised that I need to enter a qty for price breaks so the loop ... Loop While Not C Is Nothing And C.Address firstAddress ...
    (microsoft.public.excel.programming)
  • RE: loops
    ... I have the following piece of code which checks the customer and product ... I have now realised that I need to enter a qty for price breaks so the loop ... Loop While Not C Is Nothing And C.Address firstAddress ...
    (microsoft.public.excel.programming)
  • RE: do until
    ... loop can go to the next record otherwise it keeps looping through the first ... I have a table called ACH that I search for a customer id and find out ... if that customer has passthru, ... Set rsCustomer = dbType.OpenRecordset("Customer", ...
    (microsoft.public.access.modulesdaovba)
  • Re: Two quick RS-485 questions
    ... > plan to stick an RS485 driver on an AVR, ... proper 'driver' at the TX side while all receivers are merely cheap ... > I and the customer have metric truckloads of the stuff lying about. ... With 2400 bps and a current loop you could even use fence wire. ...
    (comp.arch.embedded)
  • Re: Looking for a way to convert dec to bin
    ... When I see a Do or While loop, I see something that I expect to ... While the For loop you've shown may be shorter, ... my mind), in a larger loop, if I'm skimming and I see "For Each Customer" ... That's really just your expectation. ...
    (microsoft.public.vb.general.discussion)