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 8401007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:41:44+00:00 2026-06-09T21:41:44+00:00

This is not specific to Ruby, but I happen to be using Ruby at

  • 0

This is not specific to Ruby, but I happen to be using Ruby at the moment.
Here is a class that provides text printing functionality.

class Printer

  # some static methods

  def self.fancy_print(text)
     # do fancy formatting
  end

  def self.print(text)
     fancy_print(text)
  end

  # some instance methods

  def initialize(text)
    @text = text
  end

  def print
    #somehow call fancy_print(@text)
  end
end

Is it bad design to provide both instance and static methods in a class?

Sometimes I would like to keep several instances of Printer lying around. Other times, I just need to say Printer.print(text) and just grab that text without bothering to store it for later, hence resulting in a static print method and an instance print method.

  • 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-09T21:41:46+00:00Added an answer on June 9, 2026 at 9:41 pm

    No, it’s not bad design.

    It’s completely normal–some methods are class methods, some are instance methods. I’m not sure what the perceived issue might even be. It’s somewhat difficult to even find classes with only one or the other, although in Java you frequently see static utility classes.

    Edit IMO the question is misleading; you’re actually asking if it’s bad design to have static and instance methods of the same name.

    It’s tricky if both are public because it isn’t necessarily obvious how to use the class. In other words, is it designed to be used via the static, or instance method? Both? What’s different about them? Should that difference be… differentiated by a name?

    Ultimately it depends on context and usage–there’s no single answer.

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

Sidebar

Related Questions

This is not a specific question but a generic question which was in my
I have seen a few posts regarding this issue but not one specific to
This is not a question about a specific framework. I am using plain php
First of I'm very sorry but this questions is not so so specific. All
I found some threads saying this was doable, but did not find specific instructions
I know this is not specific to tk, but rather a more general problem
Not sure if this is against stackoverflow rules as it's not a specific code
This is a general question. And may not be specific to datagrids. How can
(This question does not rely on a specific IoC framework, so the interfaces and
I'm not sure if this is a flask specific issue or if I simply

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.