1. Build all the barracks you can. You want your army to constantly be reinforced, so that there is as little downtime as possible between attacks. With four barracks, you can have a large portion of your army restored by the time your first attack finishes.
2. Build a good mix of units. Opinions vary wildly about the best setup for your farming army, but generally you're going to want some combination of Goblins, Archers, Barbarians, Giants, and Wall breakers. The most common configuration is Barbarians and Archers (widely called "Barch") but you can sprinkle in wall breakers and giants if needed.
Giants are expensive, so only worry about adding a few.
Early levels should focus on Barbarian-heavy armies.
Later levels generally call for more Goblins than anything else, though some strategies call for more Archers.
As you increase your Town Hall Level, your maximum army size will increase, allowing for a greater unit variety, as well as a greater spell variety.
3. Consider using Minions as well. Minions train very fast and don't cost very much, so they are great for quickly bolstering your forces. They can be very useful if you are trying to farm as quickly as possible, as you can quickly replenish your troops between battles. It becomes easier to use Minions more frequently at Town Hall 8 because you will have two Dark Elixir drills and be able to produce more Dark Elixir on a daily basis.
4. Know your army cost. When determining whether or not to attack a town, it will be helpful to know how much your army costs. Calculate the total costs of your attacking army, and then find 1/3 of that value (this will help you determine when it's time to retreat). You don't want your loot to be worth less than the troops you are losing.
Link Source : http://www.wikihow.com/Farm-in-Clash-of-Clans