The rule makers must be clear in the rules they are applying, and must make public the rules they are applying. This is especially true in the domain of contract law, where parties to a contract are effectively self-legislators using contract law to legislate for themselves. Fairness is ex-post. The efficient outcome is what we would expect the parties to have agreed to had they bargained about the matter at issue. So when we impose rules that maximize efficiency, we are really just carrying out the will of the parties.
Contract law uses objective tools to protect subjective interests.
A court is not a disinterested party in the contracting game. It is to serve a public policy in favor of contracting, and it is to act in a way that creates the proper incentives for parties to contract properly, and behave properly as well. Holmes may be right about the morality of contract breaches, but just don't tell anyone.