Advantages/disadvantages of Static vs Non-static methods??
Posted on 2005-03-01
I'm finishing up my degree in Software Development and recently started a job as a Junior Developer. One of the first tasks I was assigned was to create a data access tier for my part of the project. No problem, my education covered this type of thing in relative detail. So I go to work, get it up and running and am pretty happy with the results. My code involves instantiating a data access object and using it's methods to interface with the database. Pretty standard, right? But later, I had the opportunity to look at my Lead's code for the data access tier for his part of the project. His code looks very similar to mine except that he has used static methods to achieve the same results.
Which got me thinking...what are the advantages and disadvantages of each approach (either for this specific task or in general)? Is one slower/faster? Have less/more overhead? Are there methodology or design-related reasons for using one or the other?
I realize this is kind of a general question, but I'm curious what people have to say about it. The question is worth 500 points and I'll probably split them up among the 1-3 anwers I think contribute the most to my understanding of this issue.