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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:01:35+00:00 2026-05-26T08:01:35+00:00

I have a noob question regarding how to architect my iPhone app. I have

  • 0

I have a noob question regarding how to architect my iPhone app.

I have two main components, a map and an audio player, both self contained classes (MapController and AudioController). I read this great article and am trying to apply it to my app:

http://blog.shinetech.com/2011/06/14/delegation-notification-and-observation/

I have a third class, WebServices, that handles uploading POST data to my server as well as making queries to external API’s.

My question:

  1. Do I import header files, and create a new instance of WebServices in both the map controller, and the audio player? And then each controller can reference it’s own WebServices for queries?
  2. Or, should I create one WebServices instance on the RootController, and then pass this to the map and audio controllers on init?

In particular, I’m interested in which approach consumes memory more efficiently. Or if it doesn’t matter at all.

Thanks!

  • 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-26T08:01:36+00:00Added an answer on May 26, 2026 at 8:01 am

    Point Zero

    Do not resort to singletons, and especially not in multithreaded contexts. You can search this site if you need explanations (hint: the reasons against them are quite similar in OO languages similar to ObjC. e.g. C++, Java, C#…).

    To share, or not?

    It ultimately depends on the behavior your design needs, but I favor Option #1 as the default.

    • If you need multiple instances, do not be afraid create multiple (unless you have a really, really, really good reason not to).
    • If they are heavy to construct, consider what immutable data they can share.
    • Favor smaller, specialized objects (WebServices may be huge). Smaller objects allow more flexibility and reduce the chances that your program will compete for resources.
    • What will you gain in this case by sharing? Often, this just increases runtime and implementation complexity… but there can be gains. Without identifying those gains, you should stick to multiple instances to reduce complexity.
    • Multiple instances allow your program to perform multiple asynchronous requests, based on what they need. Multiple async requests is fine (but it will obviously be slow if you have too many active requests).
    • Most programs are more logical and easy to maintain when the objects they depend on allow multiple instances (they do not enforce sharing).

    Assume multiple instances (1) until have identified a problem. Even after the problem is identified, you can usually avoid sharing.

    To determine which consumes less memory requires much more information. If the objects you are considering sharing are not huge (very unlikely), they themselves are not problems wrt memory consumption.

    Either approach proposed can result in more memory consumption – it depends entirely on the context and execution. We’ll need some more information to answer this specifically.

    This is not to imply that sharing is bad, but sharing usually complicates things because you need to design objects to behave predictably when shared (especially since you are operating in a multithreaded context).

    Ask yourself:

    • What significant benefit(s) would sharing WebServices provide?
    • How would sharing WebServices improve your program and reduce complexity?

    It’s likely the case that the WebServices map stuff does not interact with the audio stuff. In that case, WebServices may be a good candidate for a base class, where the audio and map services are separate subclasses (assuming the WebServices class is already complex).

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

Sidebar

Related Questions

another noob question regarding F#. If I have the following code... let ExeC =
noob question regarding ios development. In a previous project, I have a UITableViewController, to
a noob question here. I have an app that does number calculations. I support
bit of noob question regarding .Net and C#. I have a function that registers
I'm a perl noob and I have a very basic question regarding the @INC
Complete noob question, so apologies for that. I have two tables, a members table
Noob question here! I have an array with hashes that looks like this: arr
Noob question. I have an activate handler in a child List , but it
Bit of a noob question but: I have a custom class defined as: public
Noob question, apologies. I'm compiling Java in Windows Vista's command-line and have so many

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.