I have a major AWS EC2 B4J app that processes videos and does a lot of AWS S3 to and froing.
The principal procedure has 16 major steps each one involving a Wait For and currently totals about 5000 lines (including inline documentation) - something like:
======================
Private Sub Principal_sub
...
step1 (contains Wait For)
...
step2 (contains Wait For)
...
...
step16 (contains Wait For)
...
End Sub
======================
Each step must be completed (i.e. its Wait For fired) before the next step can start.
I'm at the point of tidy-up and would like to break each step out into separate Subs - something like:
======================
Private Sub Principal_sub
...
STEP1
...
STEP2
...
...
STEP16
...
End Sub
Private Sub STEP1
...
Wait For ...
...
End Sub
Private Sub STEP2
...
Wait For ...
...
End Sub
...
...
Private Sub STEP16
...
Wait For ...
...
End Sub
======================
This model doesn't work because Sub STEPx returns as soon as its Wait For is reached.
I can see how I could do this by having 1 step call the next - something like:
======================
Private Sub Principal_sub
...
STEP1
...
End Sub
Private Sub STEP1
...
Wait For ...
...
STEP2
End Sub
Private Sub STEP2
...
Wait For ...
...
STEP3
End Sub
...
...
Private Sub STEP16
...
Wait For ...
...
End Sub
======================
but this sort of defeats the purpose of separate subs - i.e to simplify the code structure.
Any thoughts?
The principal procedure has 16 major steps each one involving a Wait For and currently totals about 5000 lines (including inline documentation) - something like:
======================
Private Sub Principal_sub
...
step1 (contains Wait For)
...
step2 (contains Wait For)
...
...
step16 (contains Wait For)
...
End Sub
======================
Each step must be completed (i.e. its Wait For fired) before the next step can start.
I'm at the point of tidy-up and would like to break each step out into separate Subs - something like:
======================
Private Sub Principal_sub
...
STEP1
...
STEP2
...
...
STEP16
...
End Sub
Private Sub STEP1
...
Wait For ...
...
End Sub
Private Sub STEP2
...
Wait For ...
...
End Sub
...
...
Private Sub STEP16
...
Wait For ...
...
End Sub
======================
This model doesn't work because Sub STEPx returns as soon as its Wait For is reached.
I can see how I could do this by having 1 step call the next - something like:
======================
Private Sub Principal_sub
...
STEP1
...
End Sub
Private Sub STEP1
...
Wait For ...
...
STEP2
End Sub
Private Sub STEP2
...
Wait For ...
...
STEP3
End Sub
...
...
Private Sub STEP16
...
Wait For ...
...
End Sub
======================
but this sort of defeats the purpose of separate subs - i.e to simplify the code structure.
Any thoughts?