Thread: Gnutella Code
View Single Post
  #6 (permalink)  
Old February 20th, 2002
GregorK GregorK is offline
Phex Developer
 
Join Date: May 9th, 2001
Location: Stuttgart, Germany
Posts: 988
GregorK is flying high
Default

The code is some times nested up to 8 levels or maybe more. In almost every style guide you will read that you should not use more then 3 or maybe 4 levels. Instead try to use sub method calls. This makes things much easier to read and understand.

Also you can sometimes limit nesting with reversing the condition.

Instead of saying:

If example = True Then
If example2 = True Then
...... VERY LONG CODE LIST.....
end if
end if

you can say:

If example = False Then
return
end if
If example2 = False Then
return
end if
...... VERY LONG CODE LIST.....


Don't know the exact syntax but I hope you understand my intention.
Reply With Quote