It may seem surprising but Barcelona is actually quite a walkable city and the fact that a lot of it follows a strict grid pattern makes things somewhat easy. Besides, by walking you will see an awful lot of details you would not otherwise, such as the stunning details of the Modernist buildings in the Eixample.
If you do need to use public transport, then Barcelona has an extensive network of Metro (9 lines), Urban Rail (Rodalies), buses and even funiculars and cable cars. The best way to get around if you’re planning to use public transport frequently during your stay is to buy a Hola! smart-card. It comes in different durations (2,3,4,5 days) and allows unlimited travel on metro, bus, urban railway (within Zone 1), tram, the Montjuïc funicular and the regional rail network (within Zone 1) and also includes travel between the city and the airport. The card can be purchased online and then collected at the machines using the online voucher.