Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crap code
Message
From
15/04/2021 16:41:38
Walter Meester
HoogkarspelNetherlands
 
 
To
15/04/2021 16:20:40
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01679827
Message ID:
01679829
Views:
90
>Yet another FoxPro 'genius-built' system I inherited. The original developer never upgraded to 9.
>
>Interesting problem today. One of the team added a few lines of code to a procedure. Could not compile because it hit the VFP6 64K limit. Who the hell writes a single procedure that big?
>
>So we had to spend time breaking this piece of crap up into smaller bits of crap. Wanna bet I can reduce the compile size by writing the code in a far more modern style? Removing added but unnecessary select-the-scan-alias before an endscan, etc, etc, etc. Lots and lots of bad habits that this genius, like so many others, have no idea how to do better.
>
>One "genius" who ended up screaming at me for being a showoff wrote the stupidest code. He wanted to show a certain amount of text and 3 dots at the end in a grid column. He wanted the dots to move as the column width expanded. He spent 2 weeks working on this. I did a better job of it in 10 minutes.
>
>Another place the owner asked me to come over to see his system. A few tweaks here and there, running like a shot. Other genius programmer shows up and starts screaming at us.
>
>Another place the owner's nephew wrote code that took 10 hours. The owner had to ask him to ask me how to speed it up. Again, a "genius". I got it down to 10 minutes easily. That jerk spent the rest of my time there being an a$$.
>
>Long ago - I helped a co-worker that was crying because her code ran all night. I asked her what she was trying to do. Within 30 minutes, new code and finished results. That's when I met the Other Jim Nelson. After telling me I should have focused on my work, not hers, they asked how I did that and I spent several weeks giving lessons during lunch.
>
>I post tips for my current team regularly, such as the following. They don't get weepy about it like some people.
>
>The way FoxPro thinks is often not understood. It's not low-level like C. Every command is interpreted. If there are 20 records, this code will require 84 steps.
>
			GO top
>			SCAN
>				IF wScanForEndOfDay = 1
>					replace ScanGrL.OutForEOD WITH 0
>				endif
>				wMessBody = wMessBody + CHR(13) + ALLTRIM(STR(ScanGrL.OrdNmb))
>			ENDSCAN
>			wnAnswer = MESSAGEBOX(wMessBody, 4 + 32 + 256, goApp.cCaption)
>
>This code will take a lot less time to step through in the debugger. The number of interpretations of the lines of code are way less. 26 steps.
>
			IF wScanForEndOfDay = 1
>				REPLACE ScanGrL.OutForEOD WITH 0 for ScanGrL.OutForEOD<>0
>			endif
>			SCAN
>				wMessBody = wMessBody + CHR(13) + ALLTRIM(STR(ScanGrL.OrdNmb))
>			ENDSCAN
>			wnAnswer = MESSAGEBOX(wMessBody, 4 + 32 + 256, goApp.cCaption)
>
>I'm sick and tired of getting grief from fake geniuses, much less security guards. I am doing the best I can and giving the best advice I can. Keep up, smarten up or shut up.

Your code will break with a field name "wmessbody" in the current work area. You need to use mdot.
:)
Previous
Reply
Map
View

Click here to load this message in the networking platform