Serving the Quantitative Finance Community

 
User avatar
mtsm
Topic Author
Posts: 78
Joined: July 28th, 2010, 1:40 pm

excel object lifecycle management

July 28th, 2010, 9:08 pm

I saw a couple of threads here, where this topic came up. I'd like to ask a knowldgeable person to kindly briefme on the best way to handle the lifecycle of objects in excel.In my understanding xlw doesn't really allow one to create objects, reference them in excel using some identifierand then have some underlying indirection mechanism allowing to point to the object with the identifier when it is needed.I can't imagine that not having such a feature would make any underlying analytics system really useful, so I am sometimes puzzled that this problem doesn't have a uniquely accepted solution. Thre are entire large shops thatrun of such systems. Is there an easy way to get something like this up and running? I heard about object handler. Has anybody used this or would you rather opt for a simple fron scratch solution? If yes, which one?Thanks, mtsm
 
User avatar
Leonidas
Posts: 0
Joined: June 6th, 2007, 7:53 am

excel object lifecycle management

July 29th, 2010, 4:58 am

The easiest way would be a a simple static std::map defined in your CPP file before all functions are declared. Say it contains yield curves.std::map<string,YieldCurve>. After creating the yield curve, you can assign a unique ID to it and store it in the map. You'd return thestring. In some other function, say getDiscount(std::string id, int date) you could look up the id and the corresponding YieldCurve and return whatever you like. That's the easiest way. Now, you wouldn't want a map for each different object. So, you could create a generalrepository class using the Singleton pattern (I'm using boost::any+boost:: optional) for that.
Last edited by Leonidas on July 28th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
mtsm
Topic Author
Posts: 78
Joined: July 28th, 2010, 1:40 pm

excel object lifecycle management

July 31st, 2010, 1:21 am

QuoteOriginally posted by: LeonidasThe easiest way would be a a simple static std::map defined in your CPP file before all functions are declared. Say it contains yield curves.std::map<string,YieldCurve>. After creating the yield curve, you can assign a unique ID to it and store it in the map. You'd return thestring. In some other function, say getDiscount(std::string id, int date) you could look up the id and the corresponding YieldCurve and return whatever you like. That's the easiest way. Now, you wouldn't want a map for each different object. So, you could create a generalrepository class using the Singleton pattern (I'm using boost::any+boost:: optional) for that.Are you using this in a proper production system? I mean do you have any large scale excel books based on that? How do you handle object deletion? Suppose an object is not referenced any longer in a sheet, because you have refreshed a cell. How do you destroy that object?
 
User avatar
AlexesDad
Posts: 11
Joined: May 29th, 2009, 4:10 pm

excel object lifecycle management

August 27th, 2010, 3:53 pm

This has been asked for before and you can find simple solution here Object Cache DemoSee the post dated Sun Oct 25, 09 08:45 PM on this thread.