Adding networking capabilities

I added networking to my game, but I’m wondering where the best place is to send network messages.

My first idea was to add the network code to each action in the game wich results in this:
EndTurnAction

I think that is rather messy, as half of the class is networking code. So my second Idea was to move all network code in some kind of facade like

replace:

      case NETWORK_SNAIL_GAME: 
         endTurnInSnailGameMode(); 
         break; 
 

with:

      case NETWORK_SNAIL_GAME: 
         NetworkFacade.getInstance().endTurnInSnailGameMode(session); 
         break; 

Now all the network code is grouped in 1 class NetworkFacade. Along with the catch blocks and GUI dialogs…

and then my last idea was to create a wrapper around the EndTurnAction class called the NetworkEndTurnAction class that ends the turn and sends a network message. But then I have to change the way I create new EndTurn Actions. if network then create network wrapper else create normal action?

An action is created in the ActionFactory like this:

public class ActionFactory { 
  public static CWAction buildEndTurnAction() { 
     ActionBag endTurnAction = new ActionBag("End Turn"); 
     endTurnAction.add(new ClearInGameStateAction()); 
     endTurnAction.add(new EndTurnAction()); 
     endTurnAction.setActionText("end_turn"); 
     return endTurnAction; 
   } 
 }

This is just 1 action ofcourse there are many more actions. Wich of the above 3 ideas would be the cleanest most beautifull/amazing/super way? Any hints on how this is normally done?

You aren’t going to find any magic solutions. The best implementation is the one that is least likely to become unsuitable as you add more to your program. If you don’t know which one that is, we can’t help you without learning more about your program than you do, which is silly. If you pick an implementation that later becomes unsuitable, it’s not the end of the world; just refactor it. Bottom line: just do it.