title: Is it idiomatically ok to put algorithm into class?
body: <p>I have a complex algorithm. This uses many variables, calculates helper arrays at initialization and also calculates arrays along the way. Since the algorithm is complex, I break it down into several functions.</p>
  
  <p>Now, I actually do not see how this might be a class from an idiomatic way; I mean, I am just used to have algorithms as functions. The usage would simply be:</p>
  
  <pre><code>Calculation calc(/* several parameters */);
  calc.calculate();
  // get the heterogenous results via getters
  </code></pre>
  
  <p>On the other hand, putting this into a class has the following advantages:</p>
  
  <ul><li>
  I do not have to pass all the variables to the other functions/methods</li><li>
  arrays initialized at the beginning of the algorithm are accessible throughout the class in each function</li><li>
  my code is shorter and (imo) clearer</li></ul>
  
  <p>A hybrid way would be to put the algorithm class into a source file and access it via a function that uses it. The user of the algorithm would not see the class.</p>
  
  <p>Does anyone have valuable thoughts that might help me out?</p>
  
  <p>Thank you very much in advance!</p>