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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:34:30+00:00 2026-05-15T19:34:30+00:00

I am building a tool. I have a Collection Class that stores data gathered

  • 0

I am building a tool. I have a Collection Class that stores data gathered from files on network. (Why? because reading from network files was more time consuming than reading all data at once and storing data into an object)
I need to use the same instance in various different classes.
I looked over the pro’s and con’s of Singleton Classes, and decided to use it since I felt passing around a serialized object of my Collection Class was not a good idea.

Is this a good programming technique? or is there a better solution. I can provide more details if I am not being clear

Thanks,
– Ivar
P.S: I am not sure if this has been already asked on SO, please guide me to the right post if Yes.

  • 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-15T19:34:31+00:00Added an answer on May 15, 2026 at 7:34 pm

    It depends on what your singleton does. I’ll assume that our singleton gathers up files for some reason and then performs some sort of aggregation on them. If that’s the case, singleton migh be an OK idea.

    If you’re using the singleton as a cache, that could make sense as well assuming the singleton object is the object responsible for maintaining the cache. Since I don’t know your platform, I can’t tell you to use an specific cache manager instead…

    That being said, singletons are often an overused programming construct, and you should be somewhat wary of them. When making a decision about whether or kit to use one, ask yourself if the singleton manages a single constrained resource of some type. That’s usually the only reason I find myself using them.

    It’s just about impossible to tell you I the desgn makes sense, though, I we don’t know what happens to the data and how it’s supposed to happen.

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

Sidebar

Related Questions

We have an application (a custom network management tool for building automation) that supports
I'm building a little tool that will download files using wget, reading the urls
I'm building a tool that authors/edits XML files, and I want to be able
I'm currently building a tool that will have to match filenames against a pattern.
I am building a survey tool that will have different layouts and 'inquisitorial' processes
I have a Flash developer I'm working with. This person is building a tool
I'm building a tool that performs xpath 1.0 queries on XHTML documents. The requirement
I am building a command line tool which relies on some configuration files. On
I have created a xcode project using unity3d tool, while building the project for
I'm building a tool where as exceptions propagate upwards, new data about the context

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.