I have found the most wonderful description of the detective character, it's in Raymond Chandler's 1950 essay, "The Simple Art of Murder", where you get the quote "I hold no particular brief for the detective story as the ideal escape. I merely say that all reading for pleasure is escape, whether it be Greek, mathematics, astronomy, Benedetto Croce, or The Diary of the Forgotten Man. To say otherwise is to be an intellectual snob, and a juvenile at the art of living."
In everything that can be called art there is a quality of redemption. It may be pure tragedy, if it is high tragedy, and it may be pity and irony, and it may be the raucous laughter of the strong man. But down these mean streets a man must go who is not himself mean, who is neither tarnished nor afraid. The detective in this kind of story must be such a man. He is the hero, he is everything. He must be a complete man and a common man and yet an unusual man. He must be, to use a rather weathered phrase, a man of honor, by instinct, by inevitability, without thought of it, and certainly without saying it. He must be the best man in his world and a good enough man for any world. I do not care much about his private life; he is neither a eunuch nor a satyr; I think he might seduce a duchess and I am quite sure he would not spoil a virgin; if he is a man of honor in one thing, he is that in all things. He is a relatively poor man, or he would not be a detective at all. He is a common man or he could not go among common people. He has a sense of character, or he would not know his job. He will take no man’s money dishonestly and no man’s insolence without a due and dispassionate revenge. He is a lonely man and his pride is that you will treat him as a proud man or be very sorry you ever saw him. He talks as the man of his age talks, that is, with rude wit, a lively sense of the grotesque, a disgust for sham, and a contempt for pettiness. The story is his adventure in search of a hidden truth, and it would be no adventure if it did not happen to a man fit for adventure. He has a range of awareness that startles you, but it belongs to him by right, because it belongs to the world he lives in.
That's the kind of character I want to create and read.