Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which Is More Readable To You?
Message
From
06/03/2008 23:43:13
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
06/03/2008 15:39:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01298471
Message ID:
01299615
Views:
12
>>>>>The topic is unresolvable if even the "experts" can't agree on it. We should be free to write our own way and we should be evolved enough to accept everyone's way. :)
>>>>
>>>>But you're the one who's always so big on programming being scientific, best practices, and such. Not that I'm against that, but it can also be applied to how code is formatted. I wouldn't want to go too far - you can allow some flexibility - but many things improve readability, understandability, and maintainability. I try to write code that works with the brain not against it. And this means making the code look like the English that we've read since childhood (sorry to all you non-native English speakers). So punctuation is like what we see in a book or magazine: spaces around operators, parenthesis next to the characters (no space after the parentesis), etc. Camel case to help reading MultiWordVariables. I tend to use lined up REPLACE statements like the one that started this thread, but more so when it gets big. With just 2 or three lines I tend not to worry about it, so I'm a bit inconsistent in that area, but the bigger the statement is, the more the lining up is
>>>>helpful. Anyway, you can't be a Nazi about it - as I believe you mentioned in one post - but enforcing some reasonable formatting standards helps greatly.
>>>
>>>Perhaps I should have said free to *format* anyway we want. There is no consensus. I agree with everything else you said.
>>>
>>>There should be commenting standards. As to coding practices, we should agree on things that have a physical effect.
>>>
>>>This is easier
SCAN
>>>  commands...
>>>ENDSCAN
>>>
>>>than this...
>>>
DO WHILE NOT EOF()
>>>commands...
>>>if alias()#"somealias"
>>>  select somealias
>>>endif
>>>if not eof()
>>>  skip
>>>endif
>>>ENDDO
>>>
>>>This will never crash...
>>>m.a = m.a + 1
>>DO WHILE .T.
>>m.a = m.a + 1
>>ENDDO
>
>ROFL! Using absolutes when discussing programming concepts is usually not a good idea - for me, at least, it's a red flag ...

Give me a break. Only computers are that literal. :) However, if I must be that specific...

m.a=10
m.a = m.a + 1

That will not crash IN FOXPRO, even if someone comes along and opens a table that has a non-numeric field called a before this code executes. The use of mdot has a physical effect. It's not just a style.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform