The flight control software for the Space Shuttle was developed to the most rigorous standards that exist today. They went to enormous lengths to prevent bugs from ever threatening the mission and/or the crew. The towering cost of the software makes it seem unlikely to me that this process is used routinely for scientific space missions.
For scientific satellites and deep space probes, you have a similar problem (although without the lives-at-stake element): you have one chance at making your observations (e.g. planet flyby missions), there are billions of dollars in hardware at stake (flagship missions) and no chance to repair or recover.
Yet the impression I get is that scientific spacecraft are developed mostly by the science team, i.e. scientists, not e.g. specialists in the development of high-availability software.
Is that impression correct?
And what methods are used to reduce the risk of software failure on science missions?
The reason I'm asking specifically about scientific space missions: commercial missions often take advantage of series production so the cost can be spread, and the amount of new functionality on the average commercial mission is small. These missions can also be insured. Scientific space missions tend to be uninsured one-offs.