473,513 Members | 6,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overhead of Shared Subs

Hi All,

I am just wondering, is there some sort of overhead involved in shared
or static functions and subs?

I think there must be, otherwise, there would never be any need to
create an instance of a class to call one of its member methods., but I
would like to know for definate.
Regards
Mick
Aug 15 '07 #1
4 1217
Whether there is overhead involved or not should not play a role in using
static/shared functions versus object methods. A method on an "automobile"
class to set the number of wheels, is probably static/shared. All
automobiles share this characteristic. A method for paint color is probably
not shared, as each automobile may be different colors.
Aug 15 '07 #2
ModelBuilder wrote:
Whether there is overhead involved or not should not play a role in using
static/shared functions versus object methods. A method on an "automobile"
class to set the number of wheels, is probably static/shared. All
automobiles share this characteristic. A method for paint color is probably
not shared, as each automobile may be different colors.

OK and how about a situation where I am implimenting my Business Logic
through the use of a class?

i.e Public Shared Function InsertUser(....)
Public Shared Function GetUserDetials(....) ...

etc

Whould there be any additional overhead involved in this menthod, than
if they were not shared, and I created an instance of this class and
thus called the methods?
Aug 15 '07 #3
Mick Walker wrote:
I am just wondering, is there some sort of overhead involved in shared
or static functions and subs?
No.
I think there must be, otherwise, there would never be any need to
create an instance of a class to call one of its member methods., but I
would like to know for definate.
You are not thinking object oriented, that's why you don't see the
difference.

Instance methods of a class are non-static because they use the data
that is stored in the instance. You create the instance to keep data in
it, not only to call it's methods.

A method that does not use any data from the instance should be static,
so that you don't need to create an unused instance just to call the method.

--
Göran Andersson
_____
http://www.guffa.com
Aug 15 '07 #4
I don't see where there would be any overhead one way or the other.

"Mick Walker" wrote:
ModelBuilder wrote:
Whether there is overhead involved or not should not play a role in using
static/shared functions versus object methods. A method on an "automobile"
class to set the number of wheels, is probably static/shared. All
automobiles share this characteristic. A method for paint color is probably
not shared, as each automobile may be different colors.
OK and how about a situation where I am implimenting my Business Logic
through the use of a class?

i.e Public Shared Function InsertUser(....)
Public Shared Function GetUserDetials(....) ...

etc

Whould there be any additional overhead involved in this menthod, than
if they were not shared, and I created an instance of this class and
thus called the methods?
Aug 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2270
by: | last post by:
In global.asa I have some code outside all the Subs. I have some confirmation that it is being executed OnStart. Yet I can's see if it is executed OnEnd. The literature I have says that OnEnd...
13
2069
by: Steven Scaife | last post by:
I have decided to re-write the intranet site i created over a year ago. The coding is pretty awful and hard to read cos I made the mistake of not putting comments in or putting crappy comments in...
15
1644
by: Qopit | last post by:
I'm setting up a system that consists of several small python applications that all communicate amongst each other on the same pc. When running in Windows, launching each application generates a...
2
1485
by: nakhi | last post by:
Hi, I declared a dataset outside any subs, then I fill the dataset with a tables in a Private Sub1, then I want to take the data out from the dataset in Sub2. like . sub2()...
7
1863
by: djc | last post by:
I have several subroutines (all inline code) that wind up using the same database connection object variable. I have been declaring a new variable in every sub. I just now came to a point where I...
4
2023
by: a | last post by:
Hello Gang, I am in a bit of confusion regarding a half completed application I am writing. It is an MDI app, so I have a main form (frmMain) that is always open. I am looking for a 'Best...
4
3332
by: Rubbrecht Philippe | last post by:
Hi there, I would like to develop an interface that when implemented in a class requires a number of shared properties or methods to be available. It seems a Shared Member can not be used as...
11
1839
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
3
2336
by: Jeff | last post by:
....still new to vb.net and vs 2005 web applications. I remain confused about the "shared" variable/table designation and the difference between "public" etc. I wish to place an entire table from...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.