Shakespeare in Love write something "a little more cheerful next time, for Twelfth Night". Viola and Shakespeare say their goodbyes, and he vows to immortalise her, as he imagines the beginning of "Twelfth Night", in character as a castaway disguised as a man after a voyage to a strange land. The original idea for "Shakespeare in Love" was suggested to screenwriter Marc Norman in the late 1980s by his son Zachary. Norman wrote a draft screenplay which he presented to director Edward Zwick, which attracted Julia Roberts, who agreed to play Viola. However, Zwick disliked Norman's screenplay and hired the playwright Tom Stoppard
The Shakespeare Code makes reference to the many debates about Shakespeare's sexuality. Shakespeare flirts with Martha multiple times during the episode, and ultimately composes Sonnet 18 for her, calling her his "Dark Lady". This is a reference to the enigmatic female character in Shakespeare's Sonnets, although Sonnet 18 is in fact one of those addressed to a male character, the Fair Youth. Shakespeare subsequently flirts with the Doctor as well, at which the Doctor observes, "Fifty-seven academics just punched the air," a reference to the debates on this subject. There is a running joke throughout the episode in which the Doctor creates an