Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crap code
Message
From
13/05/2021 02:24:27
Walter Meester
HoogkarspelNetherlands
 
 
To
12/05/2021 17:17:46
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01679827
Message ID:
01680350
Views:
63
I have had enough,

>It will not change as the scan runs. So why execute it once per row - something SQL Server people call RBAR - row by agonizing row?

And especially in SQL server can serve the purpose in creating switches in parameterized views, SQL functions and stored procedures. They can buy you great flexility while costing almost nothing. I've build and optimized a ton of them. I know what I'm talking about.


> I don't behave like a Nazi and force people to use my preferred convention.
Yes you do. You've shown time after time again, you're a nazi by forcing YOUR preferences down everyones throat.

>I'm not interested in silly code cosmetics.
Yes, you have made entirely clear why are not considered a good developer.

>it is included in the loop which is wasteful
You're deluded. Your example is designed for small numbers. Your savings would not be even measurable in VFP.

>
		IF m.wScanForEndOfDay = 1
>				REPLACE OutForEOD WITH 0 for OutForEOD<>0 in ScanGrL
>			endif
>			SCAN
>				wMessBody = m.wMessBody + CHR(13) + ALLTRIM(STR(OrdNmb))
>			ENDSCAN
>			wnAnswer = MESSAGEBOX(m.wMessBody, 4 + 32 + 256, m.goApp.cCaption)
>
>The last point is why is an application object holding a caption? That is not even close to proper scope.

You are so full of yourself you don't see that you are not delivering the claims you do.
The two pieces of code are not equivalent and they not even share the same performance characteristics.

Apart from less readable. There are two things that might be causing your solution to be SLOWER.

1. You are now scanning through the table TWICE. Depending on where the table lives, and the oplocking mode of the file handle it might drag down the records from the network TWICE. Wasting a lot more CPU and I/O than you save.

2. The replace all places a file lock on the table and when a large table, can cause concurrency issues locking your whole application up and that of others.

Mike, you are the one delivering CRAP code. You are the one suffering from DUNNING KRUGER. Your advice should be taken with a whole lot of grains of salt as you clearly do not posses the in depth knowledge to claim what you do. Any one who thinks he can save a few CPU cycles without even a solid understanding of the underlying consequences of the changes should not brag about how great they are.

And you are accusing others for being fake experts, even if they do not even claim to be.

Sad, mike, sad...
Previous
Reply
Map
View

Click here to load this message in the networking platform