<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>unibon</author_name>
  <author_url>https://blog.hatena.ne.jp/unibon/</author_url>
  <blog_title>unibonの日記</blog_title>
  <blog_url>https://unibon.hatenadiary.org/</blog_url>
  <categories>
    <anon>株</anon>
    <anon>コンピューター</anon>
  </categories>
  <description>たとえば Buy メソッドと Sell メソッドがあって、売り買いの別が違うだけで対称的な処理を書いてあることが良くある。で、これをひとつのメソッドにまとめるにはどうすればよいかで迷う。 単純に引数 bool buy みたいなものを持ったメソッド Trade(bool buy) にまとめてしまうとしても、結局メソッドの中で if 文で2つに分かれるだけになってしまうことになりかねない。これでも外部インターフェースはひとつにまとまっているから、それなりの成果はあるのだが、しかし内部もキレイにまとめたい。このやりかたが良く分からない。 たとえば買いが if (x &gt;= 0) で売りが if (x …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Funibon.hatenadiary.org%2Fentry%2F20100513%2Fp3&quot; title=&quot;売りと買いで対称的な処理をどうやってひとつにまとめるか - unibonの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-05-13 00:00:02</published>
  <title>売りと買いで対称的な処理をどうやってひとつにまとめるか</title>
  <type>rich</type>
  <url>https://unibon.hatenadiary.org/entry/20100513/p3</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
