<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Moussa Sow on Medium]]></title>
        <description><![CDATA[Stories by Moussa Sow on Medium]]></description>
        <link>https://medium.com/@Afrinux?source=rss-a9dce9c27720------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BGCyPCWBDjsODl9O.</url>
            <title>Stories by Moussa Sow on Medium</title>
            <link>https://medium.com/@Afrinux?source=rss-a9dce9c27720------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:37:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Afrinux/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Halal products at Rogers]]></title>
            <link>https://medium.com/@Afrinux/halal-products-at-rogers-842319e0933?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/842319e0933</guid>
            <category><![CDATA[halal-japan]]></category>
            <category><![CDATA[halal]]></category>
            <category><![CDATA[japan]]></category>
            <category><![CDATA[halal-food-market]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Thu, 22 Feb 2018 02:28:48 GMT</pubDate>
            <atom:updated>2018-02-22T02:35:12.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Bismillah!<br>Rogers Supermarket one of the largest discount stores is now selling halal foods.<br>The branches are mainly located in Saitama Prefecture.</p><p>ロヂャーススーパーマーケットは埼玉県を中心に展開されている大きなディスカウントストアがハラールフードを扱うことになりました！</p><p>You can find the map of the stores in the link below:</p><p><a href="http://www.rogers.co.jp/shop/">ディスカウントスーパー ロヂャース - 店舗情報</a></p><p>Below is what I could find to the store near me during my last visit there.<br>If you are a fan of Bagels, you would love it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*GsXZP_n4ZtZzV0UfWquCLw.jpeg" /><figcaption>Different types of Bagels</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cInUP4Epr7YEam88Gc6meg.jpeg" /><figcaption>Paratha and Chapatti</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*aPlHlAllN-pLNP90twMJGQ.jpeg" /><figcaption>Plain bagels</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*V2_0y9ElZWpie_PEkCklsQ.jpeg" /><figcaption>Bagel: french toast flavor</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ICONFBdzkx5WPAVQg-W2JQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=842319e0933" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visitorパターン]]></title>
            <link>https://medium.com/@Afrinux/visitor%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3-6799db539714?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/6799db539714</guid>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Mon, 27 Nov 2017 06:13:20 GMT</pubDate>
            <atom:updated>2017-11-27T06:13:20.898Z</atom:updated>
            <content:encoded><![CDATA[<p>概要</p><p>Visitor パターンは、データ構造と振る舞いを別々のクラスに扱わせて、振る舞いの変更や追加、拡張を可能にするパターンである。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*-3ZY3Ybp_uh9_prqCtUKhw.png" /></figure><p>実装例：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e7ca65884c08bc9bc34b7130edc52ee/href">https://medium.com/media/6e7ca65884c08bc9bc34b7130edc52ee/href</a></iframe><h3>Visitorの使いどころ</h3><p>Visitorパターンがよく使われるのは、「<em>大きなデータ構造を渡り歩き、レポートを出力するような場合</em>」である。そうすれば、データ構造体オブジェクト自体がレポート生成用のコードを持たなくていい。また、データ構造体のコードを変更しなくても、新しいレポート機能を追加したいときには、新しいVisitorを追加することで実現できる。このことは、レポート機能を別コンポーネントとして分離し、顧客にとって必要な機能だけを個別に配布できることを意味している。</p><h3>まとめ</h3><h4>メリット</h4><ul><li>構造とオペレーションが分離されていることによりOCP(Open Closed Principle)なコードになり、要素への新しいオペレーションの追加が容易</li><li>オペレーションを実行する要素の型がわからなくとも共通のクラスからオペレーションを呼び出せる</li></ul><h4>デミリット</h4><p>要素を追加するたびに新しいメソッドを追加する必要がある</p><h3>その他</h3><p><a href="https://github.com/meierjan/BetterAdapters/tree/master/app/src/main">https://github.com/meierjan/BetterAdapters/tree/master/app/src/main</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6799db539714" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bridgeパターン]]></title>
            <link>https://medium.com/@Afrinux/bridge%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3-c8f61f089fd?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8f61f089fd</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 06:09:26 GMT</pubDate>
            <atom:updated>2017-11-13T06:58:15.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>概要</h3><p>Bridgeパターンとは、「Bridge」すなわち「橋」の役割を果たすパターンです。<br>Bridgeパターンを利用することで、機能と実装を分離して、それぞれを独立に拡張することができるようになります。</p><h3>適用場面</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*cKK2cAaJAv7Gw6pK5rnLFg.png" /><figcaption>問題</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*B2r7DkaK0YJUiUFs1rRBYw.png" /><figcaption>解決</figcaption></figure><p>●抽象化されたインタフェースに対する実装を柔軟に変更できるようにしたい場合<br>●抽象化されたインタフェースとその実装をそれぞれ別々に継承を使って拡張したい場合<br>●抽象化されたインタフェースに対する実装を修正したときに、そのインタフェースを利用しているコードを変更せずにすませたい場合<br>●複数のオブジェクトから1つの実装を共有したい場合</p><h3>Brideパターンの実装例</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9f0b2545b440b167c01629e7037496d/href">https://medium.com/media/f9f0b2545b440b167c01629e7037496d/href</a></iframe><h3>まとめ</h3><h4>メリット</h4><p>ー実装を簡単に入れ替えることができる。<br>ー機能を書いているのと同じファイルに実装が記載されないことで、コードの見通しが良くなる。<br>ー クライアントから実装の詳細を隠蔽されていることが保証される</p><h4>ーデメリット</h4><p>●アプリケーションにおけるオブジェクトの数を増加させる<br>●同じ実装クラスが重複している<br>● 機能と実装の結合度が高く、拡張の度にクラス数が肥大化していく</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8f61f089fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Singleton Pattern]]></title>
            <link>https://medium.com/@Afrinux/singleton-pattern-19c2fe30532c?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/19c2fe30532c</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[objective-c]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Mon, 06 Nov 2017 05:11:48 GMT</pubDate>
            <atom:updated>2017-11-06T08:40:17.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*nwzWtBKdY_QRgvlRlkW-Mw.jpeg" /></figure><p>Singleton パターンとは生成するインスタンスの数を1つに制限するデザインパターンです。</p><h3><strong>Singletonパターンの実装例</strong></h3><p>Singletonパターンを適応するにあたり、以下のルールに準拠する必要がある：</p><ul><li>自身の型のインスタンスが privateなクラス変数として定義されている</li><li>外部から生成されないようにprivateにしている</li><li>インスタンスを返すためのクラス関数が定義されている</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be34e05da14a0cd33b5bf33440a88b8d/href">https://medium.com/media/be34e05da14a0cd33b5bf33440a88b8d/href</a></iframe><p><strong>参照方法</strong></p><pre>Singleton instance <strong>=</strong> Singleton<strong>.</strong>getInstance<strong>();</strong></pre><h3><strong>その他</strong></h3><p>Androidのライフサイクルによってメモリが圧迫されると、勝手にActivityが破棄されるため、Javaクラスのstatic変数もクリアされる可能性がある。<br>メモリリークをする可能性もある。AndroidでSingletonをするまえに、Singletonを使わずになんとかできないかを考えてみたほうがいいと思われる。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19c2fe30532c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Halal labeled products at Gyoumu Supa]]></title>
            <link>https://medium.com/@Afrinux/halal-labeled-products-at-gyoumu-supa-7d74eafab1e1?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d74eafab1e1</guid>
            <category><![CDATA[japan]]></category>
            <category><![CDATA[halal]]></category>
            <category><![CDATA[food]]></category>
            <category><![CDATA[halal-food-market]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Sun, 09 Jul 2017 13:39:36 GMT</pubDate>
            <atom:updated>2017-07-09T14:05:17.273Z</atom:updated>
            <content:encoded><![CDATA[<p>Bismillah! Today I had a little time. So I decided to go the local Gyoumu Supa to take pictures of halal products in the hope of sharing it. Below are Halal labeled products which could be found at Gyoumu Supa. One good thing about Gyoumu Supa is that the prices of the products are relatively very cheap.</p><p>You can navigate from <a href="http://www.kobebussan.co.jp/shop/">here</a> to find the closest store from your place.</p><h3>Meat</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYF3QZTWf4nxykKHYVUhQw.jpeg" /><figcaption>Sliced Beef</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puVLkghcRfZAcxvzSXYT7A.jpeg" /><figcaption>BBQ beef</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTE2QhLdFpwkbo8TOwfvgg.jpeg" /><figcaption>Chicken</figcaption></figure><h4>Bread</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzoLOrQDkqV082LHATtAlQ.jpeg" /><figcaption>Paratha</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2qGYEvnEK6xKN8VHGXxTg.jpeg" /><figcaption>Tortillas</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxaWv2noH5DbEz8h6HUBeQ.jpeg" /></figure><h4>Cereals</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCDOjkp0jvJx4qxssr6MlQ.jpeg" /><figcaption>flakes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7B3wTXiURwnCvoVdfa7LQ.jpeg" /><figcaption>Crunches</figcaption></figure><h4>Dairies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDZFKhqwInrEVLZ02Bk3Ew.jpeg" /><figcaption>Condensed milk and cream</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGrqgfNa1uoEeTdofgStvA.jpeg" /><figcaption>Creaming powder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bm0DGRnbmE7GMk3c9nfHVA.jpeg" /><figcaption>Creamy cocoa</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G60rbVhKyggn2uhpBworHA.jpeg" /><figcaption>Coffee</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3oFCjRabPUcgL7lHoHDnog.jpeg" /><figcaption>Jams</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQH2I4NAg9qZ93Lf5ay5BA.jpeg" /></figure><h3>Fries</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BXCBRMQclSiHYtDbv3XpDg.jpeg" /><figcaption>Shrimps for fry</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6EHwl8hq0gSb0PeTMNtu_w.jpeg" /><figcaption>Chicken Nuggets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kIGNFn6ZpLf-6clC25bDPg.jpeg" /><figcaption>Peas sticks</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ARxpB2a2_rkzaWzKRYM4xQ.jpeg" /><figcaption>Curry Puff</figcaption></figure><h4>Snacks</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eaf2UGjRXat2tGNib_hug.jpeg" /><figcaption>Cookies and Wafers</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1s6FqL675MPte1bEB_OYw.jpeg" /><figcaption>Biscuits</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0eCH5GX7yhNx3J8E2YY5Q.jpeg" /><figcaption>Potato Crisp</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHSBtwgZxFbX0uV9q3T6Mg.jpeg" /><figcaption>Truffles</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBb3khdCcACZ_FU0xKSXIg.jpeg" /><figcaption>Crackers</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecfAd2breXmmnE72X5nwaw.jpeg" /><figcaption>Crispy bread</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4wDBruFl5hFog0Gcw-fyQg.jpeg" /><figcaption>Biscuits and Wafers</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vDnXW3zU0Ye1akU4O94Gw.jpeg" /><figcaption>Potato Crisps</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pFvOZ_2MdfPFzr2er7LNg.jpeg" /><figcaption>Cookies</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWuDmCG2H6XBRNO44s3O1Q.jpeg" /><figcaption>Wafers</figcaption></figure><h4>Cakes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVTUBAryotueN7mR6YxpeA.jpeg" /><figcaption>Chocolate Cake</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DehJdOmnk9Bpy5ArC0VQNw.jpeg" /><figcaption>Cheese cake</figcaption></figure><h4>Bouillons</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ygI_v6eZhmdTATtCJ9BKWg.jpeg" /><figcaption>Beef and Chicken Bouillons</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7r5OQER3KXVm93cSDxEKFQ.jpeg" /><figcaption>Beef Chicken Vegetable Stocks</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVIynpWL1Iv1JSAn2u-B2g.jpeg" /><figcaption>Black Pepper Mustard powder</figcaption></figure><h4>Other</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3KZh09ycXdyHuctot7TfQ.jpeg" /><figcaption>Korean Chizimi</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0Krt94fIkFy36y6byeEBw.jpeg" /><figcaption>Pastry sheets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tdcVUIbholJdOVQlzAkgkg.jpeg" /><figcaption>Chili Sauce</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8lVPSxgWs_JPU3YgNfXEA.jpeg" /><figcaption>Pasta</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYNs_lkrmjS2dd2OtR7mwg.jpeg" /><figcaption>Pineapple and Manga juices</figcaption></figure><p>There are still more.<br>I didn’t have the chance to take the pics of all the products.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d74eafab1e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Facade pattern]]></title>
            <link>https://medium.com/@Afrinux/facade-pattern-d63ec1c9f789?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/d63ec1c9f789</guid>
            <category><![CDATA[facade]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Wed, 01 Mar 2017 05:09:14 GMT</pubDate>
            <atom:updated>2017-03-01T05:10:44.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*Zp6lGnfTHggsMy5Yntd2OA.jpeg" /></figure><p>Facadeとは，フランス語で「正面窓口」という意味です。Facadeパターンは，クライアントに対して単純化された高レベルのインタフェースを提供します。</p><h3>Facadeパターンの実装例</h3><p>引き続き、喫茶店を実装例に使う</p><h4>①飲み物作成クラス</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ca7656a1cd3f3e921e692e7ed4a482e/href">https://medium.com/media/0ca7656a1cd3f3e921e692e7ed4a482e/href</a></iframe><h4>②会計クラス</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29a493bf15b3eb6d692fc42c5d81595a/href">https://medium.com/media/29a493bf15b3eb6d692fc42c5d81595a/href</a></iframe><h4>③ Facadeバターンを利用したクラス</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf59045149750a57d1015145eb3d28f7/href">https://medium.com/media/cf59045149750a57d1015145eb3d28f7/href</a></iframe><h3>まとめ</h3><h4>メリット</h4><p>. 複数のサブシステムの窓口となる共通のインタフェースを提供する。</p><p>. 複雑なクラス構成をまとめてシンプルなインタフェースを提供する。</p><h4>デメリット</h4><p>.</p><p>Facadeパターンを使っているクラスの名前は大体 Managerがついています。 xxxManager { }</p><h3>その他</h3><p>Facade Design Pattern tutorial</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FB1Y8fcYrz5o%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DB1Y8fcYrz5o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FB1Y8fcYrz5o%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba213ac0e0218fe54766e1408d9a69f6/href">https://medium.com/media/ba213ac0e0218fe54766e1408d9a69f6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d63ec1c9f789" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strategy Pattern]]></title>
            <link>https://medium.com/@Afrinux/strategy-pattern-dbd1f5ec9d55?source=rss-a9dce9c27720------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbd1f5ec9d55</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Moussa Sow]]></dc:creator>
            <pubDate>Tue, 14 Feb 2017 09:25:13 GMT</pubDate>
            <atom:updated>2017-02-14T09:25:13.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*A12G1t92kz40hx1s2aVPuA.jpeg" /></figure><p>Strategyパターンは一連のアルゴリズムを定義し、それぞれをカプセル化してそれらを交換可能にする。Strategyパターンによって、アルゴリズムを使用するクライアントとは独立して、アルゴリズムを変更出来る。</p><p><strong><em>Strategyパターンの基本的図</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*1q6szaTP1safkYib8UoAcA.gif" /></figure><h4>Strategyパターンの実装例：</h4><h3>STEP①：インターフェースを定義</h3><p>全てのアルゴリズムに共通のインターフェイスを宣言</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de5e43891b63420bd92c354477f35d1e/href">https://medium.com/media/de5e43891b63420bd92c354477f35d1e/href</a></iframe><h3>STEP②： Concreteクラスを実装</h3><p>STEP①で定義されたインターフェイスのアルゴリズムを実装する。</p><p>ガス、電気または炭を使ってお湯を沸かす例を使用：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1893ab8f7dee92f376bc9c253ee06973/href">https://medium.com/media/1893ab8f7dee92f376bc9c253ee06973/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/775b18decfe7dc8b5172e2510cbd78a3/href">https://medium.com/media/775b18decfe7dc8b5172e2510cbd78a3/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69c0d46e17c20026511ae8ff50082aed/href">https://medium.com/media/69c0d46e17c20026511ae8ff50082aed/href</a></iframe><h3>STEP③： Contextクラスを宣言</h3><p>ContextクラスはSTEP②で定義されているオブジェクトを備えている</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80b04e1c0c02c5c1a73fdd306d1efa78/href">https://medium.com/media/80b04e1c0c02c5c1a73fdd306d1efa78/href</a></iframe><h3>STEP④ 実装</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a81037c2a888828c3d3d6258bc62c1df/href">https://medium.com/media/a81037c2a888828c3d3d6258bc62c1df/href</a></iframe><h3>まとめ</h3><p>Strategy パターンに従うと、クラスの振る舞いは継承されるべきではなく、インターフェイスを用いてカプセル化するべきである。</p><p><strong>メリット：</strong><br>・依存関係逆転の原則（<a href="https://en.wikipedia.org/wiki/Dependency_inversion_principle">DIP</a>）に準拠する<br>・繰り返し現れる switch や if などの条件分岐をなくす<br>・ユニットテストを作成しやすくなる<br>・同じ振る舞いに対して異なる実装を提供することができる</p><p><strong>デメリット：</strong><br>・ アプリケーションにおけるオブジェクトの数を増加させる</p><h3>その他:</h3><p>Strategy Design Pattern tutorial</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-NCgRD9-C6o%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-NCgRD9-C6o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-NCgRD9-C6o%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d5fe3efc2c2af9c5e3eac27ac68acff/href">https://medium.com/media/8d5fe3efc2c2af9c5e3eac27ac68acff/href</a></iframe><p>Strategy Design Pattern real world example</p><p><a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/awt/LayoutManager.java">java.awt.LayoutManager</a>はStrategyパターンを利用している。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbd1f5ec9d55" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>