When I was in college I would occasionally overhear a classmate refer to a vector when talking about a homework project. For years I was mildly puzzled by this. My programming classes didn’t have anything to do with linear algebra. It made no sense, but as I only heard it rarely I didn’t follow up.

Later on I found out that stl calls a dynamic length array a vector. What the heck? Other than trying to sound pretentious, I can’t think of any grounds for or reason to relate the two. A vector is a “quantity completely specified by a magnitude and a direction.” A dynamic array is an set which can grow in size.

The best term to use is a List (which is what I use in RakNet).

Actually I remember something from calculus: a vector is N ordered values. That forms an N-dimensional vector, which of course can be easily visualized in 2 or 3 dimensions. So a vector in geometric sense is a direction and magnitude; in calculus it’s basically just N values that has defined operations on them (an algebra). STL’s notion might come from that.

By the same logic any array is a vector. In fact a fixed size array is more of a vector than a non-fixed size array since vectors usually don’t change dimensions while you are using them.

I think it’s inarguable that vector is a bad name for a dynamic array. Even if it applied mathematically it’s misleading.

Yep. I guess that’s the reason by more recent popular languages/libraries call them something like ArrayLists. I like this name – it’s much less ambiguous than a List (which could be linked list).

The fact that it’s implemented as an array should be of no concern to you, except for performance considerations. You know this… you appreciate good design.

Mathematically speaking an array can be a vector and I’m sure this was realized. But an array is not an instantiatable data type, a vector is. I don’t really see why you would have a problem with it, I believe “vector” is actually more descriptive than “array” as it avoids baking implementation terms into your code…. similar to avoiding heavy use of hungarian notation.

Perhaps they avoided terms like “ArrayList” as they did not want standard libraries to be oxymoronic.