Fiction
Ergodic literature
literature
The middle ages
Modern literature
Literary criticism
Literary magazine
Comparative literature
Electronic literature
Digital poetry
Interactive fiction
Commercial era
Cybertext
Western
Science
Paranoid
Mystery
Horror
Historical
Fantasy
Fan fiction
Detective
Genre fiction
 
 

Detective fiction is a branch of crime fiction in which a detective (or detectives), either professional or amateur, investigates a crime, often murder. Detective fiction is a popular form of both mystery fiction and hardboiled crime fiction.

Commonly in detective fiction, the investigator has some source of income other than detective work and some undesirable eccentricities or striking characteristics. He or she frequently has a less able assistant (or foil) who acts as an audience surrogate for the explanation of the mystery at the end of the story.
Early Arabic detective fiction

The earliest known example of a detective story was "The Three Apples", one of the tales narrated by Scheherazade in the One Thousand and One Nights (Arabian Nights). In this tale, a fisherman discovers a heavy locked chest along the Tigris river and he sells it to the Abbasid Caliph, Harun al-Rashid, who then has the chest broken open only to find inside it the dead body of a young woman who was cut into pieces. Harun orders his vizier, Ja'far ibn Yahya, to solve the crime and find the murdererer within three days, or be executed if he fails his assignment. Suspense is generated through multiple plot twists that occur as the story progesses. This may thus be considered an archetype for detective fiction.

The main difference between Ja'far in "The Three Apples" and later fictional detectives such as Sherlock Holmes and Hercule Poirot, however, is that Ja'far has no actual desire to solve the case. The whodunit mystery is solved by the murderer himself confessing his crime, which in turn leads to another assignment in which Ja'far has to find the culprit who instigated the murder within three days or else be executed. Ja'far again fails to find the culprit before the deadline, but due to his chance discovery of a key item, he eventually manages to solve the case through reasoning, in order to prevent his own execution.

Early Chinese detective fiction

Another strand of detective fiction is the Ming Dynasty Chinese detective fiction such as Bao Gong An (Chinese:包公案) and the 18th century novel Di Gong An. The latter was translated into English as Dee Goong An (Celebrated Cases of Judge Dee) by Dutch sinologist Robert Van Gulik, who then used the style and characters to write an original Judge Dee series.

The hero of these novels is typically a traditional judge or similar official based on historical personages such as Judge Bao (Bao Qingtian) or Judge Dee (Di Renjie). Although the historical characters may have lived in an earlier period (such as the Song or Tang dynasty) the novels are often set in the later Ming or Manchu period.

These novels differ from the Western tradition in several points as described by van Gulik:

- the detective is the local magistrate who is usually involved in several unrelated cases simultaneously;
- the criminal is introduced at the very start of the story and his crime and reasons are carefully explained, thus constituting an inverted detective story rather than a "puzzle";
- the stories have a supernatural element with ghosts telling people about their death and even accusing the criminal;
- the stories were filled with digressions into philosophy, the complete texts of official documents, and much more, making for very long books;
- the novels tended to have a huge cast of characters, typically in the hundreds, all described as to their relation to the various main actors in the story;

Van Gulik chose Di Gong An to translate because it was in his view closer to the Western tradition and more likely to appeal to non-Chinese readers.
Many English and some North American readers, in what became known as the Golden Age of Detective Fiction between the wars, generally preferred a type of detective story in which an outsider -- sometimes a salaried investigator or a police officer, but often a gifted amateur -- investigates a murder committed in a closed environment by one of a limited number of suspects. The most widespread subgenre of the detective novel became the whodunit (or whodunnit), where great ingenuity may be exercised in narrating the events of the crime, usually a homicide, and of the subsequent investigation in such a manner as to conceal the identity of the criminal from the reader until the end of the book, when the method and culprit are revealed. "The golden age of detective fiction began with high-class amateur detectives sniffing out murderers lurking in rose gardens, down country lanes, and in picturesque villages. Many conventions of the detective-fiction genre evolved in this era, as numerous writers -- from populist entertainers to respected poets -- tried their hands at mystery stories."

The four original Queens of Crime were Agatha Christie, Dorothy L. Sayers, Ngaio Marsh and Margery Allingham. Apart from Ngaio Marsh (New Zealand) they were all female British writers; perhaps Josephine Tey could be added.

The most popular writer of the Golden Age whodunnit, and one of the most popular writers of all time, was Agatha Christie, who produced a long series of books featuring her detectives Hercule Poirot and Miss Marple, amongst others, and usually including a complex puzzle for the baffled and misdirected reader to try and unravel. Also popular were the stories featuring Dorothy L. Sayers's Lord Peter Wimsey and S. S. Van Dine's Philo Vance.

The "puzzle" approach was carried even further into ingenious and seemingly impossible plots by John Dickson Carr—also writing as Carter Dickson—who is regarded as the master of the "locked room mystery" and Cecil Street, who also wrote as John Rhode, whose detective Dr. Priestley specialised in elaborate technical devices, while in the US the whodunnit was adopted and extended by Rex Stout and Ellery Queen, among others. The emphasis on formal "rules" during the Golden Age (as codified in 1929 by Ronald Knox) produced a variety of reactions. Most writers were content to follow the rules slavishly, some flouted some or all of the conventions, and some exploited the conventions with genius to produce new and startling results.