I've recently moved from VB6 to VB.NET and I am finally getting there with understanding the inner workings. I've been looking at my company's existing codebase and I am a little suprised.
I understand that when VB.NET creates a string it see's if the string is in memory and if not creates a new instance of that string, otherwise it points the new variable to the old . However I wonder if it does this with other objects?
The reason I ask is my new company has a DATABASE object which basically wraps database connection info and database connections in a object.
We also have a BOOK object and a PAGES object.
My best practice in VB6 would be to create a DATABASE object and then pass (byRef) that to the BOOK and then PAGES object, so you have one DATABASE object passed to muliple books and then PAGES.
However, how they have done it is to create a new instance of the DATABASE object in each PAGE and each PAGE object, which means you could have muliple instances (thousands in fact) of objects which are in fact all the same.
Is this wise? Or do objects get handled like Strings?