I can't decide if it's more or less ethical to turn down these type of jobs. Even if you are anti-war, by declining such a job you open up space for the next person in line who may not be as talented of a programmer. The weapons will exist either way, but now they'll have an increased chance of having severe bugs because all the best programmers chose less morally ambiguous jobs. Maybe working for a military contractor is how you prevent the world from accidentally being destroyed. Or that's how you help it intentionally get destroyed, I don't know.