title: Design: How much should a method do?
body: <p>I understand that a method should effectively serve a single purpose.  But what if my method (also acts as API) is named like execute() ?</p>
  
  <p>So the stuff is like this :</p>
  
  <pre><code>void execute() {
      /* some steps to initialize stuff */
      List&lt;String&gt; dataToBeExecuted = mainClass.getData();
      /* initialization ends */
  
      /* steps to actually execute data */
      for( ...) {
          try {
              /* generate args to be passed to executeData() */
              otherClass.executeData(args.. , dataToBeExecuted);
          } catch {
              /* log stuff */
          }
      }
      /* execution ends */
  
      /* steps to do some validation */
  }
  </code></pre>
  
  <p>Okay, so now this function in itself is doing 3 things,</p>
  
  <p><code>* initialize stuff
   * execute Data
   * validate stuff</code></p>
  
  <p>It can be broken down into 3 methods, but I think since the logic is simple enough it can be kept in the parent execute() method.</p>
  
  <p>What is the correct approach?</p>