Does VB 6.0 offer data structures
-
A quick browse at the MSDN reference didn't reveal anything favourable.
I have taken on a VB6 -> .NET port project, and found some intense
use of multidimensional arrays to represent structures of objects.
Day after day, i continue to struggle to remember just what
arryTag(nTagRec, 12) is versus nArryTag(x, 7) (and multiply that with
the number of columns for each type of array), seeing them work side by
side. This is one uber-serious time consuming activity.
Is this what VB developers had to put up with all these years?
-
This is what complete idiot programmers have been doing for years.
It's worse where I'm at. The VB6 stuff is littered with Variant Arrays. VA's are quite possibly the worse thing to happen to programming in the past 20 years.
I concede the VB6 doesn't have all the OO features out there, but we do have Types (think Struct) and Classes. There is absolutely no reason to not use these. Even if your incredibly lazy and don't want to set a reference to the struct with VB's late binding, so you can just access the properties (and get a runtime error if they dont exist).
Be thankful you don't have to deal with VAs though. Just to give you an idea how absurdly idiotic the programmers (now Sr. Architects and Managers) were who put together the VB6 modules here ...
Public Funtion DoSomething(vntInput() as Variant) As Variant()
If vntInput(34) = "ASDf" Then ....
Dim as vntCallToAnotherFunction() Variant
vntCallToAnotherFunction(0) = ...
vntCallToAnotherFunction(1) = ...
vntCallToAnotherFunction(2) = ...
Dim vntReturnFromAnotherFunction() as Variant
vntReturnFromAnotherFunction = AnotherFunction(vntCallToAnotherFunction)
....
End FunctionGet the idea? Oh man, it's horrible.
-
Alex is right: Types work well in VB6.
My VB is rusty, but I believe the syntax is:
[code]
Type DataStructure
Field1 as integer,
Field2 as string,
Field3 as long
End Type
[/code]
You can even have array of Types and nested Types.
-
hmm...it appears I don't know how to use the code tag thingy...
sorry. just ignore the 's.
-
I found it after some digging from your mention
Looks like it ain't something basic placed in the objects or keywords section.
-
-
OMG... you use unintelligent systems community server, too? have we not learned from the hell that is the DailyWTF?
-
Consider this: i used to be using ASP.NET Forums v1.0
I am a much happier person now ;-)
-
@icelava said:
Consider this: i used to be using ASP.NET Forums v1.0
I am a much happier person now ;-)phpBB rules! [:P]
-
@icelava said:
A little rant of mine.
Although I generally agree with some of thecomments in your rant, I
disagree with some of your assumptions. For instance, In my
opinion, part of the reason why some programmers have such a hard time
understanding old code is not necessarily that it was written for the
"computer that will simply run your product", but because they lack
certain understanding, perhaps at lower levels, of the platform or
framework in which they are working on. Because of this, even
code that "reads out so naturally like a poem", might be hard to
understand by the general, casual programmer or maintainer.
There should be standards and conventions within a codebase, but using
very high level algorithms and constructs in order to provide for the
understanding of any possible moron is sometimes wasteful and
error-prone; plus it might introduce artifacts and side-effects into
the functionality of the project that can be very hard to predict or
correct in the future.
I see this attitude quite often in new-comers to the field, when they
mistakenly
confuse tight, well thought out, and efficient code with
"unmaintainable code", written by some jerk who's obviously just
looking out for his job security. Of course, there are plenty of
jerks out there just looking out for their own job security (gawd knows
we all have to deal with them!), but its a
bit of a stretch to assume that everyone should write code in exactly
the same way and style, and that this way and style is exactly the same
one you happen to like. After all, just like any other art form,
it takes some thought and a core understanding of the language and
culture in order to properly assimilate and appreciate a well written poem.
Take a look at some Open Source Software projects. Some
contributors are highly skilled and talented, and while the code might
not
be in any particular "textbook" style, others are still able to
understand it and maintain it, quite efficiently in some cases. Good understanding of the
framework is key (and good comments, of course, help a lot.)
dZ.
-
@DZ-Jay said:
part of the reason why some programmers have such
While i can agree
a hard time
understanding old code is not necessarily that it was written for the
"computer that will simply run your product", but because they lack
certain understanding, perhaps at lower levels, of the platform or
framework in which they are working on.
familiarity to a lower base framework/library helps understanding, it
really depends on the level of abstraction one is working one at the
moment. Some just need to use a component/object and don't need to know
what happens inside. Hiding details that one doesn't need at a
particular level has always been useful in managing complexity.
This program that I am converting is not sporting any complex alogrithm
and AI patterns (although there is some rather elaborate decision
making processes that can and are being isolated at the moment), and
hardly has any low level base framework to begin with. Just the mere
monolithic layer of handling all different types of work together.