Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Other folks' VFP code
Message
De
22/07/2006 19:00:51
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01138495
Message ID:
01138847
Vues:
12
>>>>IMHO I think that some succinct code is harder to read then more long-winded, e.g complicated IIF() instead of If .. ELse ... Endif, the use of !EOF() instead of Not EOF(), abbrev. of VFP commands, petty savings in typing (esp. as one can use global replace for these expressions later - as I often do to othe3r's code to make it readable), using crap short meaningless var names, bad indentation and, worst of all, momnolithic code with 20-page-long Do while loops with several inside them and nested Ifs to boot.
>>>>
>>>>Personally speaking, IMHO, I think that I have the neatest, most readable, well laid-out code of anyone's I've ever read, and I take great care to make it so.
>>>>
>>>>But maybe it's only MY mental map that sees it that way.
>>>>
>>>Show some small pieces and make sure you have a thick screen in front of you <g>
>>Well just the latest bit I'm working on for example. BTW I mean In My Humble Opinion, not "Honest" when I write IMHO
>>
>>
>>LOCAL	ldStartCurr, ldEndCurr, ldStartPrev, ldEndPrev, ;
>>	lnPercDiff, lnSchTDiff, lnSchemTot2, lnSchemTot1, ;
>>	lnTotCurrPass, lnTotPrevPass, lnNotEPrevMult, lnNotECurrMult
>>		
>>With Thisform
>>  If not .lReportCompiled
>>      .lmCompileReport()
>>      Select csrStep2
>>      Sum Trips2, Trips1, CurrPass, PrevPass;
>>	to lnSchemTot2, lnSchemTot1, lnTotCurrPass, lnTotPrevPass  && Used in report calcs
>>      lnNotEPrevMult  = lnSchemTot1 / lnTotPrevPass		    && Avge ETM multipliers used on notETM
>>      lnNotECurrMult  = lnSchemTot2 / lnTotCurrPass
>>      IF  ABS( lnSchemTot1)  > 0 ;
>>      AND ABS( lnSchemTot2)  > 0 then
>>	  lnOverallPercChg	= lnSchemTot2  /  lnSchemTot1 - 1	    && Used in report calcs
>>      EndIf
>>      Locate
>>      .lmRptNoMults()
>>  EndIf
>>  ldStartCurr	= .dStartDate1
>>  ldEndCurr	= .dEndDate1
>>  ldStartPrev	= .dStartDate2
>>  ldEndPrev	= .dEndDate2
>>  lnPercDiff	= .nPercDiff
>>  lnPercDiff	= 1 + lnPercDiff/ 100
>>  lnSchTDiff	= .nSchemeTrendDiff
>>  lnSchTDiff	= 1 + lnSchTDiff/ 100
>>  .Visible	= .F.
>>
>>  Report Form rptCompTrips PREVIEW
>>
>>  Select csrMultless
>>  Report Form rptNoMults PREVIEW
>>  .Visible	= .T.
>>EndWith
>>
>>
>>or
>>
>>Insert into RZSTOP ( RTE_NO,   RTE_LET,   DIRECTN,    NUMBER, ZONE, ;
>>      		   STOP,                    COUNTY,                 FLAGS,   SEQNO ) ;
>>  VALUES           ( lcRoute,  lcGen,     lcDirectn, 	I,     VAL(.aReorderStops( I, 1)),	;
>>	            .aReorderStops( I, 3),	.aReorderStops( I, 6),  lcFlag,   1 )
>>
>>
>>
>>Sorry, Naomi but when you post some stuff your indentation and such makes it hard to read it. I know the UT imposes its own tabs on what one's written but I always redo it in the UT window
>
>Hmm, the code is fine as is, though I would use m. everywhere (don't want to start flame war <g>). The methods names, though, not very much explanatory, in my opinion. What does lm before lmCompileReport mean?
>
>As for indentation, I always run my code through Beatify program...

"lm" is one of my conventions, meaning "Local Method", indicating it's a "home-made", "UDF", method as opposed to one inherited fom the class Class methods are prefixed with "cm" for "Class Method").

As for the rest of the name, I should think "CompileReport()" was pretty self-exp, and ".lmRptNoMults" is "report No Multipliers", which you'd know if you knew the purpose of the form anyway, and matches its cursor's targer report: rptNoMults
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform