Storing references to instances of the Class class

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Storing references to instances of the Class class

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:18 pm

by torrie >> Tue, 31 Dec 2002 11:11:16 GMT

Hi

I want to store references to instances of the Class class. Until now I have been storing the name of the class rather than a reference to the instance of the class. (This gets around the issues that there are multiple instances of the Class class for a given class.) Now being involved in multiple schema development I realise that the class name is not unique enough so I am also storing the schema name. This takes up 62 bytes of storage and I wondered if I could use the class number instead?

Can anyone tell me if the class number is globally unique within a Jade database and if the number of a class will change over time, ie as schemas are loaded.

Cheers

Torrie Moore

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Storing references to instances of the Class class

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:18 pm

by skipton >> Tue, 31 Dec 2002 17:20:59 GMT

Torrie,

If you can avoid storing references from user data to system data do so. You may be ok until such time as you need todo some out-of-the-ordinary change further down the line, such as copying map files to another system, data loads/archiving into another base or debugging from data. Ive found that it makes sense to draw a line between what is Jade data and what is User data.

Class numbers are unique within a Jade database, there is a sequential number that all schemas use. The problem comes when you load a schema into another Jade system where the number is already used. The new class needs a new number so it ends up being different to the number in the base it was extracted from. Hence you could end up with a problem similar to referencing the classes directly.

Why not use the schemaname/classname keys as you are suggesting? If storage is a concern then you could look to have your own schema object with the classname keyed objects in a collection off that. There maybe some form of hashing you can do to reduce the size further. The tradeoff is the extra drilling down to find the object you want. I would have thought the storage space required would not be to much of an issue for a large system (given having 1000s of classes means Jade internally will need the extra space anyway?).

Remember that this also turns to custard when someone renames a class.

Cheers,

John Beaufoy
JBS Solutions Ltd (UK)

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Storing references to instances of the Class class

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:18 pm

by allistar >> Tue, 31 Dec 2002 21:03:20 GMT

I agree with John, schemaName, className pairs would be a good option. You could have your own class with these two properties on it and then you just need to have a reference to the appropriate instance of this class (would take up less space than using strings everywhere).

Regards,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 21 guests

cron