Global Variables vs. Singletons

As I was working on my settings view last night, I stumbled across the wikipedia entry on singletons. I had planned on creating a global settings view variable for all my other views to access. But I was concerned that the settings view might not be allocated at the right time or become deallocated. Using the singleton was a much better approach because it allowed me to explicitly control the initialization.

Comments

2 responses to “Global Variables vs. Singletons”

  1. NinjaHERO Avatar

    I have no idea what any of that means, but I like Wikipedia too.

    Keep up the good work.

  2. Deluxe Avatar
    Deluxe

    =)
    Singleton is one of the most used design patterns, if not the most.
    You should take a look at the others, it’s really interesting.

    Ps: F*ck off iPod Dictionnary. Humm. Sorry.