Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Visual FreePro -- New structured flow
Message
 
 
À
25/10/2013 10:56:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01585957
Message ID:
01586413
Vues:
68
I must admit I do not have this problem very often. But when it happens that I need to break out of a nested loop, it is really annoying to keep a separate variable for that, so I did wish sometimes to be able to FlyAway just like that.

OTOH you should try not adding features that are not really important, because it would create a steep learning curve if you have to learn all these commands, or something like feature creep. In this case it is a border case in my opinion, a nice have and easy to use, but not a real need. I would use it if it were there, but I would not miss it very much either if it wasn't.

>A user on Foxite posted a response regarding the necessity of using structured programming. I propose that what I have created with the new FLOWER command is a new type of structured programming. It is non-linear, but it is still structured.
>
>Below is the message cross-posted from Foxite:
>
>-----
>> [Reponse from the other user:]
>> There is never any need for a GOTO if you know how to do structured design.
>
>[My response:]
>Consider the following code blocks:
>
>
**********
>* Using the FLOWER block with the FLYAWAY instruction
>*****
>    01: FLOWER
>    02:    SELECT myTable
>    03:    SCAN
>    04:        FOR lnI = 1 TO 10
>    05:            IF someTestOnThisData(lnI)
>    06:                 WAIT WINDOW "It was found!"
>    07:                 FLYAWAY
>    08:            ENDIF
>    09:        NEXT
>    10:    ENDSCAN
>    11:    WAIT WINDOW "Sorry, Charlie!"
>    12: ENDFLOWER
>    13: * Control continues beyond here
>    -----
>    Assuming going through the FOR loop twice, 12 steps:
>    01, 02, 03, 04, 05, 08, 09, 04, 05, 06, 07, 13
>
>    * 12 steps, and the functional code (the "WAIT WINDOW" commands) is
>    * nested inside the program and must be sought after.
>
>
>**********
>* The correct STRUCTURED PROGRAMMING code is... 
>*****
>    01: llFound = .F.
>    02: SELECT myTable
>    03: GO TOP
>    04: DO WHILE (A) NOT EOF() AND (B) NOT llFound
>    05:     lnI = 1
>    06:     DO WHILE NOT (A) llFound AND (B) lnI <= 10
>    07:         IF someTestOnThisData(lnI)
>    08:             WAIT WINDOW "It was found!" NOWAIT
>    09:             llFound = .T.
>    10:         ENDIF
>    11:         lnI = lnI+1
>    12:     ENDDO
>    13:     IF NOT llFound THEN
>    14:         SKIP
>    15:     ENDIF
>    16: ENDDO
>    17: IF NOT llFound
>    18:     WAIT WINDOW "Sorry, Charlie!"
>    19: ENDIF
>    20: * Control continues beyond here
>    -----
>    Assuming going through the FOR loop twice, 29 steps:
>    01, 02, 03, 04a, 04b, 05, 06a, 06b, 07, 10, 11, 12, 06a, 06b, 07, 08, 09, 10, 11, 12, 06a, 13, 15, 16, 04a, 04b, 17, 19, 20
>
>    * And also the functional code is nested inside the program and must
>    * be sought after.
>
>
>**********
>* Extending the FLOWER block to use PETALs and the FLYTO instruction:
>*****
>    01: FLOWER
>    02:    SELECT myTable
>    03:    SCAN
>    04:        FOR lnI = 1 TO 10
>    05:            IF someTestOnThisData(lnI)
>    06:                 FLYTO foundIt
>    07:            ENDIF
>    08:        NEXT
>    09:    ENDSCAN
>    10:    FLYTO notFound
>    11:
>    12:
>    13: PETAL foundIt
>    14:     WAIT WINDOW "It was found!"
>    15:
>    16: PETAL notFound
>    17:     WAIT WINDOW "Sorry, Charlie!"
>    18:
>    19: ENDFLOWER
>    20: * Control continues beyond here
>    -----
>    Assuming going through the FOR loop twice, 12 steps:
>    01, 02, 03, 04, 05, 07, 08, 04, 05, 06, 14, 20
>
>    * This style has the advantage of moving the code related to logic conditions
>    * outside of the nested areas they would otherwise appear, simultaneously documenting
>    * (as per the use of the "foundIt" and "notFound" names) what operation takes place
>    * there, while also documenting the explicit operations at the end of the FLOWER.
>    * This creates a way to provide more easy to follow logical flow to a program, while
>    * doing a better job of automatically documenting it.
>
>
>
>> If you insist on continuing along this route, you will have ruined a potentially
>> great product. For me, it will be useless.
>
>No one will force a developer to use Visual FreePro. I am offering unto the world the fullest portion of what the Lord has given me in terms of abilities, skills, talents, and vision. I am doing the best I can toward achieving these ends, and I leave it to others to apply atop my offering their unique and special talents and abilities so as to create the product the Lord had intended, as He wants all of us to work together for the betterment of all.
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform