In the "Powerbasic Listens" thread I mentioned that I'd love to see Powerbasic support dynamic arrays within UDTs. There are two schools of thought here, and it seems that that overhead and therefore loss of speed that would occur were this to be implemented may prevent this from being added as a feature.
With that, Paul Squires was kind enough to say a) he would like to see this, too and b) the use of classes gives him much of the feature set he was looking for anyway, so it's a very plausible workaround.
I'm a complete noob at objects - never programmed with them, never had to. However, I'm currently working on my own project where I think either they (or dynamic arrays within UDTs) would be very handy. Basically, I'm creating an array of UDTs that store information on a per person basis. Within each person's UDT I need to store a lot of historical information (in yet another UDT). For the new guy, there's obviously not going to be much info. Frankly, they may never attain much historical info EVER - but I need to be able to track them to eternity. There will be select people, however, that will record a lot of history and therefore the array of their statistics UDT would be fairly large. If I were to just dimension the UDT for a worst case scenario, I'd be looking at an array like this: stats(20, 3, 5, 10) as tStat.
For our purposes I'm not going to show the tStat type declaration, but it's about 1K in data. I'm looking to keep track of 30000 people to start, adding about 1000 per year (not real-time, program-time, so this could happen fairly quickly). Unless my calculations are off, I'm quickly bogging down huge amounts of memory if each person has an array of 20 * 3 * 5 * 10 = 3000 * 1k = 3 MB (?!).
So - the hope was to implement a dynamic array that expands as the history of the person requires it, rather than creating the giant array referenced above.
I'm wondering - are CLASSES really going to be the answer for my problem here? I have a number of other requirements here as well, some that naturally lend itself to an array - I need the ability to sort the people based on data stored within that statistics UDT. I also need to change the data of the most current historical record - a LOT. Wouldn't the use of an array of obects like this be cumbersome? I guess what I'm asking is: are CLASSES the be-all end-all here, and should I immediately start re-writing my program to support them for this unique case?
Thanks in advance for any advice!
-Craig
With that, Paul Squires was kind enough to say a) he would like to see this, too and b) the use of classes gives him much of the feature set he was looking for anyway, so it's a very plausible workaround.
I'm a complete noob at objects - never programmed with them, never had to. However, I'm currently working on my own project where I think either they (or dynamic arrays within UDTs) would be very handy. Basically, I'm creating an array of UDTs that store information on a per person basis. Within each person's UDT I need to store a lot of historical information (in yet another UDT). For the new guy, there's obviously not going to be much info. Frankly, they may never attain much historical info EVER - but I need to be able to track them to eternity. There will be select people, however, that will record a lot of history and therefore the array of their statistics UDT would be fairly large. If I were to just dimension the UDT for a worst case scenario, I'd be looking at an array like this: stats(20, 3, 5, 10) as tStat.
For our purposes I'm not going to show the tStat type declaration, but it's about 1K in data. I'm looking to keep track of 30000 people to start, adding about 1000 per year (not real-time, program-time, so this could happen fairly quickly). Unless my calculations are off, I'm quickly bogging down huge amounts of memory if each person has an array of 20 * 3 * 5 * 10 = 3000 * 1k = 3 MB (?!).
So - the hope was to implement a dynamic array that expands as the history of the person requires it, rather than creating the giant array referenced above.
I'm wondering - are CLASSES really going to be the answer for my problem here? I have a number of other requirements here as well, some that naturally lend itself to an array - I need the ability to sort the people based on data stored within that statistics UDT. I also need to change the data of the most current historical record - a LOT. Wouldn't the use of an array of obects like this be cumbersome? I guess what I'm asking is: are CLASSES the be-all end-all here, and should I immediately start re-writing my program to support them for this unique case?
Thanks in advance for any advice!
-Craig
Comment