The links below will take you to charts for buying buildings that give you a bonus to defense.  The different types of buildings provide different levels of bonus and each one costs incrementally more and more. So it can be difficult to make sure you are building them in the most cost-effective manner. 

These charts provide examples of how to build "equally" so you aren't overpaying for one type of building rather than building another.  But the numbers from column to column are pretty far apart, so you should become accustomed to calculating "building equality" on your own.  To do this, simply divide the cost of the next building by it's bonus.  The lower the number the better the value.  Whichever building (of the same type) provides the best value is the one you should buy next.

The real value to these charts is long-range planning.  If, for example, you want to reach a defensive bonus of 20,000 by level 50, the charts will tell you how much the total of those buildings will cost (1.31 Billion).  It will also tell you exactly how many of each type of building to buy.  Once you have your defensive bonus up to 20,000, the charts will also tell you how much more it will cost to get to 25,000 or 30,000 and so on.

Because more buildings become available as you level up in the game, the build costs and equalities work differently based on the buildings available to you at your current level.  So there are different groups of charts based on what buildings are available to you.  Each group has three charts with eight columns per chart for 24 different defensive bonus levels.  Be aware that the jump from column to column may change as you move from one chart to the next in a given level.

Once you reach a level in the game where a new building comes available, you should first look at your existing buildings 'equality' and determine how many of the new buildings it will take to get it caught up with the others.  For example, when you reach level 120 Anti-Aircraft Bases become available. If your defensive bonus is 25,000 then you have about 2100 Walls, 500 Fotresses, 225 Castles, 65 Bunkers and 18 Coastal Cannons.  This is very close to the 30,000 building levels on the Anti-Aircraft Base charts because you should now buy 15 Anti-Aircraft Bases (for a bonus of 5,250) before buying any other defense buildings.