Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MESSAGEBOX
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00365597
Message ID:
00366123
Views:
26
>>Ah, comments! I've mentioned before that I had a professor who returned one of my assignments with the note: "Don't comment the obvious". If the code is self-documenting, then the need for comments is greatly reduced. And that's been one of my points here. The use of defined constants helps make your code self-documenting.

Paul,

>
> The one problem I've always had with that idea is that some (actually, a lot, from the code I've seen) of programmers thing that all their code is obvious and easy to read. Not so. A one line comment along with some spacing to group logical sections of code goes a long way.

One of my hang-ups is the spacing. I got spoiled by the QuickBASIC editor which would take a=b+c and make it a = b + c. The same would be applied to x=MyFunc(parm1,parm2) and it would become x = MyFunc(parm1, parm2). The insertion of the spaces is carried over into the VB editor and I hope that we can look forward to VFP doing the same in the next version. Additionally, indentation is supposed to indicate the sub-ordination of a code block, either logical or iterative. So my individual CASE var = statements have the code below indented.

In general, the above helps as do meaningful variable names. I believe that the judicious use of define constants help as well. Certainly, none of us can know for absolutely sure how readability the next person is going to find the code. We should, therefore, do whatever we can to increase code readability.

Usually, I'll write the comments before I write the code. The comments represent the individual steps required for the method to do what it's supposed to. Often, the comments are documenting what other methods do as well.

> As far as using DEFINES, the one (really big) thing that bugs me about using them is the fact that you can't see their values in the debugger by hovering over them. Arg..I HATE having to search for the original header file, open it up and look for the real value of it.

As I said earlier, in my usage I don't really care what the value is. I care more about what it represents. To me, they represent abstractions of values, and which may change in the future, not values themselves.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform