LoginSignup
1
1

More than 3 years have passed since last update.

UnityエンジニアがStrategyPatternを調べるおすすめの学習過程

Last updated at Posted at 2020-02-17

概要

自分がStrategyPaternを学習した軌跡のメモです。
また忘れたときに読む用ぐらいに書きましたが役に立てば幸いです。

対象

StrategyPaternの記事が多すぎてどれからよめば良いかわからない方
UnityでC#かけるけど、デザインパターンわからんぐらいの人

学習手順

①使わなかった場合の問題点把握

https://twitter.com/MinoDriven/status/1228896043435094016
https://speakerdeck.com/minodriven/kusokododong-hua-switchwen-jie-shuo
これめっちゃわかりやすいです。
Swich文をStrategyPaternにしたら仕様変更に対応できるよ~って内容の動画+スライドです

②ざっくり把握 IT専科 Strategy パターン

http://www.itsenka.com/contents/development/designpattern/strategy.html
初めの抽象的に書いてる部分がすごいまとまってます。サンプルを複数見た後に読むとグッときます。
なのでここではまだ理解できないで大丈夫です。
image.png

③Unityコードサンプルで把握

https://github.com/QianMo/Unity-Design-Pattern
サンプルが2つあります。
中のサンプル2を自作したクラス図です。
image.png

④UnityでまなぶStrategyPatern

https://techlife.supride.jp/archives/1411
ここまで読むとだいだい理解できます。

⑤ もう一度②を読む

抽象的に書いてあるので、応用するときに気を付けなければいけない点がよくわかります。

StrategyPaternの使いどころ

抽象的に言うと
・アルゴリズム的な処理を入れ替えたいとき

具体的に読みやすくしたいと考えるタイミングで言うと
・Swich文を読みやすいように変更

もっと具体的にいうと
・映画館の価格表
・ポケモンの技みたいな分岐の実装

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1