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

  • Home
  • SEARCH
  • 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 3335658
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:02:37+00:00 2026-05-18T00:02:37+00:00

In Programming in Scala: A Comprehensive Step-by-Step Guide , the author said: One way

  • 0

In Programming in Scala: A Comprehensive Step-by-Step Guide, the author said:

One way in which Scala is more
object-oriented than Java is that
classes in Scala cannot have static
members. Instead, Scala has singleton
objects.

Why is a singleton object more object-oriented? What’s the good of not using static members, but singleton objects?

  • 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-05-18T00:02:38+00:00Added an answer on May 18, 2026 at 12:02 am

    Trying for the “big picture”; most of this has been covered in other answers, but there doesn’t seem to be a single comprehensive reply that puts it all together and joins the dots. So here goes…

    Static methods on a class are not methods on an object, this means that:

    1. Static members can’t be inherited from a parent class/trait
    2. Static members can’t be used to implement an interface
    3. The static members of a class can’t be passed as an argument to some function

      (and because of the above points…)

    4. Static members can’t be overridden
    5. Static members can’t be polymorphic

    The whole point of objects is that they can inherit from parent objects, implement interfaces, and be passed as arguments – static members have none of these properties, so they aren’t truly object-oriented, they’re little more than a namespace.

    Singleton objects, on the other hand, are fully-fledged members of the object community.


    Another very useful property of singletons is that they can easily be changed at some later point in time to not be singletons, this is a particularly painful refactoring if you start from static methods.

    Imagine you designed a program for printing addresses and represented interactions with the printer via static methods on some class, then later you want to be able to add a second printer and allow the user to chose which one they’ll use… It wouldn’t be a fun experience!

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

Sidebar

Related Questions

Functional programming seems to be a paradigm in computer science which has more and
In Chapter 3 of Programming Scala , the author gives two examples of for
Programming is learned by writing programs. But code reading is said to be another
Some programming languages such as Java and C# include encryption packages in their standard
I'm a newbie to scala. I'm trying an example from the book Programming Scala.
I just finished Programming in Scala , and I've been looking into the changes
In the book Programming in Scala from Martin Odersky there is a simple example
I'm quite new to Scala programming language, and was trying something out stucked in
I was working through the Programming in Scala book, and was struck by a
Programming Student here...trying to work on a project but I'm stuck. The project is

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.