Replace Public Array for Data Storage and Statistics with Collection Property

rkaczano

Board Regular
Joined
Jul 24, 2013
Messages
141
Office Version
  1. 365
Platform
  1. Windows
I have a custom class object (clsAsset) and a custom collection object(clsAssets). I am pulling the various property values from the objects (over 300 objects), and calculating statistics in a public array (i.e. DataArr() as Variant). The array is 2D and each row represents the values from the underlying objects and the resulting analytic results run on those property values. All the data and statistics reside in DataArr(), and as they are calculated in a simulation, their is a lot of data created. I delete all the data in DataArr() after each loop and transfer stats on its results to a Publicly declared Dictionary object called FinalResults.Dict().I then provide sum and average calcs on the FinalArr().

So as you can see here, I mixing the benefits of custom objects and custom collections while still using Public arrays and Public Dictionaries. I am starting to wonder if I need to do that or if I can lever off the benefits of the custom collection I have already created.

I am assuming that another way to do this would be to simply create a property (Asset.Data) for the objects that takes an array (as a variant). I would then have this for all the objects. This array property for the individual objects would replace the individual rows in DataArr(). So instead of populating DataArr() with the results of each object and running analytics on it, I assume I could run those same procedures in a method of the custom collection object that I have already created (i.e. Assets.RunAnalytics) and this would run a function that loops through the individual objects, pull the individual object property values and calculate the stats. An example I can think of is a sort function. Instead of sorting the public array (I.e. DataArr = BubbleSort(DataArr)) and storing the sort order for each asset in the array, I could use a collection sort method which pulls all the individual object properties into a temporary array in the collection method and calculates the sort order.

So my question is, does this make sense and are their benefits to doing this? Would this provide runtime benefits relative to storing data in a public array/dictionary?

Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Well, it make sense; but whether or not the benfits are worth it is less clear. If you have your current methodology of using the public statisics array to calculate and store results in your FinalResults dict sorted out and working to your satisfaction then IMHO, you need to be able to articulate a significant benefit to tearing that up and replacing it with something new. Particularly since it sounds like a change that would have to be propagated through your entire object ecosystem.
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top