Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strong vs weak typing
Message
From
17/03/2005 10:22:37
Walter Meester
HoogkarspelNetherlands
 
 
To
17/03/2005 08:55:20
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00996662
Message ID:
00996795
Views:
35
Hi Sylvain,

>Weak typing may be more "developper friendly", but certainly not more "tester friendly" as any tester will tell you that runtime errors are the worst kind of bugs to locate. That force even more the rule of testing every line of code (coverage testing) because a piece of code somewhere buried deep in the code that execute maybe once in 1 million iterations set a variable to a character type and that same variabe will be used in an arithmetic operation later on.

Any developer will be able to screw up things, no matter using strong or weak typing. To be honest I find your example a rather weak one. How many percent of bugs are really rooted in this matter? I very much doubt it is significant. When using naming conventions for your variables you should avoid this problem at all times. In my VFP code, I rarely encounter problems related to this matter.

With the proposed enhancements for VFP10, at least the IDE will give you hints whether a variable is declared at the top of the code. The compiler switch will warn you because you when you did not declare a variable. It does not change weak typing into strong typing, but at least gives you additional tools to gain important advantages of strong typing. You could even add more intelligence to allow type checking when writing the code. If a variable 'x' is declared as beeing string and you somewhere are doing a STR(x), the editor could mark this as beeing a doubtfull statement (red line beneath the statement ?). To be honest, IMO a far better way of early catching bugs than to wait until compile time. You don't know how many times I've cursed strong typing when writing a scalar expression parser as part of graduation project in C++ on a 386 16-mhz machine, just erroring because I did not cast a WORD, INT, DWORD, LONG, UNSIGNED LONG etc.

Again, the point is, that we might have to rethink that strong typing has benifits to the developer. It might well be that additional intelligence in the IDE could have the same benefits without giving up the comfort of weak typing.


Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform