Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:18:10+00:00 2026-06-12T22:18:10+00:00

Programming languages like C# or Java feature static methods, despite being heavily object oriented.

  • 0

Programming languages like C# or Java feature static methods, despite being heavily object oriented.

I’m aware that there are many cases where static methods are used for performance or convenience reasons, but i can’t stop wondering if there exist actual coding problems which could not be solved without the use of static methods.

I think that some of the common cases which would be named here could be just “normal” methods, instead of being static, like:

  • main: The purpose of the main-method is the creation of the very first running thread of the program and starting it. So this might as well just an object derived from a Thread class
  • Loggers: Logger implementations often use static methods. I don’t see the point in that as i might want to exchange a logger for another on with an identical interface
  • Math: Math functions really seem to be a perfect candidate for static methods at first sight, but there might be cases where you might want to exchange your math library transparently for another one (i.e. if you need more performance on the sin() function you might want to use an implementation with a faster, less precise algorithm if precision is not critical for your application)
  • Singletons: Are considered bad practice by many. If only one instance is necessary you might think about actually creating only one instance.

So, what might be cases where static methods are really absolutely needed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:18:12+00:00Added an answer on June 12, 2026 at 10:18 pm

    IMO, Static methods are needed while defining factories to create objects of different sub types of a given type where the choice of sub type is dependent on the inputs to this static factory method and is hidden from the client.

    Your Logger example actually falls under this category where the actual logger is decided based on the package/class it is needed (ofcourse the other factory methods on Logger take other parameters to decide on the appropriate Logger instance to be returned).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had some experience on programming languages like Java, C#, Scala as well as
Could people please rank some programming languages like C,C++,Java,perl etc on benchmark line of
There are a huge feature collection in C++ programming language that supply a strict
What are the closest framework to Erlang for other programming languages like Java, C++
In many programming languages there is the basic equals operator which will see if
Is there anything that java cannot do? But other's can? I am talking about
Is there any low Level Programming language available based on java syntax and features?
Are there any extensible interpreted programming languages written in standard, platform-independent C or C++?
Every now and then, I hear someone saying things like functional programming languages are
As the title suggested, can I use CMS like Drupal with other programming languages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.