Wrote my first concrete implementation of my ArrayCollection class:
Now i just need to test it. I’m using the CLR pseudo-code translated into C# for this algorithm.
I can already smell a refactoring coming in with the constructor. “Introduce explaining variable” for the hardcoded in 0 (in the array constructor), and the “Promote Local to Argument” so that i have a constructor that takes in an initial capacity. The count = 0 could go into the class body, or could just be avoiaded alltogether. I’m not sure which is nicer, field initialization in the class body, field initialization in the constructor, or no field initialization when it keeps its default value.
However, I’m not touching this until it’s passed my tests. Must resist the urge to code like mad.