Hy guys
my little opinion:
I agree totally about advantages to use an UDT for getting less mantenance of code and backward compatibility.
The exception comes up when we use the same UDT to save data in the files. In this case we must build a trans-lator from the last UDT to the new UDT.
I love this community!
Translator from old structure to new structure, or else we need to plan a dynamic database to store our information that we can expand upon.
For example, let's say we want to start with the following DataType:
TYPE WeaponResources
WeaponName AS STRING * 20
WeaponDamageMin AS INTEGER
WeaponDamageMax AS INTEGER
END TYPE
DIM GameWeapons(1 TO 100) AS WeaponResources
*****************
Now, if we take the easy way out and just PUT #ResourceFile, ,GameWeapons(), then we'd have to "translate" the data file as you mentioned in your post.
But, let's save it differently...
OPEN "ResourceFile.BIN" FOR BINARY AS #2
FOR I = 1 TO 100
PUT #1, ,GameWeapons(I).WeaponName
NEXT
FOR I = 1 TO 100
PUT #1, ,GameWeapons(I).WeaponDamageMin
NEXT
'Same for max damage....
Now, if we want to add a new field (such as weapon element for lightning, fire, ice, ect), we can just tack it on to the end of the database without having to rewrite/translate our data file.
It's actually not that much slower than a direct PUT of all the contents at once (especially if you track data position for direct access), and it allows for easy future expansion of your database.