I have two algorithms that share a lot of commonalities. One performs an iterative procedure, the other does just the first iteration. The results are, of course, different (one class provides results that the other can't), as well as the setup (the iterative process requires tolerances and max number of iterations, which are irrelevant in the non-iterative one).
Should I have a unique class with internal ifs (like if (iterative) do this else do that
) or should I implement two different classes (and potentially put common code in an accessible place so that it can be shared ?) What do you think ?