[AccessD] Learning .Net -- PHP Instead?

Rocky Smolin rockysmolin at bchacc.com
Fri Jun 26 08:41:39 CDT 2009


If the steps are coded as subs or functions then you don't have to repeat
the Step code - just call the sub or function.  Making the original example
pretty clear.  Especially if the functions or subs are titled something
description and/or a few comments are inserted into the code. (Comments??!!
Gasp!)

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Thursday, June 25, 2009 12:14 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Learning .Net -- PHP Instead?

Hi Drew

This is a splendid example to demonstrate why _not_ to use GoTo. You have to
read you simple example several times to get an idea what is may do. But
only an idea.

The first variant is much easier if you rewrite it properly:

Step 1
If Not SomeCondition Then
	Step 1
End if
Step 2
If Not Another Contition Then
	Step 2
End if
Step 3
If Not FinalCondition Then
	Step 1
	Step 2
	Step 3
End if
Step 4

This you can grasp by reading it once and you don't even need to know what
the Step 1-4 are.

/gustav


>>> DWUTKA at marlow.com 25-06-2009 00:15 >>>
I am going to replace 'a bunch of code' with Step X.

Which is easier to follow?:

Step 1
If SomeCondition Then
	Step 2
Else
	Step 1
	Step 2
End if
If Another Contition Then
	Step 3
Else
	Step 2
	Step 3
End if
If FinalCondition Then
	Step 4
Else
	Step 1
	Step 2
	Step 3
	Step 4
End if

OR

Step1:
Step 1
If SomeCondition Then Goto Step1
Step2:
Step 2
If Not Another Condition Then Goto Step2
Step3:
Step 3
If Not FinalCondition Then Goto Step1
Step4:
Step 4

Which is cleaner?  The first method could have you repeating code over and
over, the second method has the code once, and simple (and what should be
well labeled) 'jump points' to make complex 'logic' simpler.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, June 24, 2009 4:47 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Learning .Net -- PHP Instead?

What's wrong with

Do
    ... initial code here....
    If <condition1> then  'else goto loop
           ...more code here....
           If  <condition2>  then   'else goto loop  
                  ...more code here...
           End If
    End if
Loop

Again, the indentation from the IF...End IF makes the code much easier to
follow that a flat sequence with a series of GOTOs hidden throughout.


-- 
Stuart


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list