Not too sure about template.php I'm primarily a designer and I've been working on Drupal themes for some time now. At this point, I'm comfortable enough converting my designs to Drupal themes reasonably quickly but I continue to have doubts about how to use the template.php file... I've read up about it quite a bit, but my understanding of its usefulness is theoretical at best. 

Clearly it's not a required file since it's never stopped my themes from working in the past, but is it advisable to have one in all cases? Are there functions (or anything else for that matter) one would automatically include in template.php?
The template.php file should contain the presentation code; the "logic" code, such as the theme functions, or other code that computes the value of a variable, should be in the template.php file.

To make an example, code similar to the following one should not be in the template file, but it should be put in a function contained in the template.php file, and which return a value to the calling code, which then uses the returned code:

  if ($user-&gt;uid) {
    $class[] = 'authenticaded-user';

    if (user_access('administer content')) {
      $class[] =  'content-administrator';
    }
  }
  else {
    $class[] = 'anonymous-user';
    $class[] = 'anonymous-' . strtr(ip_address(), '.', '-'); 
  }

  if (isset($class)) {
    print ' class="' . implode(' ', $class) . '"';
  }


The code in the template file should just print (or render) values, but not compute those values; clearly, it's perfectly fine to use code similar to the following one (the code is taken from a Drupal 7 theme):

    &lt;?php if ($logo || $site_title): ?&gt;
      &lt;?php if ($title): ?&gt;
        &lt;div id="branding"&gt;&lt;strong&gt;&lt;a href="&lt;?php print $front_page ?&gt;"&gt;
        &lt;?php if ($logo): ?&gt;
          &lt;img src="&lt;?php print $logo ?&gt;" alt="&lt;?php print $site_name_and_slogan ?&gt;" title="&lt;?php print $site_name_and_slogan ?&gt;" id="logo" /&gt;
        &lt;?php endif; ?&gt;
        &lt;?php print $site_html ?&gt;
        &lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;
      &lt;?php else: /* Use h1 when the content title is empty */ ?&gt;
        &lt;h1 id="branding"&gt;&lt;a href="&lt;?php print $front_page ?&gt;"&gt;
        &lt;?php if ($logo): ?&gt;
          &lt;img src="&lt;?php print $logo ?&gt;" alt="&lt;?php print $site_name_and_slogan ?&gt;" title="&lt;?php print $site_name_and_slogan ?&gt;" id="logo" /&gt;
        &lt;?php endif; ?&gt;
        &lt;?php print $site_html ?&gt;
        &lt;/a&gt;&lt;/h1&gt;
    &lt;?php endif; ?&gt;
    &lt;?php endif; ?&gt;


The difference is that, in this case, the code is verifying if the variable contains a useful value, and eventually avoid to output the markup, when it's not necessary.