This is how to defend your house from hostile mobs in minecraft pocket edition. Other players can get into your house.
Step 1: Holes
Get you house and do this.
The only mob that is hostile that can go across the "bridge" diagonally is the zombie pigmen
Step 2: Cacti and Water 1
Place the cacti as shown and put the water source in those spots so the mobs will eventually swim into the cactus.
Step 3: Cacti and Water 2
Dig the hole as shown.
Do the same with this as the previous step but put water in any hole.
Step 4: Spider Killing Bonus
A spider can climb up to 17 cactus blocks before falling off and taking fall damage or just getting killed by the cacti.
You can also put sand on your roof and arrange it as shown.
And your done