devxlogo

Reduce COM+ context overhead: use modules and shared members

Reduce COM+ context overhead: use modules and shared members

If you use Shared members in .NET or modules in VB6, you reduce COM+ context overhead without any risk whatsoever that you will get extra context overhead for that code. You also release yourself from the clean-up burden that you have in both worlds. Instead of the VB6 consumer code:

Dim obj As MyServer.MyComponentSet obj = CreateObject("MyServer.MyComponent")obj.DoStuff...Set obj = Nothing

It’s as simple as this:

MyModule.DoStuff

Perhaps you don’t think that this tip results in good object orientation? Well, if a method doesn’t need any instance state, then why should you use an instance? I don’t think you should, unless you don’t need to remote the method on its own. Ask a Java friend if they think Static methods are useful. The odds are that the answer will be “yes”.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist