It's kinda weird why anyone would place a gun on the aft of a sub. You will need to be moving away from your target, or you will need to expose your broad side to it, which is not a very wise thing to do, if it has guns itself. If you are approaching an unaware target at high speed, surely you would like to open the ball without having to turn your boat around for the first shot.
The aft mounted gun is in my opinion one of the odds of history and submarine design.