It was the premise behind his first hit, the military courtroom film A Few Good Men. And it was also the premise behind his critically acclaimed but shortlived series Sports Night, where the hermetic world was the studio of a television sports programme.
So it comes as no surprise, perhaps, that his latest venture follows much the same model. Sorkin is among a handful of American television writers distinctive enough to be instantly recognisable in everything he does.
And what he does best is to remove the lid on a pressure-cooker situation - be it in politics, broadcasting, the law or any other field of endeavour - and explore the machinations and behind-the-scenes schemings that inform the smooth public façade of the endeavour.
The 44-year-old writer's attention is now turning to the cut-throat world of late-night television comedy. This week, NBC snapped up the rights to his new series, variously known as Studio 7 or Studio 7 on the Sunset Strip, which the network hopes to air towards the end of next year.
The premise sounds much like the long-running hit Saturday Night Live, with its parade of comics alternating between brilliance and nervous breakdown, its producers veering dangerously between the narcissistic satisfactions of their outsize egos and blank insecurity, and with the sense hanging over all of them that no matter what they do they are somehow selling out. Whatever it is, or turns out to be, America's television executives are wildly excited about it. After several years of flirtation with unscripted reality television, scripted drama is suddenly trendy again, witness the success of new shows as eclectic as the suburban melodrama Desperate Housewives, the plane crash survivor saga Lost, and the dirty, hard-drinking, foul-mouthed western series Deadwood. In that context, a new series from golden-boy Sorkin could not be more timely.
Entertainment press reports say the bidding on Studio 7 was intense, and the outcome was a promise by NBC to pay what may well be a record figure for an untested series. The network has committed to 13 episodes at almost $2m per episode, the kind of money usually laid out for established hits in their third or fourth year.
It is not clear whether NBC and its rivals loved the idea, or merely loved the idea of Sorkin working again. The West Wing has been a critical success, a cultural touchstone and a reliable money-spinner since its debut in the twilight of the Clinton administration in 1999. The show came under fire for being a liberal Democrats' wish-fulfillment fantasy, especially after the radical rightward turn taken by the United States in the wake of the 11 September attacks, but it has never lost its audience.
Instead, it has moved partly with the times, as the fictional Bartlet administration struggles through serious second-term blues. Currently, the show centres on an appropriately red-blooded Republican Party primary season in anticipation of a new presidential election.
If The West Wing has proved uncomfortable to conservatives, and to hard-bitten real-world Democrats, one wonders what television executives will make of Studio 7. A script of the pilot episode seen by the Los Angeles Times and Variety, shows that Sorkin appears to have fed off his experience of the executive suits at NBC and used it to shape characters with more than a few traits in common with real-life counterparts.
Just as West Wing was occasionally used as a vehicle for Sorkin to comment, at least obliquely, on the real political world, it seems Studio 7 contains more than a little criticism of the vulgarisation of small-screen entertainment.
In episode one, the comedy show's executive producer melts down on camera - a bit like Peter Finch's newsreader Howard Beale in the 1970s movie Network - and rants: "This show used to be cutting-edge political and social satire, but it's gotten lobotomised by a ... broadcast network hell-bent on doing nothing that might challenge their audience." The producer also lays into programmes that involve "eating worms for money", a clear reference to the NBC gross-out challenge Fear Factor.
The script also contains a very direct reference to the former NBC executive Jamie Tarses, who helped develop such comedy hits as Friends and Mad About You before moving to ABC. (She is now an independent producer.) Sorkin has written an entertainment president character called Jamie McDeere (Tarses spent much of her time at NBC under the married name McDermott), who also happens to have had a guiding hand in Friends and Mad About You.
Sorkin has never made a secret of his distaste for network and studio executives. When he was based at ABC's Los Angeles offices during the making of Sports Night, he once joked that if an executive building being constructed next to his offices was completed during the lifetime of the show, he and his crew would have to move to New York.
In one of the latter episodes in the series, Sorkin had one of his presenter characters explode to the higher-ups: "Just because we didn't execute all the network's suggestions doesn't mean we weren't listening; it just means we didn't agree. You didn't expect me to substitute your judgement for mine, did you?"
It was perhaps no coincidence that Sorkin had a public falling-out with ABC over the network's decision to lay a laugh track on Sports Night. He told the New Yorker at the time he felt as if "I've put on an Armani tuxedo, tied my tie, snapped on my cuff links, and the last thing I do before I leave the house is spray Cheez Whiz all over myself".
Such feuding and snarky asides may be inevitable in television shows premised on behind-the scenes machinations and gossip. On the other hand, network suits are than likely to be fine with the jibes as long as the show itself is going well.
NBC has had its problems with Sorkin, but they have been much less about his outspoken views on politics and the media than they have been about his drug use. In 2001, a crack pipe he was carrying was picked up by an X-ray machine at a Los Angeles airport, along with cocaine and marijuana, and Sorkin ended up in rehab for the second time in six years. (The episode also ended his marriage.)
Sorkin has thrown considerable energy into staying clean since then, but he is also the first to admit that the drugs fit all too cosily into his distinctly manic personality. He is famous in the television industry for personally scripting just about every word of the shows he puts out. When he was responsible for West Wing and Sports Night, that meant an insane schedule of round-the-clock writing, seven days a week. Something was bound to give, sooner or later.
And Sorkin's experience, from the start of his career, has been that writing and drugs deliver similar sorts of highs. The danger has always been that when the writing stops, at the end of a project, say, drugs can kick in.
When Sorkin moved to Los Angeles in 1993, to write the script of the film The American President (the kernel from which The West Wing sprouted), he smoked crack regularly. "That is why it took me three years to write the script," he said later.
His girlfriend at the time, an entertainment lawyer called Julia Bingham, got him into rehab and cleaned him up. The couple married and had a daughter, before Sorkin's workaholic habits and relapse into drugs put them on the skids. They are now divorced.
The disasters of Sorkin's personal life have never interfered with the quality of his work, only - occasionally - with the timeliness of its delivery. Nobody, in fact, could accuse Sorkin of being anything other than slick and professional. The New York Times once wrote of The West Wing that the show was "a tour de force of Hollywood professionalism. Every piece of dialogue is spit-polished within an inch of its life".
That is a delicate way of phrasing the most common criticism heard of Sorkin's work, especially among actors, that while his dialogue is smart and snappy and rattles along at a cracking pace, it doesn't tend to vary an awful lot from character to character. Everyone in a Sorkin drama speaks in exactly the same way.
It helps to understand Sorkin's peculiarly obsessive personality. Before his marriage, and after it, he has not shown interest in having a house to call his own, preferring an anonymous - if well-appointed - room in the Four Seasons Hotel in Beverly Hills.
Since his divorce, he has said he looked at houses and known he could afford them, but he could not bring himself to escape the comfortable sameness of his surroundings at the Four Seasons. His idea of a break from the tension is to fly, by himself, to Las Vegas for a night and gamble on the $50 blackjack tables. This is a man who spends an awful lot of time in his own company.
There are, of course, no guarantees of Studio 7's success. There is already a backstory that could yet prove troublesome, a second, entirely unconnected NBC series about the behind-the-scenes life of a comedy show much like Saturday Night Live.
This was developed by the comedian Tina Fey, a Saturday Night Live regular, and backed by the show's legendary executive producer, Lorne Michaels. Mr Michaels, an NBC fixture for 30 years, has indicated his displeasure at the Studio 7 deal. Ms Fey has just had a baby, so is temporarily out of the picture.
This is, of course, the bruising, unpleasant, personality-driven, way the entertainment business has always operated. It sounds, not entirely coincidentally, like the premise for an episode of an Aaron Sorkin series.