Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
10 types of people
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00836301
Message ID:
00838753
Views:
29
Hi Peter,

>Here's a hilarious experience I just had a few minutes ago. And it's TRUE, I do not make it up!
>
>I did:
>
select distinct ttod( a.from ) from ( lcFile ) into array laTmp
>
>Since the table currently only has values 10-10-2003, this should have given:
>
laTmp[1]  "10-10-2003"
>but it gave:
>
laTmp[1]  "02-02-2003"
>I did a lot of debugging, couldn't explain what was happening and we thought with a laughter "well, maybe it's an easter egg, translating bin 10 to dec 02". :)
>
>In fact, what was the cause?! I forgot to specify the a behind lcFile. And there was a similar table open in workarea a! The record over there indeed had 02-02-2003.
>
>We have had a really good laugh! :))

I'm replying to this one, after reading all the other messages in this thread. I'm doing this because I want to reference to the original 'bug'
I'm not going to argue about if the A-K&M references could create false results in the SQL-SELECT itself (if it is constructed the way it should).

My point is:
If you would have used something else instead of A-K&M in your example, the SQL Select would have given you an error that the SQL Column was not found in your datasession. You would have seen the error straight away and you would also deduct very quickly what the problem was. (I'm assuming that the Alias in SQL-SELECT for lcFile would never be an Alias of another workarea.)

Instead you had to do: "I did a lot of debugging, couldn't explain what was happening and we thought with a laughter "well, maybe it's an easter egg, translating bin 10 to dec 02". :)"

So for me it is good practice to not use the A-K&M because you could get into a situation where everything seems okay and it isn't. To quote myself: "Simply because something runs, doesn't automaticly mean it is okay"

After you've been through this ordeal once, do you REALLY want to get into that situation again? Using SQL-Select aliases, that are not A-K&M (or W11, W12, W13 etc) or a possible 'real' alias name, will give you (almost) instant feedback on that error.

For me it's about productivity, nobody want to debug ocscure bugs, so if certain 'Good Practices' can reduce the chance of having to debug to solve an obscure bugs, that is 'good' enough for me.

Regards,
Frank Camp
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform