Well, others have already talked about the power of the classes, and I can't really add anything to their points, so I'll just give my personal preference:
1) Mage. I mean, my nickname makes this pretty obvious. Starting off the game as a pure mage can be pretty hard, but there are still some reliable ways of getting your first weapon, such as mining or fishing for oasis crates. Mana isn't really as much of a problem as everyone makes it out to be, since the game gives you more than enough options to regenerate it quickly. This class may seem pretty boring in the begining, however it seriously starts ramping up in terms of fun near the start of hardmode: walls of cursed flames? Sure. Damaging rain clouds? Of course! Raining meteors? Why is that even a question, absolutely! And it only gets better from there: Launching bouncing and rolling boulders, summoning homing bats, firing huge freakin' lasers - what's not to love? And that's not even mentioning the supportive capabilities - not only in multiplayer though; there are plenty of utility options you might wanna keep in your hotbar even in singleplayer.
2) Melee. This class might be bad, but it can be extremely fun, and it has a ton of different weapons (even if you don't count the 50 different ore/wood sword variants). Like mage, this class stars out kinda slow in terms of variety, but it really starts to pick up the pace later on in the game, and once it reaches it's peak... Hohoho, boy, does it get good!
3) Summoner. This would've been number 2... But it has so much wasted potential. The idea of having your own squad of little helpers is so amazing, but the execution of this idea is extremely lacking. Almost every minion feels the same, with the only one I find truly unique and interesting being the desert tiger staff, due to it's unique pounce attack. Other than that, most of the variety comes from whips and sentries (which are criminally underrated for something that's pretty much free damage). It could have so much potential with things such as minions that heal the player and their allies in multiplayer, grant various buffs to other minions, spawn smaller backup minions... But sadly, we have what we have.
4) Ranged. I mean... It is the strongest in terms of power, but it is soooo damn boring. Not only in concept - most of the weapons do pretty much the same thing. Many people defend it with the argument that it's variety comes from the different kinds of ammo, but that honestly only doesn't really help when most ammunition types just add simple effects such as explosions, homing, faster speed etc. There are some unique ones, such as holy arrows which summon stars, but... Not enough to make the class interesting in my eyes.