Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming conventions for custom methods?
Message
 
 
To
17/11/2008 19:08:49
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01362229
Message ID:
01362439
Views:
29
>>>>No, it's not common. It's more common to use some kind of word that signals something about the return value, so your example would be UsesVCR() or HasVCR(). The word "Is" is often the first word in a method name for one that returns a logical.
>>>
>>>For methods returning some information about the parameter passed, I've found I began to like the IsA...() notation that the Feltmans use. IsA(toObj, tcClass) simply returns .f. if the second parameter is not among first parameter's class or one of parent's classes.
>>
>>This all becomes a lot simpler in a strongly typed language. The compiler won't even let you try to pass a parameter of the wrong type.
>
>How strong do you want it? And, are you sure this is good?
>
>In this case, the parameter is an object - that's its type. Now if your smart compiler is too smart, it won't let you pass an object of wrong class (aside the question of how would it know) or of wrong base class. Then you'd have to apply some VB6 inheritance and overload the method for each class to which it may apply. Bad dreams of maintenance.

PS -- I don't think I would ever want a parameter of type Object. That's way too general. You can always overload a method to have the same name and different parameter type(s).

Also, yet another question -- what do you mean by "overload the method for each class to which it may apply"? A method belongs to one and only one class, doesn't it?

I am immersed in C#, maybe to the point that I am seeing things in C# terms when that isn't really appropriate.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform