I'm going to focus on defense at Outpost Level 3 and Level 4. At Level 2, you don't really have enough land to put any sort of these techniques together, and you really shouldn't be there for long anyway.
Right now with a day and a half left on my bubble, I am Level 29 with Outpost 4, Level 7 Weapons Lab, Level 7 Naval Lab, and 3 Level 7 Warehouses. I have 5 Level 3 turrets, 7 Level 2 (and I plan to get at least 2 more to Level 3 before I lose my bubble).
So to break down base defense in Battle Pirates, you must understand the three types of turrets: Long Range, Short Range, and Defensive. There is no "Best" turret, and a base defense will not work (maybe sometimes, but not often) if it tries to depend on only a single type of turret.
Long Range Turrets: These are intended to be the real damage dealers to enemy fleets. These turrets are the Sentinel Missile and the Victory Mortar. The Sentinel is an aimed weapon that fires a damaging missile at enemy ships. Low level players will depend on the Sentinel much more than high level - you usually won't see this turret in high level bases. The Victory Mortar fires a salvo of mortar shells, doing splash damage in an area. This can damage all ships in the attacking fleet simultaneously if they are stacked up (which base attackers usually are), but moving fleets can often outrun the shells.
Short Range Turrets: The short range turrets can do even more damage than the long range turrets, but most base attack weapons (mortars and missiles) will outrange them. The Howitzer is a rapid fire ballistic weapon that aims shots at a single target. The Cerberus is a rocket platform firing a salvo of rockets at close range. The Cerberus is extremely destructive, and a sure fire way for a novice to lose their base fleet is to drive into range of a Cerberus. "Red means stop!"
The way short range weapons work is that they force the attacking fleet to stop outside the turret's range in order to avoid taking the damage. A smart base layout will figure out the places where an attacker must stop, and place long range turrets so that they can fire at those spots. The best way to estimate range is to use a Howitzer. Its range is slightly shorter than most base attack weapons, so click on the gun, look at the red circle showing its range, then figure base attack fleets will stop near, but outside of that circle. You can (temporarily) move the howitzer around to see the stop points for different turret locations.
Defensive Turrets: Flak turrets defend against missiles. Each shot of a flak turret gives some splash, so it will take out incoming missiles across a small area. Bombard turrets defend against mortars, so the bombard shots will blunt the damage from an incoming mortar attack. None of these defensive turrets is perfect, they can get overwhelmed by sustained fire, but their purpose is to slow down attackers even more by forcing them to take more time to destroy the turrets.
I'll post pictures of an Outpost 3 and an Outpost 4 layout to try to illustrate some principles of base defense.
My Outpost 3 design (never tested):
Since I knew I could reach OP 4 before my bubble popped, I never finished my weapons while using this base design. The basic idea of this base is that the front row of turrets would be short range turrets, and the back row would be long range. The double wall really helps against ballistic fleets, which are sometimes used for base hits by low level players (not so often at high levels).
I protected only the warehouses and the Outpost on land. My dock is also in a fairly well protected area. Although it would be snipable by players with tech like SFB3 Assault Missiles, Launchers, or UAVs, other players around level 28 would not have the capability.
This base design certainly has some weaknesses - the double row of turrets means that splash (mortars) that are directed at the first row of turrets may also damage the second row. Also, the placement of the outpost means that ships don't have to go all the way around the channel and island to reach the outpost - it could be reached from just halfway down the entrance channel.
My Outpost 4 design makes use of more land, and is a more generally solid design:
The short range, long range, and defensive turrets are placed in order to work together.
This picture shows the turret ranges. I drew a line to highlight the first Howitzer's range circle. A ship stopping to shoot at that Howitzer outside its range circle will be in range of 3-4 of my Victory Mortars. As a fleet moves further in, it will come into range of the fifth VM and also the Sentinel.
My defensive turrets are placed centrally to cover the maximum number of turrets, and are not exposed to early fire.
The bombard range is fairly short, but will improve to the forward Cerberus turret once I add Enhanced Propulsion:
Flak turrets have better range - this flak can cover all of my short range turrets, and even two more on the center island.
You can also see I used a guard fleet - since I have advanced through the early game so quickly, I haven't had time to build a decent guard fleet, which should consist of heavily armored ships with long range weapons. The longships really show where you COULD put guard ships in this base design. Mortars would work best, since you probably don't have good enough specials at Level 30 to let Missiles match the range of Mortars. Mortars will also add to the volume of shells being fired, which will help overwhelm any anti-mortar defenses that the attackers may carry.
So let's see how this base works in action:
Chrissy had taken some damage prepping the other side of my base - a Thud Battlecruiser did that to her lead ship. She makes two mistakes going in - one is that she doesn't take the time at the outset to stack her fleet up (press up arrow to select all ships, then click a spot). The other is that she presses ahead into the short range turrets. You can see this at 1:18, where the lead ship stops outside the howitzer range, and it looks like she is waiting to stack up. But she realizes she is already being fired at by the Victory Mortars, so she presses ahead. Eventually you can see the mortar fire take out her trailing ships (starting at 1:33). When spread out like that, the mortars that fire on the lead ship will tend to hit the ones in the rear, even if you are moving. After that she keeps going, and the Sentinel and the Cerberus finish her off.
I hope this helps to introduce a little bit about base defense for the new players. Watch your playbacks, look for what worked and what didn't, and make adjustments.