Should the NPC class have its own move function, or does the move function belong in the game class?
<p>I'm working on an android game and have been considering my main game loop. Should the NPC class in my android java game have it's own move function, or should the move function be moved into the game class? Is there any advantage between option one and option two, CPU load, size of compiled apk, maintainability etc.</p>

<p>I wanted to know if either of these two different code examples I just wrote up if one was the "correct" way. </p>

<p><strong>SUDO CODE: Option One</strong> - The NPC class has it's own move function</p>

<pre><code>class Game {
    Npc npcs[] = new Npc[10];

    public Game(){
       while(running){
           for(loop=0;loop&lt;npcs.count(); loop++){
              npcs[loop].move();
           }
       draw();
}}}
</code></pre>

<p><strong>SUDO CODE: Option Two</strong> - The move function is part of the Game class</p>

<pre><code>class Game {
    Npc npcs[] = new Npc[10];

   protected moveNPC(){
       for(loop=0;loop&lt;npcs.count();loop++){
           npcs[loop].x = // change x value
           npcs[loop].y = // change y value
       }
   }

    public Game(){
       while(running){
           moveNPC();
           draw();
}}}
</code></pre>
