Gurus > Efficiency Issues.  TComponent vs Tpersistent

Respektable used Ask the Experts™
Ok... so I have this treeview... and it might have a LOT of nodes. Say 2000 or so.. and there are several trees.

Is there any appreciable reason why my Node.Data object cannot be a Tcomponent?  It's already a Tpersistent, but I'd like to be able to stream the suckers and that's not so simple with a Tpersistent. I only know how to do it with a component using Write/Read component.  If someone can tell me how to do it with a Tpersistent, I would be extremely grateful, but in the meantime, is there any reason why a component shouldn't be used as the Data object?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
None that I'm aware of.  I wouldn't want the overhead of a TComponent myself, but it's a personal preference rather than a thoroughly reasoned objection.

I'm working with a structure that I expect to have around 4,000,000 "nodes", that resembles a drunken spiders web more than a tree.  I started my inheritance directly from TObject for the business logic, and for each business class I have separate classes of persistors whose only job is to know how to store and retrieve their corresponding business classes from various media.  For example, a TChicken would also have a TChickenStreamPersistor, a TChickenDatabasePersistor, and a TChickenXMLPersistor.

That way I don't get bogged down in the storage logic when handling business logic and vice versa.  It also allows me to separate the persistence and business processes by threads, to ensure that persistence doesn't bog down my processes in an intensive server application environment.


Thanks swift. Unsure of how to proceed, I decided to go with a Tpersistent. What I built is pretty cool.  It's a "Set Manager" that stores a collection of "TSetMembers" and TsetNames"   Each collection can be streamed via a dummy carrier component as one big stream.... or to separate streams stored in Plasmatech's Structured Storage Library. This lets me save or read the properties of a single collection item.   (I wanted to be able to save a single node's data.. without saving the entire collection).  
Using a Tcompnent would have saved some steps, to be sure, but I will take comfort in knowing that each node record is not carrying the overhead of unneeded properties.  Was it worth a day's coding? Probably not.. but it's done... lol. Have some points on me!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial