title: PHP includes vs OOP
body: <p>I would like to have a reference for the pros and cons of using include <strong>files vs objects(classes)</strong> when developing PHP applications.</p>
  
  <p>I know I would benefit from having one place to go for this answer...I have a few opinions of my own but I look forward to hearing others.</p>
  
  <p><strong>A Simple Example:</strong></p>
  
  <p>Certain pages on my site are only accessible to logged in users. I have two options for implementation (there are others but let's limit it to these two)</p>
  
  <ol>
  <li><p><em>Create an authenticate.php file and include it on every page. It holds the logic for authentication.</em></p></li>
  <li><p><em>Create a user object, which has an authenticate function, reference the object for authentication on every page.</em> </p></li>
  </ol>
  
  <p><strong>Edit</strong>
  I'd like to see some way weigh the benefits of one over the other. 
  My current (and weak reasons) follow:</p>
  
  <p>Includes - Sometimes a function is just easier/shorter/faster to call
  Objects - Grouping of functionality and properties leads for longer term maintenance.</p>
  
  <p><strong>Includes</strong> - Less code to write (no constructor, no class syntax) call me lazy but this is true.</p>
  
  <p><strong>Objects</strong> - Force formality and a single approach to functions and creation. </p>
  
  <p><strong>Includes</strong> - Easier for a novice to deal with
  Objects - Harder for novices, but frowned upon by professionals.</p>
  
  <p>I look at these factors at the start of a project to decide if I want to do includes or objects.
  Those are a few pros and cons off the top of my head.</p>