Jose Sandoval Google
 Resume     Book     Software     Drawings     Home     Subscribe to RSS feed Search Web Search

Static or instance calling?
Monday, November 08, 2004

I have always debated if static method calls are OO or procedural programming. I think there is a middle ground for this one.

I also had an interest to know if there was a performance hit by calling one or the other. So I wrote this article/blog entry called Using static or instance methods, together with a small test class.

The sample code is very generic and perhaps too small to come to any conclusion. So don't take my sample as anything scientific or based on any long-term statistics. This is only a sample to convince myself that static methods are a bit faster to execute than instance method. I.e. there is no instance of the class, for one.

I'm sure there is some code out there that will give better performance with either static or instance calling. In the end, it's the design that should drive your choice of method calling. Static method calls don't look too OOish, however, they have a place in OO design.

5:30 PM | 1 comment(s) |

By Anonymous Anonymous, at 3:13 AM

This page is powered by Blogger. Isn't yours?

© Jose Sandoval 2004-2009