Laura said:
[...]
The scaling factor is not documented because it's an implementation
detail, MSFT reserves the right to change the factor statically and
dynamically, something they were thinking of (if not yet done in V3.5)
for MSIL code that runs on X64/IA64.
Willy.
Let me disagree.
And let me disagree. And agree. With both of you.
IMHO, any behavior that may have a impact on the resource consumption
model of my application deserves to be documented.
Microsoft may well write "This behavior may change in the future". There
is nothing wrong with it. Good. Go and optimize it. Make it better.
Knowing that the array doubles is key parameter to understand better
memory/performance behavior of my code.
And, already, Microsoft documents implementation details with O(1), O(N)
etc. Even they can change in the future.
IMHO, the fact that Microsoft documents the algorithm order is a
commitment to preserve that _behavior_ detail. Yes, it's an outcome of
the implementation, but the exposed behavioral contract for the class,
by virtue of the documentation, includes the algorithm order and since
that's part of the contract it should _not_ change in the future.
On the other hand, obviously the management of the internal storage for
a List<> is an implementation detail. A user of the class should expect
that the class not do anything stupid, like reallocating the array every
single time the capacity changes. But otherwise, the exact scaling
factor at which the storage is reallocated is not really important to
the user of the client. Unlike the algorithm order, assuming any
"non-stupid" scaling for the capacity size on reallocation then the
overall performance is actually not going to be affected that much by
the specific choice.
So, that's why I disagree with you and agree with Willy.
On the other hand, I generally prefer more details to fewer. Just
because something is an implementation detail, that doesn't mean that as
the user of a class I am entirely uninterested in the detail. I don't
really expect a complete description of the implementation, and of
course it makes the doc writer's job hard if that implementation should
change in the future.
But the mere fact that something might change in the future shouldn't
necessarily exclude it from being documented. It's a question of
manpower, not technical feasibility. It would be nice if Microsoft's
technical writing staff could come up with some kind of process for
identifying implementation details that can be usefully documented while
still being easily tracked and updated should they change in the future.
The implementation details that are so documented would be very few and
far between. Generally speaking you _don't_ want to document
implementation details. But I'd agree that this particular
implementation detail is likely to be of greater-than-average interest
to the typical .NET programmer.
So, that's why I agree with you and disagree with Willy.
Pete