Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code Standards
Message
De
01/10/2003 07:27:56
 
 
À
30/09/2003 20:41:36
Information générale
Forum:
Visual FoxPro
Catégorie:
COMCodebook
Titre:
Divers
Thread ID:
00832733
Message ID:
00833758
Vues:
28
>>Well, I do indeed take that time and effort. And when the longest variable is removed, then I also take the time and effort to shrink the rest. No problem for me and it should be no problem for anybody else.
>
>Again, a matter of preference.

Another wording for 'personal preferences' might be 'personal standards'. I think that the originator of this thread was not so much interested in our personal standards. When I suggest to use what you might call 'Variable Declaration Alignment' (do you have a better wording for this?), then I'm talking about the superb world-wide standard for vfp-developers.
*  Least readable
lnMyNum=12
lcMyString="ABCD"
lnCounter=0

*  Slightly better
lnMyNum = 12
lcMyString = "ABCD"
lnCounter = 0

*  'Variable Declaration Alignment'
lnMyNum    = 12
lcMyString = "ABCD"
lnCounter  = 0
The justification is that it is far easier to read and thus it will reduce the number of bugs.

A professional developer must realize that there are, or may be, other developers who have to deal with the code now, or in the future. A personal standard is just not good enough!


>>Yes, sorry. I guess we need an additional debate over the (dis)advantages of having the + at the beginning or at the end.
>
>It's easier to recognize that the line is a continuation of the previous line.

This is a valid reason, and it's consistent with the use of operators like OR and AND at the beginning of a continuation line. But how about the next example?
lcMsg = ;
   "This is line 1." + ccCRLF + ;
   "This is line 2."

lcMsg = ;
   "This is line 1." + ccCRLF ;
   + "This is line 2."
Personally, I think that the first declaration is more readable. And readability is also a factor.


>>In the old days? Okay. But these days, with code-coloring I think it does not hold true.
>
>Not necessarily when printing the code.
>
>>There are many situations where it's the comment to the right that makes reading far easier, like...
>>
>>private gcSystem	&& Name of the app
>>private gcMaintitle	&& Appname + version
>>private gcAppDir	&& Directory containing highest level prog
>>private gcPriv	&& User privilege string
>>private gcDataDir	&& Data root directory
>
>Ahhh...but you see, if the variable is self describing, you don't need the comment.

Come on, Craig, that's no counter-argument :).


>>Do you have a reference to these Windows standards? In VFP, the default for thisform.SelectOnEntry is False. Anyway, I only wanted to make clear that some standards are about how to program and others are about what to program. But of course, both need standardization.
>
>VFP violates the Windows standards in several places. Windows guidelines are at http://msdn.microsoft.com/library/en-us/dnwue/html/welcome.asp?frame=true

Thanks!
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform