<p>When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives:</p>

<pre><code>1. needle.find(haystack)

2. haystack.find(needle)

3. searcher.find(needle, haystack)</code></pre>

<p>Which do you prefer, and why?</p>

<p>I know some people prefer the second alternative because it avoids introducing a third object. However, I can't help feeling that the third approach is more conceptually "correct", at least if your goal is to model "the real world".</p>

<p>In which cases do you think it is justified to introduce helper objects, such as the searcher in this example, and when should they be avoided?</p>

This entirely depends on what varies and what stays the same.
For example, I am working on a (non-OOP)
framework
where the find algorithm is different depending both on the type of the needle and the haystack. Apart from the fact that this would require double-dispatch in an object-oriented environment, it also means that it isn't meaningful to write either
```
needle.find(haystack)
```
or to write
```
haystack.find(needle)
```
.
On the other hand, your application could happily delegate finding to either of both classes, or stick with one algorithm altogether in which case the decision is arbitrary. In that case, I would prefer the
```
haystack.find(needle)
```
way because it seems more logical to apply the finding to the haystack.