Both music and coding have been proven to develop cognitive skills, though in different ways.
According to studies, five distinct areas of the brain are involved in understanding code - attention, language, working memory, and semantic memory retrieval. This means that working through code mainly uses parts of the brain that are normally associated with language processing, memory, and attention.
Researchers have also found evidence that processing music depends on some of the same brain areas used to process language comprehension and memory. Musical training has been found to show greater effectiveness in language comprehension, verbal fluency, memory, second language acquisition and reading abilities. For example, it has been shown that children with musical training perform better at the vocabulary subtest of the Wechsler Intelligence Scale for Children than a matched control group (Schlaug, 2005).
Musicians are generally technically engaged and often encounter a variety of technologies to write, perform and produce their music. Traditional music notation is an abstract medium which certainly requires interpretation and execution similar to that done while coding. Listening to music has been shown to access many different brain functions that play an integral role brain functions such as motor control, memory, language, reading and emotion. One study from Northwestern University found that playing a musical instrument links to greater brain efficiency during problem solving and learning speeds.
While music has not been proven to teach the exact same cognitive skills as coding, many studies have shown that indeed both fields can complement each other, and indeed listening to the right type of music while coding can increase effectiveness, concentration and overall enjoyment in coding.