How to direct authenticated and anonymous users to different ( custom ) front pages? I want anonymous users to always see /node/1 but authenticated users to see /myview/uid where uid is the current user's id.

I don't want to use Rules, but would prefer a code solution.
You can use hook_user_login function to achieve this.

function custom_module_user_login(&amp;$edit, $account){
  if($acount-&gt;uid &gt; 0) {
          $redirection = 'myview/'.$acount-&gt;uid;  
  } else{
      $redirection = 'node/1';
  }

  // Unless there is already a redirection going, or the user is trying to reset his password, we redirect to $redirection.

  if (!is_null($redirection) &amp;&amp; (!isset($_POST['form_id']) || $_POST['form_id'] != 'user_pass_reset')){
    $_GET['destination'] = $redirection; // Should we use $edit['redirect'] instead..?
    $GLOBALS['destination'] = $redirection; // Should we use $edit['redirect'] instead..?
  }


}

For more info check here