Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Method names suggestion
Message
 
 
À
15/03/2013 10:00:18
Thomas Ganss (En ligne)
Main Trend
Frankfurt, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01568344
Message ID:
01568500
Vues:
54
>Disagree. If that is ***really*** your only aim, combine Rick's and Mike's approaches by building a stack of recordpointersaver classes on the cursor, for instance in an array property or a linked list anchored to a property. Benefits: as each cursor has its own stack, always combination between cursor an "last pushed" recno always clear. Further benefit: as you have a data structure that can grow, you are able to handle multiple set/reset occurrences on the same cursor, like multiple scan loops, if your code calls for it.
>
>In theory you could go a step further by creating a custom "scanbehavior" class, where pre- and post hooks have standard behaviour like you describe (overwriteble of course) and the .Init is given the filter parameter. You would only have to code in a method the "inside" of the scan loop, as the basic pattern is handled via template pattern, and could call such an object via single method call on your cursor. But only because it is possible does not mean you HAVE to do it or that a new programmer would instantly understand such code ;-)
>And it would feel to me like using a pattern made for another language, which even there would border on overarchitecturing - but tastes differ. Basic coding for such stuff is fast, if you settle mentally on a pattern and have already thought about most directions you later need to enhance it. Code gets shorter, but is much harder to follow when editing. If vfp allowed function pointers, adding methods to the cursor and passing them might be less mental gymnastics...

That is certainly a good idea, because it creates more flexibility and at the same time would be a good design. The first time I read your post I was not in favor of this approach, thinking it's too complicated. The problem I initally had with your solution was, that the real task at this moment was to solve the issue of "Original Record > Scan > Go Back to Original Record". I would feel like solving a problem that I do not have, and also over designing. Although regarding overdesigning, I am amazed what tricks you can teach the old fox. I tend to implement strategies I learned from C# in our VFP application, and often the VFP implementation is even more effective, since VFP is a more flexible language.
Now that you bring up the idea of the stack, I start to recall some methods where I really was in need of a stack, by going inside of a SCAN to a different record etc, which can be quite ugly. In this case my simple solution would fail, so thanks for this idea!
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform