rbulph Posted January 8, 2008 Posted January 8, 2008 Is it good programming practice to declare a variable with the same name as the name of the class it belongs to? i.e. Dim Employee as Employee I suppose if you use a different name you can use the class name to get a drop down showing just the shared methods and properties, which is a small argument against doing this. Otherwise, are there any issues? Quote
MrPaul Posted January 9, 2008 Posted January 9, 2008 Possibly poor practice, but not significantly Personally I believe reusing a type name as a variable name isn't particularly good practice, as I feel it is possibly confusing without providing much, if any, benefit. This is supported by the fact that some languages will not allow variables to be declared in this way. However, I can think of many worse coding ills so wouldn't worry about it too much. Good luck. :cool: Quote Never trouble another for what you can do for yourself.
Leaders snarfblam Posted January 10, 2008 Leaders Posted January 10, 2008 Re: Possibly poor practice, but not significantly I'm not specifically for or against it, but I do find myself doing it once and a while when it seems to make sense. Since I usually code in C# the casing is different and technically there is no ambiguity. Quote [sIGPIC]e[/sIGPIC]
rbulph Posted January 15, 2008 Author Posted January 15, 2008 OK, thanks, that all seems fair enough. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.