By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Overridable Functions/Procedures

P: n/a
Hi,
I was wondering if anyone has any information on the performance impact of
using functions declared as overridable?

To Explain more fully; By default every function created in VB is NOT
declared as overridable. However 90% of the time when creating resuable
components/classes you don't care if the target programmer overrides the item
or not.

However, if you are the target programmer and wish to alter the behviour of
a class in a polymorphic manner and the creator of the class has not declared
the function/property/procedure as overridable then you are stuck with
shadowing the original code... which of course will not operate correctly
(with respect to polymorphism).

So is there any performace reasons (memory/CPU) considerations for not
declaring all of the procedures/functions in a Class as overridable?

Regards,
Myles

Jun 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Making things overridable I'm sure detracts from performance. However, I
would think this performance hit is so small as to be considered completely
inconsequential to the performance of your program.

Making things overridable or not should be done more from the perspective of
software architecture. There are some things that a developer should simply
not be able to override.

Also, from the point of view of readability, it is easier to follow what is
going on in a program and what its intended structure is if only methods
that truly need to be overridable are declared as such.

I think good programming practices should be what you worry about here, and
forget about worrying as to how this will impact performance.

"MDFS" <MD**@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
Hi,
I was wondering if anyone has any information on the performance impact of
using functions declared as overridable?

To Explain more fully; By default every function created in VB is NOT
declared as overridable. However 90% of the time when creating resuable
components/classes you don't care if the target programmer overrides the
item
or not.

However, if you are the target programmer and wish to alter the behviour
of
a class in a polymorphic manner and the creator of the class has not
declared
the function/property/procedure as overridable then you are stuck with
shadowing the original code... which of course will not operate correctly
(with respect to polymorphism).

So is there any performace reasons (memory/CPU) considerations for not
declaring all of the procedures/functions in a Class as overridable?

Regards,
Myles

Jun 21 '06 #2

P: n/a
Hi Marina,
thanks for the input, everthing that you have pointed out makes sense,
however the core question is still what sort of performance hit is taken...
Maybe it's insignificant (and probably is given that I haven't been hit with
loads of reply's)

With regard to "Best Programming Practice" that is what we are trying to
establish for the current and future development requirements :)

From the point of view of re-usable components it would appear sensible that
procedures are declared overridable unless there is a compelling reason not
to (Security, Stability, etc.) however the question that arose was what
impact this would have on performance (memory, cpu etc.)

Again thanks,
Myles.
Regards,
Myles.
Jun 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.