title: Magento getSingleton confusion
body: <p>I'm a little confused about calls I see to <code>Mage::getSingleton</code>, and I'm hoping someone can help me understand a little better.</p>
  
  <p>I have seen a piece of core code that does this:</p>
  
  <pre><code>Mage::getSingleton('customer/session')-&gt;isLoggedIn()
  </code></pre>
  
  <p>I don't know PHP, but I think I can make a safe assumption from the <strong>getSingleton</strong> method name that there will be only one instance of the class specified (the class being specified as a grouped class name, and resolving to <code>app/code/core/Mage/Customer/Model/Session.php</code> - containing class <code>Mage_Customer_Model_Session</code>.</p>
  
  <p><strong>Question 1</strong> - </p>
  
  <p>How did the getSingleton method know to look in the Model folder for the class?</p>
  
  <p><strong>Question 2</strong> - </p>
  
  <p>So there is one instance of the class for the whole ... I want to say JVM as I am from a Java background, but I'll say PHP engine in the hope that that is vaguely the correct terminology; the <code>Mage_Customer_Model_Session</code> is not passed in a customer id or any such identifier, yet we call the method <code>isLoggedIn()</code>! Give there is not a <code>Mage_Customer_Model_Session</code> instance per customer, how can we ask a singleton if a customer is logged in when we do not tell it what customer we are talking about? </p>
  
  <p><strong>Question 3</strong> - </p>
  
  <p>I've seen calls to <code>Mage::getSingleton('core/session')</code> and to <code>Mage::getSingleton('customer/session')</code> - what is the difference?</p>
  
  <p>Thank you for any help.</p>