The benefit of upgrading Walls is one of the hottest topics in Clash of Clans. New players always find it hard to answer this question. Walls are the most popular object in Clash of Clans with total 250 peaces when you are at Town Hall 10. From Town Hall 8, it is quite expensive to upgrade a peace of wall to level 8, that’s why players always think carefully before upgrading their walls.
Attackers always bring just couples of Wall Breakers into the battle (usually <10 troops) because they take a quite long time to train and can’t do damage on buildings. If your base layout has plenty of compartments like Trion Farming Base for Town Hall 7, it is really hard for attackers to get them all with normal farming compositions (Barch, B.A.M, Giant-Healer,…). They just can use Wall Breakers for breaking 2-3 compartments of the base.
Ranged troops like Archers or Wizards can attack other the walls but their HP is quite low, your Mortars and Wizards Towers can wipe them out with just a few seconds. The high HP troops for farming like Barbarians and Giants are melee and it takes time to break the walls with their hands. Because higher level walls have higher HP so those troops will need more time to take your walls down. While they are working with those walls hardly, your defensive buildings will have time take them out.
By the way, because of the loot system, it is much harder to find loot and farm when you are at higher Town Hall levels so I strongly recommend you max out your walls from Town Hall 8 (read more at How much loot you can steal). You can max out your walls at Town Hall 6 and upgrade them later when you are at Town Hall 8 because the attackers need to use 2 Wall Breakers to destroy level 6,7 and 8 walls. You can read more at: Walls Guide.
But upgrading defensive buildings is more important than walls because it takes a lot of more time. The best time to upgrade your walls is when you are at the late stage of the current TH level. Upgrade at least 1/2 your walls to maximum level and you can upgrade the rest when your Town Hall is being upgraded. One more thing: Higher walls are more beautiful.