Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Are shared methods slower ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Craig HB - 09 Aug 2005 11:38 GMT
I use shared methods for all my business logic classes to save typing when
calling them (because I would not need to instantiate the object). So I would
use them like this : "dim ds as dataset = Employees.List".

Is this ok or does this affect performance ?

Thanks, Craig
Cowboy (Gregory A. Beamer) - MVP - 09 Aug 2005 14:26 GMT
It depends on the size of the solution. Shared methods should actually be
faster, as they only have to load once and do not incur object instantiation.
But, you can overdo this and end up using a huge amount of memory. If you get
to this point, you can degrade perf.

Overall, helper methods are static (ie, those methods that have no object
context, like methods to add number, retrieve generic data, etc.). If you
have an object, its own methods should be non-static (instance methods). If
you follow the "rules" you are unlikely to go wrong.

I am very fond of making helper methods static, but I would not make
everything static. While you may end up with a perf benefit, you knock
maintainability out the window. You also can end up screwing up other aspects
of development.

FYI: Too many people focus on perf to the exclusion of other aspects:
maintainability, security, availability, etc. It is not a wise decision.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> I use shared methods for all my business logic classes to save typing when
> calling them (because I would not need to instantiate the object). So I would
[quoted text clipped - 3 lines]
>
> Thanks, Craig
Craig HB - 09 Aug 2005 14:34 GMT
Thanks, Gregory. That is very helpful

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.