Why Booming Blade may be beneficial for typical "melee" classes, too
It seems to me that one can classify the possibilities, how to use Booming Blade effectively within combat, into two categories. The first type regards the ways to make use of the damage that takes/would take effect when the enemy willingly moves and multiple approaches have been discussed within other answers on this site. Therefore, I will focus on the second type: Ways and situations in which one can take advantage of the on-hit additional damage that Booming Blade deals starting from level 5:
At 5th level, the melee attack deals an extra 1d8 thunder damage to the target, and the damage the target takes for moving increases to 2d8. Both damage rolls increase by 1d8 at 11th level and 17th level. (XGE/SCAG, emphasis mine)
As it has already been noted, this improves melee attacks for primary spellcaster classes such as Sorcerer and Wizard. However, with one of these classes you probably want to avoid getting into melee range anyway and this limits the use of Booming Blade. So how do we use the Booming Blade on-hit effect effectively as a Barbarian, Fighter, Monk, Paladin, Ranger, Warlock, etc.?1
Restricting effectiveness: Booming Blade vs. Extra Attack
Booming Blade clearly has no synergy with Extra Attack: On the one hand, using Extra Attack (e.g., from the Barbarian, Fighter, Monk, Paladin or Ranger class) requires to take the Attack action first (and the same holds for the Thirsting Blade Invocation from the Warlock). On the other hand, to use Booming Blade one takes the Cast a Spell action and then does a melee weapon attack (not an Attack action) within this action.2 So, for an action you have to choose one or the other, but not both. However, even the aforementioned classes can benefit from using Booming Blade - if they can anyhow get access to the spell - and here are ways that came to my mind:
Booming Blade helps keeping up with damage when Multiclassing
Features such as Extra Attack, Thirsting Blade or Improved Divine Smite come at a level (typically 5 or 11) that a character has in the respective class and they increase the damage dealt starting at these levels. Similarly, the damage of Booming Blade increases at levels 5 and 11, but these levels refer to the character level, i.e., the sum of levels that the character has in each of its classes. This does not make a difference, say, for a Paladin of level 5. But when multiclassing, this may make a world of difference!
Say, you're Warlock 3/Bard 2 or Paladin 3/Sorcerer 2. Then you cannot use the Warlock's Thirsting Blade or the Paladin's Extra Attack at least for 2 level-ups, while Booming Blade already does the 1d8 on-hit thunder damage in addition to your usual weapon attack damage. This difference becomes even larger the more you multiclass and allows you to benefit from low-level class features of multiple classes (in particular of those classes that are presumed to be front-loaded) while still keeping up with melee attack damage.
Booming Blade can do better mean damage at high levels (11+)
Excluding the Fighter, all (sub-)classes only get one use of Extra Attack within an Attack action, so assuming all attacks hit, the damage dealt during an action is twice the weapon's damage. On the other hand, Booming Blade deals the damage of one weapon attack plus 2d8/3d8 thunder damage (levels 11-16/levels 17-20) on a hit. So whenever this 2d8/3d8 is more damage than one weapon attack, the mean damage one does is better with Booming Blade.3
Say, you're level 17 (not Fighter nor Paladin) with the Extra Attack feature (or the Thirsting Blade Invocation), wielding a 1d8 magical (+2) weapon using a +5 damage (e.g., strength) modifier. Then (with a 5% crit chance) taking the Attack action as well as Extra Attack does 2*11.725=23.45 average damage (assuming a hit), while a hit with Booming Blade (including the chance to crit, but excluding the secondary effect!) does 25,9 average damage. On levels 11-16, however, this difference is less significant and probably even negative, depending on your damage (and crit) modifiers as well as your weapon.
Booming Blade increases the damage of opportunity attacks by using the Warcaster feat
If an enemy provokes an opportunity attack, you can use your reaction to make one melee attack against that enemy. Note that you don't take the Attack action, so Extra Attack does not apply to an opportunity attack. However, if you have the Warcaster feat, instead of making the usual melee opportunity attack, you can cast Booming Blade at that enemy using your reaction. Not only does this hinder the enemies movement by threatening the secondary damage of Booming Blade, but (as a character of level 5-10/11-16/17-20 and on a hit) this attack does 1d8/2d8/3d thunder damage in addition to the usual melee attack damage. That thunder damage is straight on top!
Of course, the Warcaster feat is a costly investment, but if you can also benefit from its other advantages, it may be worth it.
Booming Blade adds a different damage type to your punch
Quite a few enemies have resistances, in particular against bludgeoning/piercing/slashing damage. So it can be very beneficial to circumvent these resistances by using the thunder damage of Booming Blade (a damage type seldom resisted throughout the Monster Manual).
Booming Blade works well with Smites/Crit-Fishing
Suppose you're a character that wants to add damage dice on a critical hit. You could be a Warlock who uses Eldrich Smite, a Paladin using Divine Smite or a College of Whispers-Bard using Words of Terror. In each of these cases, adding a damage dice comes with a fixed cost (e.g., the use of a spellslot or of Bardic Inspiration), while the benefit is doubled on a crit as each damage dice is rolled twice. Now if your chance of scoring a critical hit is low, it is probably beneficial to attack multiple times (using the Attack action and Extra Attack) to increase your chance to hit critically at least once (and then add those juicy additional dice). However, if your chance to crit is high enough to deplete your resources (spellslots, etc.) over the course of one day even by attacking only once per turn, then using Booming Blade clearly is beneficial as the on-hit damage of Booming Blade (1d8/2d8/3d8 at levels 5-10/11-16/17-20) is doubled on these crits. Unfortunately, there are many variables that determe the point from which on it is advantageous to use Booming Blade instead of the Attack action + Extra Attack (even more so since spellslots or Bardic Inspiration may be used for other purposes). Thus, one probably has to intuitively estimate within play whether to use Booming Blade or a normal Attack action + Extra Attack.
1 If a class does not provide Booming Blade as a cantrip (as it holds for most "melee" classes), one can access Booming Blade through the Magic Initiate Feat, by being a High Elf or by dipping into Sorcerer, Warlock, Wizard or Arcana Cleric.
2 A notable exception to not being able to use BB with Extra Attack is the Bladesinger, which can replace one of the attacks granted by taking the attack action and using Extra Attack by casting a cantrip. So Bladesingers can attack using the attack action, make one of these attacks by casting BB and then make the other attack normally. Also, since they took the attack action, they even qualify for off-hand attacks if they're dual wielding weapons.
Similar to the Bladesinger, an Eldritch Knight of Level 7+ can (instead of using Extra Attack) cast BB as their action and then make an additional attack with their bonus action, for a total of two attacks plus the benefits of BB on one of them - compared to only two attacks if they had used the attack action (and if they aren't Fighter 11 yet). That is, of course, if they have their bonus action available.
3If we're analysing the damage of a single-class Paladin, then one would need to compare 2d8/3d8 thunder damage with the damage from one weapon attack including the extra 1d8 radiant damage that Improved Divine Smite provides.