Kent Beck著の「Implementation Patterns」は英語が素直なのでとても読みやすく、薄い本なので技術洋書を初めて読むときにはピッタリだ!
以下、目次に沿ってカタログを訳す。
時間をみつけて、それぞれのパターンも訳そうかな。
- Preface(序文)xv
Chapter 1: Introduction(チャプター1:導入) 1
- Tour Guide(ツアーガイド) 3
Chapter 2: Patterns(パターン) 5
Chapter 3: A Theory of Programming(プログラミングのセオリー) 9
- Values (価値) 10
- Principles (原則) 13
Chapter 4: Motivation (動機) 19
Chapter 5: Class (クラスのパターン) 21
- Class (Page 22)
- Use a class to say,"This data gose together and this logic goes with it."
- クラスを利用するということことは、いわば「このデータは、このロジックと共に進む」ということだ
- Simple Superclass Name (Page 23)
- Name the roots of class hierarchies with simple name drawn from the same metaphor.
- クラスの階層の起源となるクラスに、同じ比喩から導きだされたシンプルな名前をつける
- Qualified Subclass Name () (Page 24)
- Name subclass to communicate the similarities and differences with a super class.
- 親クラスとの類似性と相違性を知らせるサブクラス名をつける
- Abstract Interface (Page 24)
- Separate the interface from the implementarion.
- 実装からインターフェイスを切り離す
- Interface (Page 26)
- Abstract Class (Page 26)
- Specify an abstract interface which will likely change with an abstract class.
- 抽象クラスと共に変更が発生すると思われる特別なAbstract Interface
- Versioned Interface (Page 27)
- Value Object (Page 28)
- Write an object that acts like a mathematical value.
- 数学的な値のように動作するオブジェクトを記述する
- Specialization (Page 31)
- Clearly express the similarities and differences of related computations.
- 処理結果に関連した類似点と相違点を明確に表す
- Subclass (Page 32)
- Express one-dimentional variation with a subclass.
- 1次元の変化をサブクラスで表す
- Implementor (Page 34)
- Override a method to express a variant of a computation.
- 処理結果のバリエーションをオーバーライドメソッドで表す
- Inner Class (Page 34)
- Bundle locally useful code in a private class.
- プライベートクラスの中に、ローカル利用できる便利なコードを組み入れる
- Instance-Specific Behavior (Page 36)
- Vary logic by instance.
- インスタンスによってロジックを変化させる
- Conditional (Page 36)
- Vary logic by explicit conditionals.
- 明確な条件によってロジックを変化させる
- Delegation (Page 38)
- Vary logic by delegating to one of several types of objects.
- 様々な種類のオブジェクトの1つに委譲することによってロジックを変化させる
- Pluggable Selector (Page 40)
- Vary logic by reflectively executing a method.
- 実行メソッドのリフレクション型によってロジックを変化させる
- Anonymous Inner Class (Page 41)
- Vary logic by overriding one of two methods right in the method that is creating a new object.
- 新しいオブジェクトを作成している最中に、2つのメソッドの内、1つをオーバーライドすることによってロジックを変化させる
- Library Class (Page 41)
- Represend a bundle of functionality that doesn't fit into any object as a set of static methods.
- オブジェクトのメソッドにしようがない機能を束ねてスタティックメソッドの集合として表現する
Chapter 6: State (状態のパターン) 43
- State (Page 44)
- Compute with values that change over time.
- 時間と共に変化する値を処理する
- Indirect Access (Page 47)
- Access state through a method to provide greather flexibility.
- より高い柔軟性を提供するためにメソッドを通じて状態にアクセスする
- Common State (Page 47)
- Store the state common to all objects of a class as fileds.
- クラスの全てのオブジェクトに共通の状態をフィールドとして格納する
- Variable State (Page 48)
- Store state whose presence differs from instance to instance as a map.
- インスタンスによって異なる状態をMapとして格納する
- Extrinsic State (Page 50)
- Store special-purpose state associated with an object in a map held by the user of that state.
- 特定のオブジェクトに関係する特殊な目的の状態をその状態の利用者によって保持されたマップに格納する
- Variable (Page 50)
- Variables provide a namespace for accessing state.
- 状態へのアクセスのためにネームスペースを提供する変数
- Local Variable (Page 51)
- Local variables hold state for a single scope.
- 単一スコープのために状態を保持するローカル変数
- Field (Page 52)
- Fields store state for the life of an object.
- オブジェクトの生存期間のための状態を格納するフィールド
- Parameter (Page 53)
- Parameters communicate state during the activation of a single method.
- 単一のメソッドが活動している間の状態を連携する引数
- Collecting Parameter (Page 55)
- Pass a parameter to collect complicated results from multiple methods.
- 複数のメソッドから複雑な結果を収集するための引数を渡す
- Parameter Object (Page 57)
- Consolidate frequently used long parameter lists into an object.
- オブジェクトの中に良く利用する長いパラメータリストを統合する
- Constant (Page 58)
- Store state that doesn't vary as a constant.
- 変化しない状態を定数として格納する
- Role-Suggesting Name (Page 58)
- Name variavles after the role they play in a computation.
- 変数の名前に、処理結果のなかでそれらが演じた役割の名前をつける
- Declared Type (Page 60)
- Declare a general type of variables.
- 変数の汎用的な型を宣言する
- Initialization (Page 61)
- Initialize variables declaratively as much as possible.
- 可能な限り沢山の宣言された変数を初期化する
- Eager Initialization 61
- Initialize fields at instance creation time.
- インスタンスが生成されるときにフィールドを初期化する
- Lazy Initialization (Page 62)
- Initialize fields whose values are expensive to calculate just befor they are first used.
- 処理コストのかかる値をもつフィールドを、初めて利用される直前に初期化する
Chapter 7: Behavior (振る舞いのパターン) 63
- Control Flow (Page 64)
- Express computations as a sequence of steps.
- ステップの順番を処理順の通りに宣言する
- Main Flow (Page 64)
- Clearly express the main flow of control.
- 制御のメインフローを明確に宣言する
- Message (Page 65)
- Express control flows symmetric by sending a sequence of messages to the same receiver.
- 同じ受信者に送るメッセージの連続による対象的なコントロールフローを宣言する
- Choosing Message (Page 65)
- Vary the implementors of a message to express choices.
- 選択を明示するための実装者のメッセージを変える
- Double Dispatch (Page 66)
- Vary the implementors of messages along two axes to express cascading choices.
- 連鎖する選択を表現する2本の軸に沿った実装者のメッセージを変える。
- Decomposing (Sequencing) Message (Page 67)
- Break complacated calculations into cohesive chunks.
- 凝集性がある大量の複雑な処理を壊す
- Reversing Message (Page 67)
- Make control flows symmetric by sending a sequence of messages to the same receiver.
- メッセージの連続を同じ受信者に送ることによって、コントロール流れを対照的(シンメトリー)にする
- Inviting Message (Page 68)
- Invite future variation by sending a message that can be implemented in different ways.
- 別の方法によって実装可能であるというメッセージを送ることによって将来的にバリエーションを勧める
- Explaining Message (Page 69)
- Send a message to explain the purpose of a clump of logic.
- ロジックの集まりの目的を説明するためのメッセージを送る
- Exceptional Flow (Page 70)
- Express the unusual flows of control as clearly as possible without interfering with the expression of the main flow.
- メインフローへの干渉することなく、例外的なフローの制御を可能な限り明確に表現する
- Guard Clause (Page 70)
- Express local exceptional flows by an early return.
- 初期のリターンによって、ローカルの例外フローを表現する
- Exception (Page 72)
- Express non-local exceptional flows with exceptions.
- ローカルでない例外フローをエクセプションによって表現する
- Checked Exceptions (Page 72)
- Ensure that exceptions are caught by declaring them explicitly
- エクセプションが明示的な宣言によってキャッチされているかを確かめる
- Exception Propagation (Page 73)
- Propagate exceptions,tramsforming them as neccessary so the information they contain is appropriate to the catcher.
- 捕獲した側にとって適切であるように、必要に応じて変換する例外を広める
Chapter 8: Methods (メソッドのパターン) 75
- Composed Method (Page 77)
- Compose methods out of calls to other methods.
- 他のメソッドからの呼び出しをメソッドに組み込む
- Intention-Revealing Name (Page 79)
- Name methods after what they are intended to do.
- メソッドの後にやろうとしていることをつけた名前をつける
- Method Visibility (Page 80)
- Make methods as private as possible.
- 出来るだけプライベートなメソッドを作る
- Method Object (Page 82)
- Turn complex methods into their own objects.
- 複雑なメソッドの中に、自分自身のオブジェクトを渡す
- Overridden Method (Page 83)
- Override methods to express specialization.
- 特化を表現するためにメソッドをオーバーライドする
- Overloaded Method (Page 83)
- Provide alternative interface to same computarion.
- 同じ処理に対する代替のインターフェイスを提供する
- Method Return Type (Page 84)
- Delcare the most general possible return type.
- できるだけ最も一般的な型を返却するよう宣言する
- Method Comment (Page 85)
- Comment methods to communicate information not easily read from the code.
- コードからは読み取りがたい情報を伝えるためにメソッドにコメントをつける
- Helper Method (Page 85)
- Create small,private methods to express the main computation more succinctly.
- より簡潔にメインの処理を表現するためにプライベートメソッドを細かく作成する
- Debug Print Method (Page 86)
- Use toString() to print useful debugging information.
- toString()メソッドを利用しやすいデバッグ情報を出力するために利用する
- Conversion (Page 87)
- Express the conversion of one type of object to another cleanly.
- 1つの型のオブジェクトの変換を、簡潔に別のものとして表現する。
- Conversion Method (Page 87)
- For simple,limited conversions,provide a method on the source object that returns the converted object.
- シンプルさのために、限られた変換とすること。元オブジェクトに変換されたオブジェクトを返すメソッドを提供する
- Conversion Constructor (Page 88)
- For most conversions, provide a method on the converted object's class that takes the source objects as a parameter.
- 多くの変換のために、変換されたオブジェクトのクラスに、変換元のオブジェクトを引数として取るメソッドを提供する
- Creation (Page 88)
- Express object creation clearly.
- オブジェクトの生成を簡潔に表現する
- Complete Constructor (Page 89)
- Write constructors that return fully formed objects.
- 完全に整形されたオブジェクトを返すコンストラクターを記述する。
- Factory Method (Page 90)
- Express more complex creation as a static method on a class rather than a constructor.
- コンストラクターよりも、より複雑なオブジェクトの生成を表現するスタティックメソッドを表現する
- Internal Factory (Page 91)
- Encapsulate in a helper method object creation that may need explanation or later refinement.
- 説明や後の洗練化に必要になるなので、オブジェクトの生成をヘルパーメソッドにカプセル化する。
- Collection Accessor Method (Page 91)
- Provide methods that allow limited access to collections.
- コレクションに対して制限的なアクセスのみを許可するメソッドを提供する
- Boolean Setting Method (Page 93)
- If it helps communication,provide two methods to set boolean values ,one for each state.
- コミュニケーションの役に立つならば、Boolean型の値をセットする2つのメソッドをそれぞれの状態に対して提供する
- Query Method (Page 93)
- Return boolean values with methods named asXXX.
- asXXXという名前のメソッドで、Boolean値を返す。
- Equality Method (Page 94)
- Define equals()and hashCode()together.
- equals()メソッドとhashCode()メソッドを一緒に定義する
- Getting Method (Page 95)
- Occasionally provide access to fields with a method returning that field.
- Setting Method (Page 96)
- Even less frequently provide the ability to set fields with a method.
- 頻繁にアクセスすることがないものであっても、メソッドを使ってフィールドにセットする能力を提供する
- Safe Copy (Page 97)
- Avoid aliasing errors by copying objects passed in or out of accessor methods.
- InまたはOutのアクセサメソッドで渡されたオブジェクトをコピーすることによって、エイリアシングエラーを避ける。
Chapter 9: Collections (コレクションのパターン) 99
- Metaphors (Page 100)
- Issues (Page 101)
- Interfaces (Page 103)
- Implementations (Page 107)
- Collections (Page 110)
- Extending Collections (Page 114)
Chapter 10: Evolving Frameworks (進化するフレームワーク) 117
- Changing Frameworks without Changing Applications (Page 117)
- Incompatible Upgrades (Page 118)
- Encouraging Compatible Change (Page 120)
Appendix A: Performance Measurement 131
- Example (Page 131)
- API (Page 132)
- Implementation (Page 133)
- MethodTimer (Page 134)
- Canceling Overhead (Page 136)
- Tests (Page 136)