They don't, and they can't. They don't even know that they can't.
The mathematics mindset and the programming mindset could not be more different.
Writing a mathematical proof is similar to writing everything from scratch each time.
However, and this is a serious affirmation: learning to write mathematical proofs will make anyone a much better developer, because of the changes in the mental processes involved in the creation and expression of ideas.
What? Every mathematical proof is built on top of other proofs, especially when you look at research that is happening today.
Mathematics and Computer Science mindsets are closer than most other pairs of academic streams. There’s a reason why so many universities have their CS departments under their Math Departments.
These days it’s more like math departments under CS departments (which are seen as highly important, as a CS degree is more fashionable than a maths one and mathematics is seen as an abstruse academic pursuit in the worst sense and a financial sink rather than a source).
It’s true that (almost) every proof is built on top of others, but this is not the way mathematicians learn their craft — you do have to start at the bottom.
The average programmer, on the other hand, has never been anywhere near the hardware or, these days, the software near the bottom.
In mathematical training you learn how to prove the other proofs yourself.
It's not an #include <proof> kind of thing, someone else wrote the proof already and you should believe the proof is right. No, you need to understand the other proofs and be able to write them yourself.
I agree with you the mindsets should be closer, and in an ideal sense, CS is a part of Mathematics.
I mention this strong contrast, because I studied pure mathematics and I studied software engineering, and the mindsets are very different. Engineering is about results with a focus on not reinventing the wheel.
The mathematics mindset and the programming mindset could not be more different.
Writing a mathematical proof is similar to writing everything from scratch each time.
However, and this is a serious affirmation: learning to write mathematical proofs will make anyone a much better developer, because of the changes in the mental processes involved in the creation and expression of ideas.