Very many authors of statistical algorithms calculate standard deviations and variances in procedural code rather than using an object-oriented solution. Typically, they follow the technique of building arrays of squares for each data pair.
In fact, this is unnecessary and wasteful of storage, as all the values needed to calculate standard deviations and variances can be calculated "on the fly" without any need for arrays; this has the added benefit that the storage requirement is independent of the sample size (i.e. the number of data pairs).
I hope to provide a working example to demonstrate how a more complex statistical class can be simplified, clarified and made much more efficient by making use of the meansdev class.