Breach of Contract
The basic rule is that parties to contracts must perform as specified in the contract unless (1) the parties agree to the change in the contract's terms, or (2) the actions of the party who deviates from the terms of the contract are implicitly accepted ("ratified") by the action or non-action of the other party.
If there is no acceptance of deviation from the terms of the contract, and the deviation is serious enough to make any real difference in the intended result of the contract, then the deviating party is said to have breached the contract. His justified prevention or interference with the performance of the other party is also a breach.
Of course if one party fails more or less entirely to perform the contract, or totally prevents the performance of the contract by the other party, the situation is straightforward. The situation becomes more complex where the argument is over the quality of materials, the timing of work, or something of that sort.
Breach of contract leaves the nonperforming or improperly performing party open to a claim for damages by the other party. The non-breaching party is relieved of his obligations under the contract by the other party's breach.
The aggrieved party, to help support his claim for breach, should have done all the things required of him under the contract up until the time of breach, and must have done nothing to make it impossible or unreasonably difficult for the other party to perform his share. The nonperforming party can be expected to make excuses for his conduct, and he will try to find ways to blame the other party--an excellent argument for performing one's own side of a contract punctiliously and in a manner that leaves a record which others can see.
There are so many possible ways for performance of a contract to give rise to dissatisfaction that the courts have been forced to analyze the matter in much more subtle terms than "breached" or "not breached."
The doctrine of "substantial performance" saves a party who has largely fulfilled his obligations under a contract from suffering major loss merely because he has unintentionally fallen short in some particular which does not affect the essence of the contract.
There has to be a limit to the quibbles of the dissatisfied customer, for example, or the courts would be swamped with trials over precise shades of paint and tiny imperfections in services. A party can unintentionally fall short of perfection, but if he has substantially performed his duties under the contract, he can still sue the other party for payment.
The dissatisfied party, on the other hand, can usually win some adjustment in the amount of payment as compensation for the minor defects in the performance.
Where a party's unintentional failure to perform fully does affect the essence of the contract, he cannot sue the other party "on the contract" in order to be paid. To the extent that his work has benefited the other party, he may recover on the theory of a contract implied by law (quasi-contract), as explained above.