Tony Vargas
Legend
Just, traditionally, the Big 4. Fighter, Cleric, Magic-user, Thief.So, if we use the analogy of D&D combat as a team sport, what do you think are the key positions? How important is it that team members stay in their lane? Is the position distribution rigid, or is there lots of wiggle room? Does it change from edition to edition, or between tiers of play?
Fighter - stand in front, blocking a doorway or shoulder-to-shoulder, in a 10' corridor and trade damage.
Cleric - turn undead and heal those fighters so they stay ahead in the damage trading
Thief - scout ahead and die in ambushes you don't detect, listen at doors and get your brain eaten by an Ear Seeker, get killed by traps (or to break things up a bit, mimics) when you fail to find or disarm them.
Magic-User - cast Sleep at first level if you're lucky enough to have it, try not to get killed by a house cat at 1st level. After that, increasingly solve every problem the party encounters, as you get a greater variety of spells and more of them per day.
Sub-classes generally plug into their main class, an Assassin (or even Monk) can nominally do some Thief functions. A Paladin or Ranger fights about as well as a fighter in addition to their other perks. A Druid has animal friends and can help out in the woods instead of turn undead and starts healing at 2nd level. An Illusionist can get creative to do most of what a magic-user could if the DM goes with it.
Out of combat, a Cleric might appeal to authority as a religious leader or cast a helpful spells, the magic-user might have a spell for any situation on the list, but does he know and did he memorize it, the Thief had his specific 'special' abilities (picking pockets having an obvious, if annoying out of dungeon application) & could become a 'guildmaster' at name level, the Fighter could bend bars/lift gates & could become a 'Lord' at name level. Mostly, back in the day, out of combat you spoke in character or declared actions in detail and tried to do both in ways that'd get favorable results from your DM. 5e successfully evokes the classic game with that last bit, too.

Over time (not a lot of time, the second half of the 70s), the Big 4 Classes became expected roles and DMs could run their games to lean into that or not. Over more time, computer and eventually on-line games, from Zork to WoW, took up the idea and implemented them more systematically - since, y'know, a chip can't muddle it's way through vague ideas the way a meat brain can.
3e changed things up. Made the Rogue to be a peak damage dealer, while making it's abilities no longer 'special,' but skills (just more of 'em). Doubled-down on the fighter being the front-line, vaguely added anchoring the party, and being the natural 'leader' - all sans mechanical support. Gave the Cleric spontaneous casting to heal, and WoCLW for out of combat healing, and, just generally, created CoDzilla. And making it possible to work around the various restrictions that had traditionally slowed the wizard's domination of the game.
4e formalized roles for combat, and added structure for non-combat challenges, which could have been big steps forward, if it hadn't also introduced intolerable anti-D&Disms like class balance.
5e re-established class imbalance, and really went overboard slashing, burning, and salting the earth around roles. Arguably, non-casters were simply strikers (they certainly weren't anything else), the defender role was back to being woefully undersupported, and even the Clerics traditional bandaid healing burden had been undercut by HD, overnight healing, and in-combat healing being, well, bad. So, while there's still differentiation - martials can't do much but DPR, which everyone can do one way or others, casters can spontaneously cast their best spell for the situation, and while wizards have the most/best/greatest-variety of spells they still can't heal (tho, healing is bad) differentiating them in a traditional manner. Roles are nominally dead in 5e, but classes still fall into broad strokes by contribution, Casters can do anything (including heal, but keep that to a bare minimum), Half-casters can do DPR and whatever else their spell lists & restricted spell levels allow, Rogues do DPR (to the extent the DM cooperates) and (like Bards) get Expertise to be better at some skills, and other martials just do DPR. It's less roles than it is a hierarchy.