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 and don't wear beachwear when visiting churches, restaurants, etc.
Barcelona is great off-season and is a lovely city even in winter months of January and February as long as the possibility of rain is low. Given the high humidity, 19-23°C is considered comfortable weather, which is normally the temperature between April and June and between late September-November. This is the best time to visit the city. Anything warmer than this can feel too hot