devxlogo

Using Efficient Remote Interface Design

Using Efficient Remote Interface Design

Because server/client round-trips are inherently inefficient, you should try to eliminate the need for excessive round-trips. When you design a class or a user-defined interface, you should never expose three public methods or properties when a single method can accomplish the same. If your class exposes two public properties, a remote client will require two round-trips to access all the data. Example of an ineffficient design of an rectangle class is:

 Dim Rectangle As CRectangle
Set Rectangle = New CRectangle
' initialize object
Rectangle.Width = 300
Rectangle.Height = 200

Marshaling a complete set of data in a single round-trip is much better than marshaling smaller amounts of data in multiple round-trips. So you should try to create a single signature that lets you do move all the required data across the network in one shot. For example, if you create a SetRectangleData method that takes two input parameters, the client can initialize the object in a single round-trip, like this:

 Rectangle.SetRectangleData 300, 200
See also  Monetize TikTok For Your Business
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