August is probably the busiest time in Barcelona; at the same time about 10% of shops and restaurants can be found closed from mid-August to early September, when the owners go on vacations. You'll find cheap accommodation and a much quieter city as a vast majority of Spaniards go on vacation in August. Business is low, people from Barcelona tend to be on vacation, hotels, that remain open but don't have their business customers tend to lower prices and make offers. However there will still be plenty of tourists. Barcelona has decent enough beaches but the locals will really appreciate it if visitors do not consider it a beach resort don't wear beachwear when when visiting churches, etc...
Barcelona city is great off-season and is a lovely city even in winter months of January and February as long as you don't mind the possibility of rain. Given the high humidity, 19-23 degrees Celsius is considered comfortable weather. Anything warmer than this can feel too hot.