<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="styleguide.xsl"?>
<!--<GUIDE title="Google Objective-C Style Guide">-->
<GUIDE title="Google Objective-Cスタイルガイド 日本語訳">
<!-- r23 -->
<div align="center">
これは<a href="http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml">Google Objective-C Style Guide (2.12)</a>の日本語訳です。<br/><a href="http://dev.perl.org/licenses/">Artistic License/GPL</a>で配布します。<br/>最終更新: 2009-07-01
</div>

<p align="right">

Revision 2.12
</p>



<div align="right">
  <address>
    Mike Pinkerton<br/>
    Greg Miller <br/>
    Dave MacLachlan <br/>
    （日本語訳 <a href="http://www.textdrop.net/">Takashi Sasai</a>）
  </address>
</div>
  
<OVERVIEW>

<!--
<CATEGORY title="Important Note">
-->
<CATEGORY title="重要な注意">
<!--
  <STYLEPOINT title="Displaying Hidden Details in this Guide">
-->
  <STYLEPOINT title="詳細情報の表示">
     <SUMMARY>
<!--
       This style guide contains many details that are initially
       hidden from view.  They are marked by the triangle icon, which you
       see here on your left.  Click it now.
       You should see "Hooray" appear below.
-->
       このスタイルガイドには詳細情報がたくさん含まれているが、最初は表示されていない。左端にある矢印ボタンをクリックしてみよう。
       「やったね」と表示されるはずだ。
     </SUMMARY>
     <BODY>
       <p>
<!--
        Hooray!  Now you know you can expand points to get more
        details.  Alternatively, there's an "expand all" at the
        top of this document.
-->
        やったね! このように矢印ボタンをクリックすると詳細情報が表示される。
        このドキュメントの先頭にある大きな矢印ボタンをクリックしてもいい。詳細情報が全部表示される。
       </p>
     </BODY>
  </STYLEPOINT>
</CATEGORY>

<!--<CATEGORY title="Background">-->
<CATEGORY title="背景">

  <p>
<!--
    Objective-C is a very dynamic, object-oriented extension of C.  It's
    designed to be easy to use and read, while enabling sophisticated
    object-oriented design. It is the primary development language for new
    applications on Mac OS X and the iPhone.
-->
    Objective-Cは、C言語に対して動的なオブジェクト指向拡張をかなり追加したプログラミング言語だ。この言語は使いやすく読みやすいように設計されており、複雑なオブジェクト指向設計ができるようになっている。Objective-Cは、Mac OS XとiPhone上で動く、新しいアプリケーションを開発するための主要な開発言語になっている。
  </p>
    
  <p>
<!--
    Cocoa is one of the main application frameworks on Mac OS X. It is a
    collection of Objective-C classes that provide for rapid development of
    full-featured Mac OS X applications.
-->
    Cocoaとは、Mac OS Xにおける主要なアプリケーションフレームワークの1つだ。これはObjective-Cクラスの集合で構成されており、Cocoaを使うことで、フル機能のMac OS Xアプリケーションをすばやく開発することができる。
  </p>

  <p>
<!--
    Apple has already written a very good, and widely accepted, coding guide
    for Objective-C. Google has also written a similar guide for C++. This
    Objective-C guide aims to be a very natural combination of Apple's and
    Google's general recommendations. So, before reading this guide, please make
    sure you've read:
-->
    Appleはすでに、非常に優れ、かつ、広く受け入れられているObjective-Cコーディングガイドを公開している。Googleもまた、C++コーディングガイドを公開している。このObjective-Cガイドの目標は、AppleとGoogleの一般的な推奨事項をほぼそのまま組み合わせることだ。したがって、このガイドを読む前に、まず以下を読んでおくことが望ましい。
    <ul>
      <li>
        <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html">
<!--
          Apple's Cocoa Coding Guidelines
-->
          AppleのCocoaコーディングガイドライン
        </a>
      </li>
      <li>
        
        <div>
          <a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">
<!--
            Google's Open Source C++ Style Guide
-->
            GoogleのオープンソースC++スタイルガイド
          </a>
        </div>
      </li>
    </ul>
  </p>

  

  <p>
<!--
    <em>Note that all things that are banned in Google's C++ guide are also
    banned in Objective-C++, unless explicitly noted in this document.</em>
-->
    たとえ本ドキュメントに明記されていなくても、GoogleのC++スタイルガイドで禁止されていることはすべて、Objective-C++でも禁止されていることに注意しよう。
  </p>

  <p>
<!--
    The purpose of this document is to describe the Objective-C (and
    Objective-C++) coding guidelines and practices that should be used for all
    Mac OS X code. Many of these guidelines have evolved and been proven over
    time on other projects and teams.
    
    Open-source projects developed by Google
    conform to the requirements in this guide.
-->
本ドキュメントの目的は、あらゆるMac OS Xコードで使われるべき、Objective-C（および、Objective-C++）のコーディングガイドラインとプラクティスについて説明することだ。このガイドラインの多くは、いろいろなプロジェクトやチームで何年もかけて作り上げられたものであり、その有効性が実証されている。

    Googleによって開発されているオープンソースプロジェクトは、このスタイルガイドに従っている。
  </p>
  <p>
<!--
    Google has already released open-source code that conforms to these
    guidelines as part of the 
    <a href="http://code.google.com/p/google-toolbox-for-mac/">
      Google Toolbox for Mac project
    </a>
    (abbreviated GTM throughout this document).
    Code meant to be shared across different projects is a good candidate to
    be included in this repository.
-->
    Googleはすでに、
    <a href="http://code.google.com/p/google-toolbox-for-mac/">
      Google Toolbox for Mac project
    </a>
    （本ドキュメントでは省略してGTMとする）の一部として、このガイドラインに従ったオープンソースコードをリリースしている。他のプロジェクトと共有するつもりのあるコードは、このリポジトリに入れておくのが望ましい。
  </p>
  
  

  <p>
<!--
    Note that this guide is not an Objective-C tutorial. We assume that the
    reader is familiar with the language. If you are new to Objective-C or
    need a refresher, please read 
    <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">
      The Objective-C Programming Language
    </a>.
-->
    このガイドはObjective-Cのチュートリアルではないことに注意しよう。これを読む人はObjective-Cをよく知っていることを想定している。Objective-Cを使うのが初めての人や、もう少し勉強が必要だと感じる人は、まず
    <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">
      The Objective-C Programming Language
    </a>
    を読んでみよう。
  </p>
</CATEGORY>
</OVERVIEW>

<!--
<CATEGORY title="Example">
-->
<CATEGORY title="例">

  <p>
<!--
    They say an example is worth a thousand words so let's start off with an
    example that should give you a feel for the style, spacing, naming, etc.
-->
    百聞は一見にしかず、ということわざがある。まずは例を見てみよう。スタイル、空白、命名規則などの雰囲気がつかめるはずだ。
  </p>

  <p>
<!--
    An example header file, demonstrating the correct commenting and spacing
    for an <code>@interface</code> declaration
-->
    ヘッダファイルの例。<code>@interface</code> 宣言のための正しいコメントと空白がどのようなものかわかるだろう。
  </p>

<CODE_SNIPPET>
    //  GTMFoo.h
    //  FooProject
    //
    //  Created by Greg Miller on 6/13/08.
    //  Copyright 2008 Google, Inc. All rights reserved.
    //
    
    #import &lt;Foundation/Foundation.h&gt;
    
    // A sample class demonstrating good Objective-C style. All interfaces,
    // categories, and protocols (read: all top-level declarations in a header)
    // MUST be commented. Comments must also be adjacent to the object they're
    // documenting.
    //
    // (no blank line between this comment and the interface)
    @interface GTMFoo : NSObject {
     @private
      NSString *foo_;
      NSString *bar_;
    }
    
    // Returns an autoreleased instance of GMFoo. See -initWithString: for details
    // about the argument.
    + (id)fooWithString:(NSString *)string;
    
    // Designated initializer. |string| will be copied and assigned to |foo_|.
    - (id)initWithString:(NSString *)string;
    
    // Gets and sets the string for |foo_|.
    - (NSString *)foo;
    - (void)setFoo:(NSString *)newFoo;
    
    // Does some work on |blah| and returns YES if the work was completed
    // successfuly, and NO otherwise.
    - (BOOL)doWorkWithString:(NSString *)blah;
    
    @end
  </CODE_SNIPPET>
  
  <p>
<!--
    An example source file, demonstating the correct commenting and spacing
    for the <code>@implementation</code> of an interface. It also includes the
    reference implementations for important methods like getters and setters,
    <code>init</code>, and <code>dealloc</code>.
-->
    ソースファイルの例。インタフェースの <code>@implementation</code> のための正しいコメントと空白がどのようなものかわかるだろう。ここにはゲッタやセッタ、<code>init</code> や <code>dealloc</code> といった主要なメソッドのリファレンス実装も含まれている。
  </p>
  
  <CODE_SNIPPET>
    //
    //  GTMFoo.m
    //  FooProject
    //
    //  Created by Greg Miller on 6/13/08.
    //  Copyright 2008 Google, Inc. All rights reserved.
    //
    
    #import "GTMFoo.h"
    
    
    @implementation GTMFoo
    
    + (id)fooWithString:(NSString *)string {
      return [[[self alloc] initWithString:string] autorelease];
    }
    
    // Must always override super's designated initializer.
    - (id)init {
      return [self initWithString:nil];
    }
    
    - (id)initWithString:(NSString *)string {
      if ((self = [super init])) {
        foo_ = [string copy];
        bar_ = [[NSString alloc] initWithFormat:@"hi %d", 3];
      }
      return self;   
    }
    
    - (void)dealloc {
      [foo_ release];
      [bar_ release];
      [super dealloc];
    }
    
    - (NSString *)foo {
      return foo_;
    }
    
    - (void)setFoo:(NSString *)newFoo {
      [foo_ autorelease];
      foo_ = [newFoo copy];   
    }
    
    - (BOOL)doWorkWithString:(NSString *)blah {
      // ...
      return NO;
    }
    
    @end
  </CODE_SNIPPET>

</CATEGORY>

<!--
<CATEGORY title="Spacing And Formatting">
-->
<CATEGORY title="空白と書式">

<!--
  <STYLEPOINT title="Spaces vs. Tabs">
-->
  <STYLEPOINT title="スペース 対 タブ">
    <SUMMARY>
<!--
      Use only spaces, and indent 2 spaces at a time.
-->
      スペースだけを使う。インデントはスペース2つにする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        We use spaces for indentation. Do not use tabs in your code.
        You should set your editor to emit spaces when you hit the tab
        key.
-->
        インデントにスペースを使う。コードにはタブを使ってはいけない。
        タブキーを押したときにはスペースが入力されるように、エディタを設定しておこう。
      </p>
    </BODY>
  </STYLEPOINT>

<!--
  <STYLEPOINT title="Line Length">
-->
  <STYLEPOINT title="行の長さ">
    <SUMMARY>
<!--
      Each line of text in your code should be at most 80 characters long.
-->
      コードにおいて、テキスト1行の長さは、長くても80文字にすべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Even though Objective-C tends to be a more verbose language than C++,
        to aid in the interoperability with that guide, we have decided
        to keep the limit at 80 columns as well. It's easier to live with
        than you might expect.
-->
        Objective-CはC++と比べて言葉が長くなりがちな言語ではあるが、C++のガイドと相互運用できるよう、C++と同じ80カラムに制限することにした。これを受け入れるのは意外と簡単なことだ。
      </p>
      
      <p>
<!--
        We recognize that this rule is controversial, but so much existing
        code already adheres to it, and we feel that consistency is
        important.
-->
        このルールには賛否両論あると思うが、すでに既存のコードのほとんどがこれを守っているし、私たちは一貫性が重要だと思っている。
      </p>
      <p>
<!--
        You can make violations easier to spot in Xcode by going to <i>Xcode
        &gt; Preferences &gt; Text Editing &gt; Show page guide</i>.
-->
        Xcodeでは、<i>Xcode &gt; 環境設定 &gt; テキスト編集 &gt; ページガイドを表示</i> で設定しておくことで、これに違反している場所を簡単に見つけることができる。
      </p>
    </BODY>
  </STYLEPOINT>

<!--
  <STYLEPOINT title="Method Declarations and Definitions">
-->
  <STYLEPOINT title="メソッドの宣言と定義">
    <SUMMARY>
<!--
      One space should be used between the <code>-</code> or <code>+</code>
      and the return type, and no spacing in the parameter list except between
      parameters.
-->
      <code>-</code> や <code>+</code> と戻り値との間には、スペースを1つ入れるべきだ。パラメータリストには、パラメータ間のスペースを除いて、スペースを入れるべきではない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Methods should look like this:
-->
        メソッドは次のようになるはずだ:
      </p>
      <CODE_SNIPPET>
        - (void)doSomethingWithString:(NSString *)theString {
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        The spacing before the asterisk is optional. When adding new code,
        be consistent with the surrounding file's style.
-->
        アスタリスク（*）の前にはスペースを入れても入れなくてもいい。コードを新しく追加するときには、まわりのファイルのスタイルに合わせること。
      </p>
      <p>
<!--
        If you have too many parameters to fit on one line, giving each its
        own line is preferred. If multiple lines are used, align each using 
        the <code>:</code> before the parameter.
-->
        パラメータが多すぎて1行に収まらなければ、1行につき1つのパラメータを書くのが望ましい。複数行にわたるときには、パラメータの前にある <code>:</code> で整列させること。
      </p>
      <CODE_SNIPPET>
        - (void)doSomethingWith:(GTMFoo *)theFoo
                           rect:(NSRect)theRect
                       interval:(float)theInterval {
          ...
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  
  <STYLEPOINT title="@public and @private">
-->
  <STYLEPOINT title="@public と @private">
    <SUMMARY>
<!--
      The <code>@public</code> and <code>@private</code> access modifiers
      should be indented by 1 space.
-->
      <code>@public</code> と <code>@private</code> アクセス修飾子はスペース1つでインデントするべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        This is similar to <code>public</code>, <code>private</code>, and
        <code>protected</code> in C++.
-->
        このルールはC++の <code>public</code>、<code>private</code>、<code>protected</code> と同じだ。
      </p>
      <CODE_SNIPPET>
        @interface MyClass : NSObject {
         @public
          ...
         @private
          ...
        }
        @end
      </CODE_SNIPPET>      
    </BODY>
  </STYLEPOINT>

<!--
  <STYLEPOINT title="Exceptions">
-->
  <STYLEPOINT title="例外">
    <SUMMARY>
<!--
      Format exceptions with each <code>@</code> label on its own line and a
      space between the <code>@</code> label and the opening brace
      (<code>{</code>), as well as between the <code>@catch</code> and the
      caught object declaration.
-->
      例外はそれぞれの <code>@</code> ラベルを1行として、<code>@</code> ラベルと開き括弧（<code>{</code>）の間にスペースを1つ入れる、という書式にすること。また、<code>@catch</code> とキャッチされるオブジェクトの宣言との間にも同様に、スペースを1つを入れること。
    </SUMMARY>
    <BODY>
      <p>
<!--
        If you must use Obj-C exceptions, format them as follows.  However, see
        <a href="#Avoid_Throwing_Exceptions">Avoid Throwing Exceptions</a> for
        reasons why you <b>should not</b> be using exceptions.
-->
        もしObjective-Cの例外を使わなければならないなら、次のような書式にすること。しかし、例外を使う<b>べきではない</b>理由について、<a href="#Avoid_Throwing_Exceptions">例外を投げるのをやめる</a>を参照すること。
      </p>
      <CODE_SNIPPET>
        @try {
          foo();
        }
        @catch (NSException *ex) {
          bar(ex);
        }
        @finally {
          baz();
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
  
</CATEGORY>

<!--
<CATEGORY title="Naming">
-->  
<CATEGORY title="命名規則">

  <p>
<!--
    Naming rules are very important in maintainable code. Objective-C method
    names tend to be very long, but this has the benefit that a block of code
    can almost read like prose, thus rendering many comments unnecessary. 
-->
    コードをメンテナンス可能にするには命名規則が極めて重要になる。Objective-Cのメソッド名は非常に長くなりがちだが、コードが文章のように読めるという利点がある。このおかげでコメントをたくさん入れておく必要はないはずだ。
  </p>
    <p> 
<!-- When writing pure Objective-C code, we mostly follow standard <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html">Objective-C
    naming rules</a>. These naming guidelines may differ
    significantly from those outlined in the C++ style guide. For example,
    Google's C++ style guide recommends the use of underscores between words
    in variable names, whereas this guide recommends the use of intercaps,
    which is standard in the Objective-C community.
-->
    純粋なObjective-Cコードを書くときには、私たちは標準である<a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html">Objective-C naming rules</a>にほぼ従っている。ここにある命名ガイドラインはC++スタイルガイドで説明したものとは大きく異なっている。例えば、Google C++スタイルガイドでは変数名には単語と単語の間にアンダースコア（_）を入れたものを使うことを推奨しているが、このガイドではインターキャプス（intercaps）を使うことを推奨している。Objective-Cの世界ではこれが標準のやり方になっている。
 </p>
  <p>
<!--
    When writing Objective-C++, however, things are not so cut and dry. Many
    projects need to implement cross-platform C++ APIs with some Objective-C
    or Cocoa, or bridge between a C++ back-end and a native Cocoa front-end.
    This leads to situations where the two guides are directly at odds.
-->
    しかし、Objective-C++コードを書くときにはそう単純な話ではない。多くのプロジェクトでは、Objective-CやCocoaと一緒にクロスプラットフォームのC++ APIを実装したり、C++バックエンドとネイティブCocoaフロントエンド間のブリッジを実装したりする必要がある。この結果、2つのガイドラインが直接衝突するという事態が発生してしまうのだ。
  </p>
  <p>
<!--
    Our solution is that the style follows that of the method/function being
    implemented. If you're in an <code>@implementation</code> block, use the
    Objective-C naming rules. If you're implementing a method for a C++
    <code>class</code>, use the C++ naming rules. This avoids the situation
    where instance variable and local variable naming rules are mixed within a
    single function, which would be a serious detriment to readability.
-->
    ここで私たちが採用する解決策は、実装しようとしているメソッド/関数のガイドラインに従おうというものだ。もし <code>@implementation</code> ブロックの中であればObjective-Cの命名規則を使おう。もしC++の <code>class</code> の中にあるメソッドを実装しているのであればC++の命名規則を使おう。こうするとインスタンス変数とローカル変数の命名規則が1つの関数の中で混ざることはなくなる。命名規則が混ざってしまうと、極めて読みにくいコードになってしまうだろう。
  </p>

<!--
  <STYLEPOINT title="File Names">
-->
  <STYLEPOINT title="ファイル名">
    <SUMMARY>
<!--
      File names should reflect the name of the class implementation that
      they contain - - including case. Follow the convention that your
      
      project
      uses.
-->
      ファイル名は、そのファイルに含まれているクラス実装の名前を、大文字と小文字の違いも含めて、反映したものにするべきだ。プロジェクトで使っている規約に従うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        File extensions should be as follows:
-->
        ファイル拡張子は次のようにするべきだ:
      </p>
      <table>
        <tr>
          <td><code>.h</code></td>
<!--
          <td>C/C++/Objective-C header file</td>
-->
          <td>C/C++/Objective-Cのヘッダファイル</td>
        </tr>
        <tr>
          <td><code>.m</code></td>
<!--
          <td>Objective-C implementation file</td>
-->
          <td>Objective-Cの実装ファイル</td>
        </tr>
        <tr>
          <td><code>.mm</code></td>
<!--
          <td>Objective-C++ implementation file</td>
-->
          <td>Objective-C++の実装ファイル</td>
        </tr>
        <tr>
          <td><code>.cc</code></td>
<!--
          <td>Pure C++ implementation file</td>
-->
          <td>純粋なC++の実装ファイル</td>
        </tr>
        <tr>
          <td><code>.c</code></td>
<!--
          <td>C implementation file</td>
-->
          <td>Cの実装ファイル</td>
        </tr>
      </table>
      <p>
<!--
        File names for categories should include the name of the class being
        extended, e.g. <code>GTMNSString+Utils.h</code> or
        <code>GTMNSTextView+Autocomplete.h</code>
-->
        カテゴリのファイル名には拡張されるクラス名を含むようにするべきだ。例えば、<code>GTMNSString+Utils.h</code> や <code>GTMNSTextView+Autocomplete.h</code>。
      </p>
    </BODY>
  </STYLEPOINT>

  <STYLEPOINT title="Objective-C++">
    <SUMMARY>
<!--
      Within a source file, Objective-C++ follows the style of the
      function/method you're implementing.
-->
      Objective-C++のソースファイルでは実装しようとしている関数/メソッドのスタイルに従うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        In order to minimize clashes between the differing naming styles when
        mixing Cocoa/Objective-C and C++, follow the style of the method being
        implemented. If you're in an <code>@implementation</code> block, use
        the Objective-C naming rules. If you're implementing a method for a
        C++ <code>class</code>, use the C++ naming rules.
-->
        Cocoa/Objective-CとC++が混在するときには、異なる命名スタイルが衝突してしまうのを最小限にするために、実装しようとしているメソッドのスタイルに従うこと。もし <code>@implementation</code> ブロックであればObjective-Cの命名規則を使うこと。もしC++の <code>class</code> の中にあるメソッドを実装しているのであればC++の命名規則を使うこと。
      </p>
      <CODE_SNIPPET>
        // file: cross_platform_header.h
        
        class CrossPlatformAPI {
         public:
          ...
          int DoSomethingPlatformSpecific();  // impl on each platform
         private:
          int an_instance_var_;
        };
        
        // file: mac_implementation.mm
        #include "cross_platform_header.h"
        
        // A typical Objective-C class, using Objective-C naming.
        @interface MyDelegate : NSObject {
         @private
          int instanceVar_;
          CrossPlatformAPI* backEndObject_;
        }
        - (void)respondToSomething:(id)something;
        @end
        @implementation MyDelegate
        - (void)respondToSomething:(id)something {
          // bridge from Cocoa through our C++ backend
          instanceVar_ = backEndObject-&gt;DoSomethingPlatformSpecific();
          NSString* tempString = [NSString stringWithInt:instanceVar_];
          NSLog(@"%@", tempString);
        }
        @end
        
        // The platform-specific implementation of the C++ class, using
        // C++ naming.
        int CrossPlatformAPI::DoSomethingPlatformSpecific() {
          NSString* temp_string = [NSString stringWithInt:an_instance_var_];
          NSLog(@"%@", temp_string);
          return [temp_string intValue];
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="Class Names">-->
  <STYLEPOINT title="クラス名">
    <SUMMARY>
<!--
      Class names (along with category and protocol names) should start as
      uppercase and use mixed case to delimit words.
-->
      クラス名（カテゴリ名やプロトコル名も同じ）は大文字で始めて、大文字と小文字の組み合わせで単語を区切るようにするべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        In <em>application-level</em> code, prefixes on class names should
        generally be avoided. Having every single class with same prefix
        impairs readability for no benefit. When designing code to be shared
        across multiple applications, prefixes are acceptable and recommended
        (e.g. <code>GTMSendMessage</code>).
-->
        <em>アプリケーションレベル</em>のコードでは通常、クラス名にプレフィックスを付けるべきではない。単体のクラスすべてに同じプレフィックスを付けても、読みにくくなるだけで得られるものはない。複数のアプリケーションで共通に使うコードを設計しているときには、プレフィックスを付けるのが望ましく付けることを推奨する。（例えば、<code>GTMSendMessage</code>）。
      </p>
      
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Category Names">-->
  <STYLEPOINT title="カテゴリ名">
    <SUMMARY>
<!--
      Category names should start with a 2 or 3 character prefix
      identifying the category as part of a project or open for general
      use. The category name should incorporate the name of the class it's
      extending.      
-->
      カテゴリ名はそのカテゴリがあるプロジェクトの一部であることや汎用でオープンなものであることがわかるように、2文字か3文字のプレフィックスで始めるべきだ。カテゴリ名にはそのカテゴリが拡張しているクラス名を盛り込んでおくべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        For example, if we want to create a category on <code>NSString</code>
        for parsing, we would put the category in a file named
        <code>GTMNSString+Parsing.h</code>, and the category itself would be
        named <code>GTMStringParsingAdditions</code> (yes, we know the file
        name and the category name do not match, but this file could have many
        separate categories related to parsing). Methods in that category
        should share the prefix (<code>gtm_myCategoryMethodOnAString:</code>)
        in order to prevent collisions in Objective-C which only has a single
        namespace. If the code isn't meant to be shared and/or doesn't run in
        a different address-space, the method naming isn't quite as
        important.
-->
        例えば、<code>NSString</code> にパースのためのカテゴリを作成したいなら、<code>GTMNSString+Parsing.h</code> という名前のファイルにカテゴリを入れておく。そして、カテゴリ名を <code>GTMStringParsingAdditions</code> とする（もちろんファイル名とカテゴリ名が一致していないのはわかっている。でもこうすることで、このファイルにパースに関連した個別のカテゴリをいろいろと入れることができる）。同じカテゴリにあるメソッドには同じプレフィックス（<code>gtm_myCategoryMethodOnAString:</code>）を付けておくべきだ。こうしておくと、名前空間が1つしかないObjective-Cでも、名前の衝突を避けることができる。もしコードを共有するつもりがなかったり、別のアドレス空間で実行されるのであれば、メソッドの命名はそれほど重要ではない。
      </p>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="Objective-C Method Names">-->
  <STYLEPOINT title="Objective-Cのメソッド名">
    <SUMMARY>
<!--
      Method names should start as lowercase and then use mixed case.
      Each named parameter should also start as lowercase.
-->
      メソッド名は小文字で始めて、それ以降は大文字と小文字を組み合わせて使うようにするべきだ。それぞれの名前付きパラメータも小文字で始めるべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The method name should read like a sentence if possible, meaning you
        should choose parameter names that flow with the method name. (e.g.
        <code>convertPoint:fromRect:</code> or
        <code>replaceCharactersInRange:withString:</code>). See <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-BCIGIJJF">Apple's
        Guide to Naming Methods</a> for more details.
-->
        メソッド名はできるだけ文章のように読めるようにして、パラメータ名もメソッド名から続けて読めるようなものを選ぶべきだ。（例えば、<code>convertPoint:fromRect:</code>や
        <code>replaceCharactersInRange:withString:</code>）。詳しくは<a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-BCIGIJJF">Appleによるメソッドの命名ガイド</a>を参照すること。
      </p>
      <p>
<!--
        Accessor methods should be named the same as the variable they're
        "getting", but they should <em>not</em> be prefixed with the word
        "get". For example:
-->
        アクセサメソッドは「取得しようしている」変数と同じ名前にするべきだ。"get"というプレフィックスを付けるべきでは<em>ない</em>。
        <BAD_CODE_SNIPPET>
          - (id)getDelegate;  // AVOID
        </BAD_CODE_SNIPPET>
        <CODE_SNIPPET>
          - (id)delegate;    // GOOD
        </CODE_SNIPPET>
      </p>
      <p>
<!--
        This is for Objective-C methods only. C++ method names and functions
        continue to follow the rules set in the C++ style guide.
-->
        このルールはObjective-Cのメソッドにだけ適用される。C++のメソッド名や関数名はC++スタイルガイドにあるルールに従うこと。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Variable Names">-->
  <STYLEPOINT title="変数名">
    <SUMMARY>
<!--
      Variables names start with a lowercase and use mixed case to delimit
      words. Class member variables have trailing underscores. For example:
      <var>myLocalVariable</var>, <var>myInstanceVariable_</var>. Members
      used for KVO/KVC bindings may begin with a leading underscore
      <i>iff</i> use of Objective-C 2.0's <code>@property</code> isn't
      allowed.
-->
      変数名は小文字で始めて、大文字と小文字を組み合わせることで単語を区切るようにする。クラスメンバ変数はアンダースコア（_）で終わること。例: <var>myLocalVariable</var>、<var>myInstanceVariable_</var>。<i>もし</i>Objective-C 2.0の <code>@property</code> が使えないのであれば、KVO/KVCバインディング用のメンバをアンダースコアで始めても構わない。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Common Variable Names">-->
      <SUBSECTION title="共通の変数名">
        <p>
<!--
          Do <em>not</em> use Hungarian notation for syntactic attributes,
          such as the static type of a variable (int or pointer). Give as
          descriptive a name as possible, within reason. Don't worry about
          saving horizontal space as it is far more important to make your
          code immediately understandable by a new reader. For example:
-->
         変数のスタティック型（intやポインタ）のような構文上の属性のためにハンガリアン記法を使っては<em>いけない</em>。無理のない範囲で、できるだけわかりやすい名前にすること。水平スペースを節約しようとしてはいけない。新しくコードを読む人がすぐに理解できるようにしておくことの方がはるかに重要だ。
        </p>
        <BAD_CODE_SNIPPET>
          int w;     
          int nerr;          
          int nCompConns; 
          tix = [[NSMutableArray alloc] init];
          obj = [someObject object];
          p = [network port];
        </BAD_CODE_SNIPPET>
        <CODE_SNIPPET>
          int numErrors;                
          int numCompletedConnections; 
          tickets = [[NSMutableArray alloc] init];
          userInfo = [someObject object];
          port = [network port];
        </CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Instance Variables">-->
      <SUBSECTION title="インスタンス変数">
        <p>
<!--
          Instance variables are mixed case and should be suffixed with a
          trailing underscore, e.g. <var>usernameTextField_</var>. However,
          we permit an exception when binding to a member variable using
          KVO/KVC and Objective-C 2.0 cannot be used (due to OS release 
          constraints). In this case, it is acceptable to prefix the variable
          with an underscore, per Apple's accepted practices for key/value 
          naming. If Objective-C 2.0 can be used, <code>@property</code> and
          <code>@synthesize</code> provide a solution that conforms to the
          naming guidelines.
-->
          インスタンス変数は大文字と小文字を組み合わせて、アンダースコアで終わるようにするべきだ。例えば、<var>usernameTextField_</var>。しかし、KVO/KVCとObjective-C 2.0を使ったメンバ変数へのバインディングが使えないとき（OSによる制限のため）は例外だ。この場合にはアンダースコアを変数のプレフィックスとして付けてもよい。これはAppleがkey/valueの命名のために許している慣習だ。もしObjective-C 2.0が使えるのであれば、<code>@property</code> と <code>@synthesize</code> を使って、この命名ガイドラインに従おう。
        </p>
      </SUBSECTION>
      
<!--      <SUBSECTION title="Constants">-->
      <SUBSECTION title="定数">
        <p>
<!--
          Constant names (#defines, enums, const local variables, etc.) should
          start with a lowercase <var>k</var> and then use mixed case to
          delimit words, i.e. <var>kInvalidHandle</var>,
          <var>kWritePerm</var>.
-->
          定数名（#define、enum、constなローカル変数など）は小文字<var>k</var>で始めて、大文字と小文字を組合せて単語を区切る。例えば、<var>kInvalidHandle</var>や <var>kWritePerm</var>など。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

</CATEGORY>

<!--<CATEGORY title="Comments">-->
<CATEGORY title="コメント">

  <p>
<!--
    Though a pain to write, they are absolutely vital to keeping our code
    readable. The following rules describe what you should comment and where.
    But remember: while comments are very important, the best code is
    self-documenting. Giving sensible names to types and variables is much
    better than using obscure names and then trying to explain them through
    comments.
-->
    コメントを書くのは苦痛だが、コードを読みやすくしておくためには不可欠だ。以下のルールでは、どこにどんなコメントを書くべきかを説明している。
    でも忘れないでほしい: コメントはとても重要だが、最高のコードとは自己文書化されたコードのことだ。あいまいな名前を付けてコメントで説明しようとするよりも、型や変数に理にかなった名前を付けておく方がはるかによい。
  </p>
  <p>
<!--
    When writing your comments, write for your audience: the next
    
    contributor
    who will need to understand your code.  Be generous &#8212; the next
    one may be you!
-->
    コメントを書くときには、コードを読む人のために書こう。つまりコードを理解する必要のある次のコントリビュータ（貢献してくれる人）のためだ。親切になろう &#8212; 次のコントリビュータというのはあなた自身のことかもしれないよ!
  </p>
  <p>
<!--
    Remember that all of the rules and conventions listed in the C++ Style
    Guide are in effect here, with a few additional points, below.
-->
    C++スタイルガイドで取り上げたルールや規約はすべて、このガイドラインでも有効だということを忘れないこと。ここではそれにさらに追加したポイントを挙げている。
  </p>

<!--  <STYLEPOINT title="File Comments">-->
  <STYLEPOINT title="ファイルのコメント">
    <SUMMARY>
<!--
      Start each file with a copyright notice, followed by a
      description of the contents of the file.
-->
      各ファイルはまずコピーライト宣言から始めること。その次にファイル内容の説明を書くこと。
    </SUMMARY>
    <BODY>
<!--
      <SUBSECTION title="Legal Notice and Author Line">
-->
      <SUBSECTION title="Legal Noticeと作者に関する行">
        <p>
<!--
          Every file should contain the following items, in order:
-->
          すべてのファイルには、以下の項目をこの順序で入れておくべきだ:
          <ul>
<!--
            <li>a copyright statement (for example,
                <code>Copyright 2008 Google Inc.</code>)</li>
            <li>a license boilerplate.  Choose the appropriate boilerplate
                for the license used by the project (for example,
                Apache 2.0, BSD, LGPL, GPL)</li>
-->
            <li>コピーライトに関する文 （例えば、
                <code>Copyright 2008 Google Inc.</code>）</li>
            <li>ライセンスの決まり文句。 そのプロジェクトで使うライセンスに合わせて決まり文句を選ぶこと。（例えば、
                Apache 2.0, BSD, LGPL, GPL）</li>
          </ul>
        </p>
        <p>
<!--
          If you make significant changes to a file that someone else
          originally wrote, add yourself to the author line. This can
          be very helpful when another
          
          contributor
          has questions about the file and needs to know whom to contact
          about it.
-->
          もともと他人が書いたファイルに大きな変更をしたときには、作者のところに自分の名前を追加しよう。これは、他のコントリビュータがそのファイルについて質問したり、問い合わせ先を知る必要があるときに非常に役に立つ。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Declaration Comments">-->
  <STYLEPOINT title="宣言のコメント">
    <SUMMARY>
<!--
      Every interface, category, and protocol declaration should have an
      accompanying comment describing its purpose and how it fits into the
      larger picture.
-->
      インタフェース、カテゴリ、プロトコルの宣言にはすべて、その目的と全体における位置付けを説明するためのコメントを付けておくべきだ。
    </SUMMARY>
    <BODY>
      <CODE_SNIPPET>
        // A delegate for NSApplication to handle notifications about app
        // launch and shutdown. Owned by the main app controller.
        @interface MyAppDelegate : NSObject {
          ...
        }
        @end
      </CODE_SNIPPET>
      <p>
<!--
        If you have already described an interface in detail in the
        comments at the top of your file feel free to simply state
        "See comment at top of file for a complete description", but
        be sure to have some sort of comment.
-->
        インタフェースの詳細について、すでにファイルの先頭で説明しているのであれば、"See comment at top of file for a complete description"（「詳しくはファイル先頭のコメントを参照すること」）と書いておいても構わないが、必ず何かしらのコメントを入れておくこと。
      </p>
      <p>
<!--
        Additionally, each method in the public interface should have a
        comment explaining its function, arguments, return value, and any
        side effects.
-->
        さらに、パブリックインタフェースにあるメソッドには機能、引数、戻り値、あらゆる副作用について説明したコメントを入れておくべきだ。
      </p>
      <p>
<!--
        Document the synchronization assumptions the class makes, if
        any. If an instance of the class can be accessed by multiple
        threads, take extra care to document the rules and invariants
        surrounding multithreaded use.
-->
        もしクラスが想定している同期があれば、それについて書いておくこと。もしクラスのインスタンスが複数のスレッドからアクセスされる可能性があるのなら、マルチスレッドの利用に関するルールや不変条件を明記しておくよう十分注意すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Implementation Comments">-->
	<STYLEPOINT title="実装のコメント">
    <SUMMARY>
<!--
      Use vertical bars to quote variable names and symbols in comments rather
      than quotes or naming the symbol inline.
-->
      コメント中に変数名やシンボルを引用するときには、引用符やシンボルをインラインで指定するのではなく垂直バー（縦棒）を使うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        This helps eliminate ambiguity, especially when the symbol is a common
        word that might make the sentence read like it was poorly constructed.
        E.g. for a symbol "count":
-->
        こうすることであいまいさをなくすことができる。特にシンボルがよく見かける単語で、下手に文章として読めてしまうときに有効だ。
        例えば、シンボル "count" の場合:
      </p>
      <CODE_SNIPPET>
        // Sometimes we need |count| to be less than zero.
      </CODE_SNIPPET>
      <p>
<!--
        or when quoting something which already contains quotes
-->
        あるいは、すでに引用符が含まれているものを引用する場合:
      </p>
      <CODE_SNIPPET>
        // Remember to call |StringWithoutSpaces("foo bar baz")|
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Object Ownership">-->
    <STYLEPOINT title="オブジェクトのオーナーシップ">
    <SUMMARY>
<!--
      Make the pointer ownership model as explicit as possible when it falls
      outside the most common Objective-C usage idioms.  
-->
      一般的なObjective-Cから外れた使い方をしているときには、オーナーシップモデルをできるだけ明確に示しておくこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Instance variable pointers to objects derived from NSObject are
        presumed to be retained, and should be documented as <b>weak</b> if
        they are not retained by the class. However, instance variables which
        are labeled as IBOutlets are presumed to not be retained by the class,
        and should be documented as <b>strong</b> if the class does retain
        them.
-->
        NSObject から派生したオブジェクトを指すインスタンス変数ポインタは、保持されていると見なされる。もしそのクラスによって保持されていないのであれば、<b>weak</b>（弱い参照）であることを明記しておくべきだ。ただし IBOutlet というラベルの付いたインスタンス変数は、クラスによって保持されていないと見なされる。もしそのクラスによって保持されているのであれば、<b>strong</b>（強い参照）であることを明記しておくべきだ。
      </p>
      <p>
<!--
        Where instance variables are pointers to CoreFoundation, C++, and
        other non-Objective-C objects, they should always be documented in
        comments as strong or weak. Be mindful that support for automatic C++
        objects encapsulated in Objective-C objects is disabled by default, as
        described <a href="http://chanson.livejournal.com/154253.html">here</a>.
-->
        インスタンス変数が CoreFoundation や C++、Objective-C以外のオブジェクトへのポインタであるときには、strong であるか weak であるかをコメントに明記しておくべきだ。C++オブジェクトをObjective-Cオブジェクトに自動的にカプセル化する機能はデフォルトでは無効になっていることに注意しよう。これについては<a href="http://chanson.livejournal.com/154253.html">ここ</a>に説明がある。
      </p>
      <p>
<!--
        Examples of strong and weak documentation:
-->
        strong と weak の記載例
        <CODE_SNIPPET>
          @interface MyDelegate : NSObject {
           @private
            IBOutlet NSButton* okButton_;  // normal NSControl
            IBOutlet NSMenu* myContextMenu_;  // manually-loaded menu (strong)

            AnObjcObject* doohickey_;  // my doohickey
            MyController* controller_;  // so we can send msgs back (weak, owns me)

            // non-NSObject pointers...
            CWackyCPPClass* wacky_;  // some cross-platform object (strong)
            CFDictionaryRef* dict_;  // (strong)
          }
          @end
        </CODE_SNIPPET>
        <dl>
<!--
          <dt>strong</dt><dd>The object will be <code>retain</code>'d by this class</dd>
          <dt>weak</dt><dd>The object will be <b>not</b> be <code>retain</code>'d by this class
          (e.g. a delegate).</dd>
-->
          <dt>strong</dt><dd>オブジェクトはこのクラスによって <code>retain</code> されている</dd>
          <dt>weak</dt><dd>オブジェクトはこのクラスによって <code>retain</code> されて<b>いない</b>
     		（例: デリゲート）</dd>
        </dl>
      </p>
    </BODY>
  </STYLEPOINT>
  
</CATEGORY>

<!--<CATEGORY title="Cocoa and Objective-C Features">-->
  <CATEGORY title="CocoaとObjective-Cの機能">

<!--  <STYLEPOINT title="Member Variables Should Be @private">-->
    <STYLEPOINT title="メンバ変数は @private にするべきだ">
    <SUMMARY>
<!--
      Member variables should be declared <code>@private</code>.
-->
     メンバ変数は <code>@private</code> と宣言するべきだ。
    </SUMMARY>
    <BODY>
      <CODE_SNIPPET>
        @interface MyClass : NSObject {
         @private
          id myInstanceVariable_;
        }
        // public accessors, setter takes ownership
        - (id)myInstanceVariable;
        - (void)setMyInstanceVariable:(id)theVar;
        @end
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="Identify Designated Initializer">-->
  <STYLEPOINT title="指定イニシャライザがわかるようにする">
    <SUMMARY>
<!--
      Comment and clearly identify your designated initializer.
-->
      指定イニシャライザがわかるようにコメントを入れておくこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        It is important for those who might be subclassing your class that the
        designated initializer be clearly identified. That way, they only need
        to subclass a single initializer (of potentially several) to guarantee
        their subclass' initializer is called. It also helps those debugging
        your class in the future understand the flow of initialization code if
        they need to step through it.
-->
        あなたが作ったクラスをサブクラス化しようとしている人にとって、指定イニシャライザがはっきりとわかることは重要だ。指定イニシャライザがわかれば、（複数あるかもしれない）イニシャライザのうち1つをサブクラス化することでサブクラスのイニシャライザを確実に呼び出すことができる。将来あなたが作ったクラスを誰かがデバッグしなければならないとき、クラスの初期化の流れを理解するのにも役に立つ。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Override Designated Initializer">-->
  <STYLEPOINT title="指定イニシャライザを上書きする">
    <SUMMARY>
<!--
      When writing a subclass that requires an <code>init...</code> method,
      make <i>sure</i> you override the superclass' designated initializer.
--> 
      ある <code>init...</code> メソッドを必要とするサブクラスを書くときには、スーパークラスの指定イニシャライザを上書きしていることを<i>確かめる</i>こと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        If you fail to override the superclass' designated initializer, your
        initializer may not be called in all cases, leading to subtle and
        very difficult to find bugs.
-->
        スーパークラスの指定イニシャライザを上書きしていないと、イニシャライザが必ず呼び出される保証はない。これはバグを見つけるのをやっかいにして、問題を非常に難しくする。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Initialization">-->
  <STYLEPOINT title="初期化">
    <SUMMARY>
<!--
      Don't initialize variables to <code>0</code> or <code>nil</code> in the
      init method; it's redundant.
-->
      init メソッド内で変数を <code>0</code> や <code>nil</code> に初期化してはいけない。これは冗長だ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        All memory for a newly allocated object is initialized to 0 (except
        for <var>isa</var>), so don't clutter up the <code>init</code> method
        by re-initializing variables to 0 or <code>nil</code>.
-->
        新しく割り当てられたオブジェクトのメモリは（<var>isa</var> を除いて）すべて 0 に初期化される。だから 0 や <code>nil</code> で変数を再初期化することで、<code>init</code> メソッドをいっぱいにしてはいけない。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Keep the Public API Simple">-->
  <STYLEPOINT title="パブリックAPIをシンプルにしておく">
    <SUMMARY>
<!--
      Keep your class simple; avoid "kitchen-sink" APIs. If a method doesn't
      need to be public, don't make it so. Use a private category to prevent
      cluttering the public header.
-->
     クラスをシンプルにしておくこと。「キッチンシンク」（いろいろなものを積め込んだような）APIにならないようにしよう。もしそのメソッドをパブリックにする必要がないのであればパブリックにしてはいけない。プライベートカテゴリを使うことで、ヘッダがぐちゃぐちゃにならないようにしよう。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Unlike C++, Objective-C doesn't have a way to differentiate between
        public and private methods &#8212; everything is public. As a result,
        avoid placing methods in the public API unless they are actually
        expected to be used by a consumer of the class. This helps reduce the
        likelihood they'll be called when you're not expecting it. This includes
        methods that are being overridden from the parent class. For internal
        implementation methods, use a category defined in the implementation
        file as opposed to adding them to the public header.
-->
        C++と違ってObjective-Cにはパブリックメソッドとプライベートメソッドを区別する手段がない。 &#8212; すべてが公開されているのだ。そのため、クラスの利用者によって実際に使われることを想定していないメソッドは、パブリックAPIに置かないようにしよう。こうすることで意図せずメソッドが呼び出されてしまう可能性を減らすことができる。これには親クラスから上書きされたメソッドも含まれる。内部実装であるメソッドについては、パブリックヘッダに追加せずに実装ファイルに定義したカテゴリを使うこと。
      </p>
      <CODE_SNIPPET>
        // GTMFoo.m
        #import "GTMFoo.h"

        @interface GTMFoo (PrivateDelegateHandling)
        - (NSString *)doSomethingWithDelegate;  // Declare private method
        @end

        @implementation GTMFoo(PrivateDelegateHandling)
        ...
        - (NSString *)doSomethingWithDelegate {
          // Implement this method 
        }
        ...
        @end
      </CODE_SNIPPET>
      <p>
<!--
        Before Objective-C 2.0, if you declare a method in the private
        <code>@interface</code>, but forget to implement it in the main
        <code>@implementation</code>, the compiler will <i>not</i> object.
        (This is because you don't implement these private methods in a
        separate category.) The solution is to put the functions within
        an <code>@implementation</code> that specifies the category.
-->
        Objective-C 2.0以前では、プライベート <code>@interface</code> でメソッドを宣言しておきながらメインの <code>@implementation</code> でメソッドを実装し忘れていても、コンパイラは何も警告<i>してくれない</i>。（個別のカテゴリの中でプライベートメソッドを実装していないためだ。） これを解決するには、カテゴリを指定した <code>@implementation</code> に関数を置けばよい。
      </p>
      <p>
<!--
        If you are using Objective-C 2.0, you should instead declare your
        private category using a <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#">class
        extension</a>, for example: 
-->
       もしObjective-C 2.0を使っているなら、代わりに <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#">クラスエクステンション</a>を使ってプライベートカテゴリを宣言するべきだ。例えば次のようになる。
      </p>
      <CODE_SNIPPET>
      @interface GMFoo () { ... }
      </CODE_SNIPPET>
      <p>
<!--
        which will guarantee that the declared methods are implemented in the
        <code>@implementation</code> section by issuing a compiler warning if
        they are not.
-->
        こうすると、宣言されたメソッドが <code>@implementation</code> セクションに実装されていることが保証される。もし実装されていなければコンパイラが警告を出してくれるためだ。
      </p>
      <p>
<!--
        Again, "private" methods are not really private. You could
        accidentally override a superclass's "private" method, thus making a
        very difficult bug to squash. In general, private methods should have
        a fairly unique name that will prevent subclasses from unintentionally
        overriding them.
-->
        もう一度言っておこう。「プライベート」メソッドは実際にはプライベートではない。スーパークラスの「プライベート」メソッドをうっかり上書きしてしまうおそれもある。これはつぶすのが非常に難しいバグになる。一般的に、プライベートメソッドはかなり独特な名前にしておくべきだ。こうしておくと、意図せずサブクラスで上書きしてしまうのを避けることができる。
      </p>
      <p>
<!--
        Finally, Objective-C categories are a great way to segment a large
        <code>@implementation</code> section into more understandable chunks
        and to add new, application-specific functionality to the most
        appropriate class. For example, instead of adding "middle truncation"
        code to a random object in your app, make a new category on
        <code>NSString</code>).
-->
       結局のところ、Objective-Cのカテゴリはすばらしい方法だ。これを使うと大きな <code>@implementation</code> セクションを、理解しやすいブロックに分割することができ、適切なクラスにアプリケーション特有の新機能を追加することができる。例えば、アプリにあるオブジェクトに行き当たりばったりに「両端一致」コードを追加するのではなく、<code>NSString</code> に新しいカテゴリを追加するようにしよう。
      </p>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="#import and #include">-->
  <STYLEPOINT title="#import と #include">
    <SUMMARY>
<!--
      <code>#import</code> Objective-C/Objective-C++ headers, and
      <code>#include</code> C/C++ headers.
-->
      Objective-C/Objective-C++ヘッダには <code>#import</code>、C/C++ヘッダには <code>#include</code> を使うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Choose between <code>#import</code> and <code>#include</code> based
        on the language of the header that you are including.
-->
        <code>#import</code> と <code>#include</code> のどちらを使うかは、インクルードしているヘッダの言語に基づいて選ぼう。
      </p>
      <ul>
<!--
        <li>When including a header that uses Objective-C or Objective-C++,
            use <code>#import</code>.</li>
        <li>When including a standard C or C++ header, use
            <code>#include</code>.  The header should provide its own <a href="cppguide.xml?showone=The__define_Guard#The__define_Guard">#define
            guard</a>.</li>
-->
        <li>Objective-CまたはObjective-C++を使っているヘッダをインクルードするときには、<code>#import</code> を使う。</li>
        <li>標準のCまたはC++ヘッダをインクルードするときには、<code>#include</code> を使う。ヘッダには <a href="cppguide.xml?showone=The__define_Guard#The__define_Guard">#define ガード</a> を入れておくべきだ。</li>

      </ul>
      <p>
<!--
        Some Objective-C headers lack <code>#define</code> guards, and expect
        to be included only by <code>#import</code>.  As Objective-C headers
        may only be included in Objective-C source files and other Objective-C
        headers, using <code>#import</code> across the board is appropriate.
-->
       Objective-Cヘッダには <code>#define</code> ガードがなく、<code>#import</code> でインクルードされることしか想定していないものもある。Objective-Cソースファイルおよび他のObjective-CヘッダにインクルードされるのがObjective-Cヘッダだけのときには、全面的に <code>#import</code> を使うのが望ましい。
      </p>
      <p>
<!--
        Standard C and C++ headers without any Objective-C in them can expect
        to be included by ordinary C and C++ files.  Since there is no
        <code>#import</code> in standard C or C++, such files will be
        included by <code>#include</code> in those cases.  Using
        <code>#include</code> for them in Objective-C source files as well
        means that these headers will always be included with the same
        semantics.
-->
         Objective-Cを含まない標準のCおよびC++ヘッダは、通常のCおよびC++ファイルにインクルードされることを想定している。標準のCやC++には <code>#import</code> がないので、<code>#include</code> によりインクルードされることになるだろう。Objective-Cソースファイルのなかで <code>#include</code> を使うということは、常に同じ意味でこれらのヘッダがインクルードされるということだ。
      </p>
      <p>
<!--
        This rule helps avoid inadvertent errors in cross-platform
        projects.  A Mac developer introducing a new C or C++ header might
        forget to add <code>#define</code> guards, which would not cause
        problems on the Mac if the new header were included with
        <code>#import</code>, but would break builds on other platforms
        where <code>#include</code> is used.  Being consistent by using
        <code>#include</code> on all platforms means that compilation is
        more likely to succeed everywhere or fail everywhere, and avoids
        the frustration of files working only on some platforms.
-->
        このルールはクロスプラットフォームのプロジェクトにおいて、うっかり間違ってしまうのを防ぐのに役立つ。新しいCやC++ヘッダを取り込んでいるMac開発者は、<code>#define</code> ガードを入れておくのを忘れてしまうことがある。この新しいヘッダを <code>#import</code> を使ってインクルードしていると、Macでは問題にならないだろう。しかし、<code>#include</code> を使う他のプラットフォームでは、ビルドに失敗するだろう。すべてのプラットフォームで <code>#include</code> を使うことで一貫性を持たせると、どのプラットフォームでもコンパイルは成功するか失敗するかのどちらかになり、特定のプラットフォームでしか動かないファイルがあるというのを避けることができる。
      </p>
      <CODE_SNIPPET>
        #import &lt;Cocoa/Cocoa.h&gt;
        #include &lt;CoreFoundation/CoreFoundation.h&gt;
        #import "GTMFoo.h"
        #include "base/basictypes.h"
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Use Root Frameworks">-->
  <STYLEPOINT title="ルートフレームワークを使う">
    <SUMMARY>
<!--
      Include root frameworks over individual files.
-->
      個別のファイルではなくルートフレームワークをインクルードしよう。
    </SUMMARY>
    <BODY>
      <p>
<!--
        While it may seem tempting to include individual system headers from a
        framework such as Cocoa or Foundation, in fact it's less work on the
        compiler if you include the top-level root framework. The root
        framework is generally pre-compiled and can be loaded much more
        quickly. In addition, remember to use <code>#import</code> rather than
        <code>#include</code>.
-->
       CocoaやFoundationといったフレームワークにあるシステムヘッダを個別にインクルードしたくなるかもしれないが、実際のところ、最上位のルートフレームワークをインクルードしてもコンパイラにとってはほとんど負荷にはならない。ルートフレームワークは通常プリコンパイルされており、非常にすばやくロードできるようになっているためだ。また、Objective-Cフレームワークには、<code>#include</code> ではなく <code>#import</code> を使うのを忘れないようにしよう。
      </p>
      <CODE_SNIPPET>
        #import &lt;Foundation/Foundation.h&gt;     // good
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        #import &lt;Foundation/NSArray.h&gt;        // avoid
        #import &lt;Foundation/NSString.h&gt;
        ...
      </BAD_CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="Prefer To autorelease At Time of Creation">-->
  <STYLEPOINT title="生成時に autorelease するのが望ましい">
    <SUMMARY>
<!--
      When creating new temporary objects, <code>autorelease</code> them on
      the same line as you create them rather than a separate
      <code>release</code> later in the same method.
-->
      一時的なオブジェクトを新しく生成するときには、そのメソッドの後ろの方で個別に <code>release</code> するのではなく、オブジェクトの生成と同じ行で <code>autorelease</code> すること。
    </SUMMARY>
    <BODY>
      <p>
<!--
        While ever so slightly slower, this prevents someone from accidentally
        removing the <code>release</code> or inserting a <code>return</code>
        before it and introducing a memory leak. E.g.:
-->
        ほんの少し遅くなるが、うっかり <code>release</code> を消してしまったり <code>release</code> の前に <code>return</code> を入れてしまって、メモリリークが発生するのを防くことができる。
      </p>
      <BAD_CODE_SNIPPET>
        // AVOID (unless you have a compelling performance reason)
        MyController* controller = [[MyController alloc] init];
        // ... code here that might return ...
        [controller release];
      </BAD_CODE_SNIPPET>
      <CODE_SNIPPET>
        // BETTER
        MyController* controller = [[[MyController alloc] init] autorelease];
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Autorelease Then Retain">-->
  <STYLEPOINT title="autorelease してから retain する">
    <SUMMARY>
<!--
      Assignment of objects follows the <code>autorelease</code> then
      <code>retain</code> pattern.
-->
     オブジェクトの代入は、<code>autorelease</code> してから <code>retain</code> するというパターンに従うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        When assigning a new object to a variable, one must first release the
        old object to avoid a memory leak. There are several "correct" ways to
        handle this. We've chosen the "autorelease then retain" approach
        because it's less prone to error. Be aware in tight loops it can fill
        up the autorelease pool, and may be slightly less efficient, but we
        feel the tradeoffs are acceptable.
-->
        新しいオブジェクトを変数に代入するときには、メモリリークを起こさないように最初に古いオブジェクトを解放する必要がある。これには「正しい」やり方がいくつかある。私たちは「autorelease してから retain する」という方法を選んだ。間違いにくいためだ。タイトなループでは、autorelease pool がいっぱいになり、効率が少し悪くなることに注意しよう。それでも私たちはこのトレードオフは許容できると考えた。
      </p>
      <CODE_SNIPPET>
        - (void)setFoo:(GMFoo *)aFoo {
          [foo_ autorelease];  // Won't dealloc if |foo_| == |aFoo|
          foo_ = [aFoo retain]; 
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Setters copy NSStrings">-->
  <STYLEPOINT title="セッタではNSStringをコピーする">
    <SUMMARY>
<!--
      Setters taking an <code>NSString</code>, should always <code>copy</code>
      the string it accepts.
-->
       <code>NSString</code> を引数に持つセッタは、受け取った文字列を常に <code>copy</code> するべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Never just <code>retain</code> the string. This avoids the caller
        changing it under you without your knowledge. Don't assume that
        because you're accepting an <code>NSString</code> that it's not
        actually an <code>NSMutableString</code>.
-->
        文字列を <code>retain</code> するだけでは不十分だ。文字列をコピーすれば、呼び出し元が知らないうちに文字列を変更してしまうことを避けることができる。実際には <code>NSMutableString</code> ではなく <code>NSString</code> を受け取っているから大丈夫だ、と考えてはいけない。
      </p>
      <CODE_SNIPPET>
        - (void)setFoo:(NSString *)aFoo {
          [foo_ autorelease];
          foo_ = [aFoo copy];
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Avoid Throwing Exceptions">-->
  <STYLEPOINT title="例外を投げるのをやめる">
    <SUMMARY>
<!--
      Don't <code>@throw</code> Objective-C exceptions, but you should be
      prepared to catch them from third-party or OS calls.
-->
     Objective-Cの例外を <code>@throw</code> してはいけない。しかし、サードパーティ製のコードやOS呼び出しからの例外はキャッチできるようにしておくべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        We do compile with <code>-fobjc-exceptions</code> (mainly so we get
        <code>@synchronized</code>), but we don't <code>@throw</code>. Use of
        <code>@try</code>, <code>@catch</code>, and <code>@finally</code> are
        allowed when required to properly use 3rd party code or libraries. If
        you do use them please document exactly which methods you expect to
        throw.
-->
        私たちは <code>-fobjc-exceptions</code> を付けてコンパイルするが、これは主に <code>@synchronized</code> を使うためだ。<code>@throw</code> は使わない。 <code>@try</code>、<code>@catch</code>、<code>@finally</code> の使用は、サードパーティ製のコードやライブラリを正しく使うのに必要であれば許される。もし例外を使うのであれば、どのメソッドが例外を投げる可能性があるのか正確に記載しておこう。
      </p>
      <p>
<!--
        Do not use the <code>NS_DURING</code>, <code>NS_HANDLER</code>,
        <code>NS_ENDHANDLER</code>, <code>NS_VALUERETURN</code> and
        <code>NS_VOIDRETURN</code> macros unless you are writing code that
        needs to run on MacOS 10.2 or before.
-->
        もしMacOS 10.2以前で動かす必要のないコードを書いているのなら、<code>NS_DURING</code>、<code>NS_HANDLER</code>、<code>NS_ENDHANDLER</code>、<code>NS_VALUERETURN</code>、<code>NS_VOIDRETURN</code> といったマクロを使ってはいけない。
      </p>
      <p>
<!--
        Also be aware when writing Objective-C++ code that stack based objects
        are <b>not</b> cleaned up when you throw an Objective-C exception.
        Example:
-->
        また、Objective-C++のコードを書いているときには、Objective-Cの例外を投げるとスタックベースのオブジェクトは解放され<b>ない</b>ということを認識しておこう。例:
      </p>
      <CODE_SNIPPET>
        class exceptiontest {
         public:
          exceptiontest() { NSLog(@"Created"); }
          ~exceptiontest() { NSLog(@"Destroyed"); }
        };

        void foo() {
          exceptiontest a;
          NSException *exception = [NSException exceptionWithName:@"foo"
                                                           reason:@"bar"  
                                                         userInfo:nil];
          @throw exception;
        }

        int main(int argc, char *argv[]) {
          GMAutoreleasePool pool;
          @try {
            foo();
          }
          @catch(NSException *ex) {
            NSLog(@"exception raised");
          }
          return 0;
        }
      </CODE_SNIPPET>
      <p>
<!--
        will give you:
-->
        出力は次のようになる:
      </p>
      <CODE_SNIPPET>
        2006-09-28 12:34:29.244 exceptiontest[23661] Created
        2006-09-28 12:34:29.244 exceptiontest[23661] exception raised
      </CODE_SNIPPET>
      <p>
<!--
        Note that the destructor for <i>a</i> never got called. This is a
        major concern for stack based smartptrs such as
        <code>shared_ptr</code> and <code>linked_ptr</code>, as well as any
        STL objects that you may want to use. Therefore it pains us to say
        that if you must use exceptions in your Objective-C++ code, use C++
        exceptions whenever possible. You should never re-throw an Objective-C
        exception, nor are stack based C++ objects (such as
        <code>std::string</code>, <code>std::vector</code> etc.) allowed in
        the body of any <code>@try</code>, <code>@catch</code>, or
        <code>@finally</code> blocks.
-->
        オブジェクト <i>a</i> のデストラクタは呼び出されないことに注意しよう。これは <code>shared_ptr</code> や <code>linked_ptr</code> のようなスタックベースのスマートポインタや、利用したいかもしれないSTLオブジェクトにとって大きな懸念事項になる。言いにくいことだが、Objective-C++のコードで例外を使わなければならないのなら、いつであれC++の例外を使おう。決してObjective-Cの例外を再び投げるべきではないし、スタックベースのC++オブジェクト（<code>std::string</code> や <code>std::vector</code> など）を、<code>@try</code>、<code>@catch</code>、<code>@finally</code> といったブロック本体で使うことも許されない。
      </p>
    </BODY>
  </STYLEPOINT>


<!--  <STYLEPOINT title="nil Checks">-->
  <STYLEPOINT title="nil チェック">
    <SUMMARY>
<!--
      Use <code>nil</code> checks for logic flow only.
-->
      <code>nil</code> チェックはロジックフローのためだけに使うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Use <code>nil</code> checks for logic flow of the application, not for
        crash prevention. Sending a message to a <code>nil</code> object is
        handled by the Objective-C runtime. If the method has no return
        result, you're good to go. However if there is one, there may be
        differences based on runtime architecture, return size, and OS X
        version (see <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW7">Apple's
        documentation</a> for specifics).
-->
        <code>nil</code> チェックはクラッシュ防止のためではなく、アプリケーションのロジックフローのためだけに使うこと。<code>nil</code> オブジェクトへのメッセージ送信は、Objective-Cランタイムによって処理される。もしそのメッセージに戻すべき結果がなければ、何ごともなく進むことになる。結果があっても、ランタイムアーキテクチャ、リターンサイズ、OS Xのバージョンによって動作に違いがあるかもしれない。（詳しくは<a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW7">Appleのドキュメント</a>を参照すること）
      </p>
      <p>
<!--
        Note that this is very different from checking C/C++ pointers against
        <code>NULL</code>, which the runtime does not handle and will cause
        your application to crash. You still need to make sure you do not
        dereference a <code>NULL</code> pointer.
-->
        これはC/C++ポインタを <code>NULL</code> チェックするのとはまったく異なることに注意すること。C/C++ポインタでは <code>NULL</code> チェックをしないとランタイムは<code>NULL</code>を処理できず、アプリケーションはクラッシュしてしまう。常に <code>NULL</code> ポインタをデリファレンスしないようにする必要がある。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="BOOL Pitfalls">-->
  <STYLEPOINT title="BOOLの落とし穴">
    <SUMMARY>
<!--
      Be careful with <code>BOOL</code> return values and mixing
      <code>bool</code> with <code>BOOL</code>. Avoid comparing directly
      with <code>YES</code>.
-->
      <code>BOOL</code> 型の戻り値と、<code>bool</code> と <code>BOOL</code> を混ぜて使うときには注意すること。<code>YES</code> と直接比較しないようにすること。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Only use the constants YES and NO for <code>BOOL</code> return values
        and assignments. Common mistakes include casting an array's size or
        a pointer value as a BOOL, which depending on the value of the last
        byte, could still result in a NO value.
-->
        <code>BOOL</code> 型の定数である YES と NO を使うのは、戻り値と代入だけにすること。よくある間違いは配列のサイズをキャストしたり、ポインタ値を BOOL 型として扱ってしまうことだ。この結果は最後のバイトの値に依存して、常に NO になってしまうことがある。
      </p>
      <p>
<!--
        Also be careful when interoperating with C++ and its <code>bool</code>
        type. Don't just assume that <code>YES</code> and <code>NO</code>
        map directly to <code>true</code> and <code>false</code>. You can use
        the ternary operator to succinctly map between them.
-->
        BOOL 型を、C++およびその <code>bool</code> 型と同時に使用するときにも注意すること。単純に、<code>YES</code> が <code>true</code> に、<code>NO</code> が <code> false</code> に対応すると考えてはいけない。三項演算子を使うと、簡潔に対応づけることができる。
      </p>
      <CODE_SNIPPET>
        bool b = myBOOL ? true : false;  // to go one way...
        myBOOL = b ? YES : NO;           // ... or the other
      </CODE_SNIPPET>
      <p>
<!--
        Finally, don't directly compare <code>BOOL</code> variables directly
        with <code>YES</code>. Not only is is harder to read for those
        well-versed in C, the first point above demonstrates that return
        values may not always be what you expect.
-->
        最後に、<code>BOOL</code> 型の変数を <code>YES</code> と直接比較してはいけない。Cに慣れた人にとって読みにくくなるだけでなく、最初に指摘したように戻り値が期待したものになるとは限らない。
      </p>
      <BAD_CODE_SNIPPET>
        BOOL great = [foo isGreat];
        if (great == YES)
          // ...be great!
      </BAD_CODE_SNIPPET>
      <CODE_SNIPPET>
        BOOL great = [foo isGreat];
        if (great)
          // ...be great!
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
  
<!--  <STYLEPOINT title="Properties">-->
  <STYLEPOINT title="プロパティ">
    <SUMMARY>
<!--
      Properties in general are allowed with the following caveat: properties
      are an Objective-C 2.0 feature which will limit your code to running
      on the iPhone and MacOS X 10.5 (Leopard) and higher. Dot notation to
      access properties is not allowed.
-->
      一般的に、プロパティを使うときには次のことに注意すること: プロパティはObjective-C 2.0の機能であり、プロパティを使ったコードはiPhoneやMac OS X 10.5（Leopard）以上でしか動かない。
    </SUMMARY>
    <BODY> 
<!--      <SUBSECTION title="Naming">-->
      <SUBSECTION title="命名規則">
        <p>
<!--
          A property's associated instance variable's name must conform to the
          trailing _ requirement. The property's name should be the same as its
          associated instance variable without the trailing _.
-->
          プロパティに対応するインスタンス変数名はアンダースコア（_）で終わらなければならない。プロパティ名は、対応するインスタンス変数名から最後のアンダースコア（_）を取り除いたものにするべきだ。
        </p>
        <p>
<!--
          Use the @synthesize directive to rename the property correctly.
-->
           @synthesize ディレクティブを使ってプロパティの名前を変更すること。
        </p>
    
        <CODE_SNIPPET>
          @interface MyClass : NSObject {
           @private
            NSString *name_;
          }
          @property(copy, nonatomic) NSString *name;
          @end
          
          @implementation MyClass
          @synthesize name = name_;
          @end
        </CODE_SNIPPET>
      </SUBSECTION>
      <SUBSECTION title="Location">
        <p>
<!--
          A property's declaration must come immediately after the instance
          variable block of a class interface. A property's definition must
          come immediately after the <code>@implementation</code> block in a
          class definition. They are indented at the same level as the 
          <code>@interface</code> or <code>@implementation</code> statements
          that they are enclosed in.
-->
          プロパティ宣言はクラスインタフェースのインスタンス変数ブロックの直後にするべきだ。プロパティ定義はクラス定義の <code>@implementation</code> ブロックの直後にするべきだ。これらはまわりにある <code>@interface</code> や <code>@implementation</code> と同じレベルにインデントすること。
        </p>
        <CODE_SNIPPET>
          @interface MyClass : NSObject {
           @private
            NSString *name_;
          }
          @property(copy, nonatomic) NSString *name;
          @end
          
          @implementation MyClass
          @synthesize name = name_;
          - (id)init {
          ...
          }
          @end
        </CODE_SNIPPET>
      </SUBSECTION>
<!--      <SUBSECTION title="Use Copy Attribute For Strings">-->
      <SUBSECTION title="文字列には copy 属性を使うこと">
        <p>
<!--
          NSString properties should always be declared with the
          <code>copy</code> attribute.
-->
          NSStringプロパティには常に <code>copy</code> 属性を宣言しておくべきだ。
        </p>
        <p>
<!--
          This logically follows from the requirement that setters for
          NSStrings always must use <code>copy</code> instead of
          <code>retain</code>.
-->
          これは論理的には、NSString のセッタには必ず <code>retain</code> の代わりに <code>copy</code> を使わなければならないというルールに従ったものだ。
        </p>
      </SUBSECTION>
<!--      <SUBSECTION title="Never synthesize CFType properties">-->
      <SUBSECTION title="CFTypeプロパティはsynthesizeしてはいけない">
        <p>
<!--
          CFTypes should always have the <code>@dynamic</code> implementation
          directive. 
-->
          CFType には必ず <code>@dynamic</code> 実装ディレクティブを付けておくべきだ。
        </p>
        <p>
<!--
          Since CFTypes can't have the <code>retain</code> property
          attribute, the developer must handle retaining and releasing the
          value themselves. In the rare case that you do actually want
          assignment it is better to make that completely clear by actually
          implementing the setter and getter and commenting why that is the
          case.
-->
          CFType は <code>retain</code> プロパティ属性を持つことができないので、開発者が自分でその値を retain したり release したりしなければならない。代入したいというケースもまれにあるが、その場合には実際にはセッタやゲッタを実装して、その理由をコメントに明記しておくのが望ましい。
        </p>
      </SUBSECTION>
<!--      <SUBSECTION title="List out all implementation directives">-->
      <SUBSECTION title="実装ディレクティブをすべて列挙すること">
        <p>
<!--
          Use implementation directives for all properties even if they are
          <code>@dynamic</code> by default.
-->
          デフォルトの <code>@dynamic</code> であったとしても、すべてのプロパティに実装ディレクティブを付けておくこと。
        </p>
        <p>
<!--
          Even though <code>@dynamic</code> is default, explicitly list it out
          with all of the other property implementation directives making it
          clear how every property in a class is handled at a single glance.
-->
          たとえ <code>@dynamic</code> がデフォルトだとしても、クラスのプロパティがそれぞれどのように処理されるのか一目でわかるよう、プロパティの実装ディレクティブはすべて明示的に列挙すること。
        </p>
        <BAD_CODE_SNIPPET>
          @interface MyClass : NSObject
          @property(readonly) NSString *name;
          @end
          
          @implementation MyClass
          .
          .
          .
          - (NSString*)name {
            return @"foo";
          }
          @end
        </BAD_CODE_SNIPPET>
        <CODE_SNIPPET>
          @interface MyClass : NSObject
          @property(readonly) NSString *name;
          @end
          
          @implementation MyClass
          @dynamic name;
          .
          .
          .
          - (NSString*)name {
            return @"foo";
          }
          @end
        </CODE_SNIPPET>
      </SUBSECTION>
<!--      <SUBSECTION title="Atomicity">-->
      <SUBSECTION title="アトミック性">		
        <p>
<!--
          Be aware of the overhead of properties. By default, all synthesized
          setters and getters are atomic. This gives each set and get calls a
          substantial amount of synchronization overhead. Declare your
          properties <code>nonatomic</code> unless you require atomicity.
-->
          プロパティにはオーバーヘッドがあることを認識しておこう。デフォルトでは、同期のセッタとゲッタはすべてアトミックだ。そのためセットとゲットの呼び出しには同期オーバーヘッドがかなりある。アトミック性が必要ないのであれば、プロパティを <code>nonatomic</code> と宣言しておくこと。
        </p>

      </SUBSECTION>
<!--      <SUBSECTION title="Dot notation">-->
      <SUBSECTION title="ドット記法">
        <p>
<!--
          We do not allow the use of dot notation to access properties for
          the following reasons:
-->
          以下の理由から、ドット記法を使ってプロパティにアクセスすることを禁止する。
        </p>
        <ol>
          <li>
<!--
            Dot notation is purely syntactic sugar for standard method calls,
            whose readability gains are debatable. It just gives you another
            way to make method calls. 
-->
            ドット記法は標準的なメソッド呼び出しに対する純粋なシンタックスシュガーであり、読みやすいかどうかには異論もある。単なるメソッド呼び出しの別の方法にすぎない。
          </li>
          <li>
<!--
            It obscures the type that you are dereferencing. When one sees:
            <code>[foo setBar:1]</code> it is immediately clear that you are
            working with an Objective-C object. When one sees 
            <code>foo.bar = 1</code> it is not clear if foo is an object, or
            a struct/union/C++ class.
-->
            こうするとデリファレンスしている型がわかりにくくなる。<code>[foo setBar:1]</code> というのをみれば、Objective-Cのオブジェクトを操作しているとすぐにわかる。しかし、<code>foo.bar = 1</code> というのをみても、fooがオブジェクトなのか、構造体や共用体なのか、C++のクラスなのかわからない。
          </li>
          <li>
<!--
            It allows you to do method calls that look like getters.
-->
            ゲッタであるかのようなメソッド呼び出しができてしまう。
            <BAD_CODE_SNIPPET>
              NSString *upperCase = @"foo".uppercaseString;
            </BAD_CODE_SNIPPET>
<!--
            which is not only confusing, but difficult to spot in a code review.
-->
            これは混乱させるだけでなくコードレビューで問題を見つけにくくする。
          </li>
          <li>
<!--
            It hides method calls.
-->
            メソッド呼び出しを隠してしまう。
            <BAD_CODE_SNIPPET>
              bar.value += 10;
            </BAD_CODE_SNIPPET>
<!--
            is actually two separate method calls (one to set and one to get)
            and if your properties are not simple you may find a lot of work
            being done in a hidden manner.
-->
            実際には2つの異なるメソッド（setするメソッドとgetするメソッド）が呼び出されている。もしプロパティが単純なものでなければ、裏でたくさんの処理が行われることになる。
          </li>
        </ol>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>
</CATEGORY>


<!--<CATEGORY title="Cocoa Patterns">-->
<CATEGORY title="Cocoaパターン">
  
<!-- <STYLEPOINT title="Delegate Pattern">-->
  <STYLEPOINT title="Delegateパターン">
    <SUMMARY>
<!--
      Delegate objects should not be retained.
-->
      Delegateオブジェクトを retain するべきではない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        A class that implements the delegate pattern should:
-->
        Delegateパターンを実装するクラスは次のようにしておくべきだ。
        <ol>
          <li>
<!--
            Have an instance variable named <var>delegate_</var> to reference
            the delegate.
-->
            delegateを参照する <var>delegate_</var> という名前のインスタンス変数を用意する。
          </li>
          <li>
<!--
            Thus, the accessor methods should be named <code>delegate</code>
            and <code>setDelegate:</code>.
-->
            そして、アクセサメソッドは <code>deletate</code> と <code>setDelegate:</code> という名前にする。
          </li>
          <li>
<!--
            The <var>delegate_</var> object should <b>not</b> be retained.
-->
            <var>delegate_</var> オブジェクトを retain するべきでは<b>ない</b>。
          </li>
        </ol>
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Model/View/Controller">-->
  <STYLEPOINT title="Model/View/Controller">
    <SUMMARY>
<!--
      Separate the model from the view. Separate the controller from the
      view and the model. Use <code>@protocol</code>s for callback APIs.
-->
      モデルをビューから分離すること。コントローラをビューとモデルから分離すること。コールバックAPIには <code>@protocol</code> を使うこと。
    </SUMMARY>
    <BODY>
      <p>
        <ul>
          <li>
<!--
            Separate model from view: don't build assumptions about the
            presentation into the model or data source. Keep the interface
            between the data source and the presentation abstract. Don't give
            the model knowledge of its view. (A good rule of thumb is to ask
            yourself if it's possible to have multiple presentations, with
            different states, on a single instance of your data source.)
-->
            モデルをビューから分離する: モデルやデータソースではプレゼンテーションについて何かを仮定してはいけない。データソースとプレゼンテーションとの間のインタフェースは抽象化しておくこと。ビューに関するモデル知識を与えてはいけない。（データソースのインスタンスを1つ考え、さまざまな状態を持つプレゼンテーションが複数可能かどうか、と考えるのはよい経験則だ。）
          </li>
          <li>
<!--
            Separate controller from view and model: don't put all of the
            "business logic" into view-related classes; this makes the code
            very unusable. Make controller classes to host this code, but
            ensure that the controller classes don't make too many assumptions
            about the presentation.
-->
            コントローラをビューとモデルから分離する: 「ビジネスロジック」をすべて、ビュー関連のクラスに入れてはいけない。こうしてしまうと、そのコードはほとんど他に使い道がなくなってしまうだろう。こうしたコードはコントローラクラスに入れること。ただし、コントローラクラスではプレゼンテーションについてあまり多くを仮定しないこと。
          </li>
          <li>
<!--
            Use a <code>protocol</code> for callback APIs where all the
            methods must be implemented. Use a <code>category</code> (or an
            "informal protocol") when not all the methods need to be
            implemented.
-->
            すべてのメソッドを実装する必要のあるコールバックAPIには、<code>protocol</code> を使うこと。必ずしもすべてのメソッドを実装する必要がないときには <code>category</code>（あるいは「非形式プロトコル」）を使うこと。
          </li>
        </ul>
      </p>
    </BODY>
  </STYLEPOINT>

</CATEGORY>

<HR/>

<p align="right">
Revision 2.12
</p>



<address>
Mike Pinkerton <br/>
Greg Miller <br/>
Dave MacLachlan <br/>
（日本語訳 <a href="http://www.textdrop.net/">Takashi Sasai</a>）
</address>
</GUIDE>
