Mucman wrote:
ok, i'll bite. How does VB teach you hot NOT to do things? And Java is not practical??? How so?
A few ways in which VB teaches bad habits:
1: Enforced use of Goto/On Error Goto for error handling rather than having any real exception handling. Actually, it's worse than that. Using the err object/raising an error to be caught in your error handler is
EXPENSIVE in VB, on the order of 100 million CPU cycles. So actually for the errors you have full control of, if you want things handled a couple hundred times quicker you have to copy your error information into some object scope vars with a function call, then explicitly have a Goto nonsystemerrorhandler in your code.
2: No way to enforce explicit variable type declarations with the ugly Variant as a default type in code that doesn't specify. Fortunately .NET fixes this with Option Strict. VB.NET is truly a different animal from VB6 - it's VB6 I have major issues with. In fact it is all too common a practice NOT to give variables types because then things won't work if you copy and paste into ASP/VBScript.
3: The fact things have to be Variant if they are ByRef params called from VBScript is the ultimate evil.
4: reference counting on all objects rather than forcing the programmer to think about their allocation/deallocation, and no direct control of destructors being called. Yes, I say
forcing the programmer to do this is a
good thing?. I know this "feature" is supposed to protect you from memory leaks but in actuality it doesn't. Any objects with references to each other (circular) will end up causing a memory leak in VB. I know circular references are also considered bad practice, but there are more justifiable uses for this than one might think. This is a big gripe with Java as well.
5: Don't get me started on the evils of the "apartment thread model". BTW, did you realize that any Public variable in a .bas file is actually
thread scope, not a true global? (Actually, given the thread model, that is a good thing...)
6: Array implementation so lousy it forces you to either throw the array contents into a delimited string or use a dictionary or list object if the array needs to be scanned frequently for performance reasons.
7: Everything has to be an "Object" so that they can claim it is OOP - it won't let you create a normal Win32 DLL that is a collection of functions but isn't COM, yet the only possible type of inheritance is interfaces.
Edit: BTW, anyone else who downloaded the source to Windows notice that the only 2 VB files are test programs to make sure it still worked with other Windows components?