 " Code of Honor " is the fourth episode of the American science fiction television series Star Trek : The Next Generation , originally aired on October 12 , 1987 , in broadcast syndication . The episode was written by Katharyn Powers and Michael Baron , and was directed by Russ Mayberry . Mayberry was replaced part way through the filming of the episode with first assistant director Les Landau . 
