In Clash of Clans, base layouts sacrificing the Town Hall (and other non-functional structures on defense) in order to better protect storage units are called farming bases. Having a great farming base layout at Town Hall 4 and above will help prevent losing too many resources to enemy attacks. Over time, a good farming base layout will save you millions of resources.
Recommended TH4 Farming Base Layout: Video Guide
Here is a video guide showing the base in action. This will give you a good idea of how the setup works and what level of attacks it is likely to hold off.
Defensive Strategies at Town Hall 4 in CoC by CoCGuides
Town Hall 4 Farming Defense Setup: Screenshot & Discussion
Here is a still picture of the best base layout at Town Hall 4 so you can copy it for yourself:
As you can see, the primary strategy of this base is to protect the Mortar and storage units while placing your two cannons and archer towers on the perimeter of the base. The walls around the cannons and archer towers sticking out makes it difficult for Wall Breakers to break into the center. Of course, you can still get swarmed by larger numbers of Barbarians and Archers.
Note the air defense is sitting on the outside of the base. This happens for two reasons. Firstly, players do not get access to the Healer until TH6. TH6 players rarely attack TH4 players due to the loot penalty. The only air unit at this level is the Balloon, which is rarely used. Sitting on the outside of your walls is actually a useful position, as it draws Giants to it rather than letting the Giants start hammering on your walls.
However, the real reason for keeping the Air Defense tower on the outside of the base is that it takes a full day to upgrade. It does not take more than a few days in the first place to max out a TH4 base, so there is no point in incorporating it inside your base when it is under construction most of the time.
The biggest weakness of this base is just higher level players. A TH5 player with 3 army camps can make mass Archers and Barbarians. Archers can take out your archer towers and cannons from behind their walls, leaving only the mortar. While the Mortar is a great tower, a single Mortar is not going to defend against a swarm of Barbarians and Archers that have been spread out. You will also see TH5 players using mass Giants and Wall Breakers, another tough combo to stop at this level.
The good thing is that TH4 players (or below) will not be able to clear this base nor get access to most of your resources.
What About Trophy Bases?
I am not going to discuss the best trophy base at this level, as protecting your trophies at Town Hall 4 is a meaningless exercise – you simply cannot do it. You barely have any towers at this level; even with a full maxed base, you will get wiped pretty easily by a halfway decent TH5 or above.
At Town Hall 5, players get access to an extra army camp, which will allow them to wipe you out with even an all Barbarian army. Your best bet instead is to try and protect some of your resources. With the base recommended in this section, you can often can lose 80% of your base and still keep over half of your resources.