Just because NASA doesn't sell products or services for money doesn't mean it isn't in the business of making money. It has to, every year, go forth and convince the US government to give it money in the form of a budget. It's the exact same model used by charities. Thus, the same principles of having to meet the demands of your customers apply. Your customers just happen to be different from those receiving your products/services.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?