Algorithms in classes
<pre><code>GraphSearchDFS DFS = new GraphSearchDFS(Graph, source, target);
</code></pre>

<p>I am working from a book and the author puts graph search algorithms in classes. The above piece of code, he calls from another function that updates EACH FRAME. He calls the actual algorithm in the constructor of GraphSearchDFS with GraphSearchDFS.Search().</p>

<p>So basically, each frame he creates a new object. Isn't that dumb? Why not just create one such and then just call GraphSearchDFS.Search() each frame?</p>

<p>Thanks</p>
