Walls act as a shield that will protect your buildings from invading enemy troops, especially melee units. They are also the most expensive buildings to max out, considering that you are upgrading all the Wall units and not just one. Thus, the level of the player's wall may also be a factor in determining how active a player may be.
Gates can be placed between Walls to allow Roads and defenders to pass through your Walls, but are often a weak spot. In general, you should aim to upgrate your Gates to a higher level as they have less hitpoints than Walls at the same level.
You can start using Gold or Food to upgrade Walls at level 9 instead of just Gold prior.
Don't just encircle your whole base in Walls or your enemy will only need to go through one layer of Walls to get at everything. Instead, only protect what is most valuable(along with defensive buildings) and have multiple layers of Walls.