Doctrine of substantial performance is a legal principle which says that if a good faith attempt is made to perform the requirements of the agreement even if it does not precisely meet the terms of the agreement or statutory requirements, the performance will still be considered complete if the essential purpose is accomplished. However this is subject to claim of damages for shortfall. A defendant when sued for non performance cannot avoid paying damages by showing he substantially performed or came near to performing the requirements of the contract.
Example of case law in California discussing substantial performance.
The doctrine of substantial performance has been recognized in California since at least 1921, when the California Supreme Court decided the landmark case of Thomas Haverty Co. v. Jones (1921) 185 Cal. 285, 288–289 [197 P. 105] in which the court stated: “The general rule on the subject of [contractual] performance is that ‘Where a person agrees to do a thing for another for a specified sum of money to be paid on full performance, he is not entitled to any part of the sum until he has himself done the thing he agreed to do, unless full performance has been excused, prevented or delayed by the act of the other party, or by operation of law, or by the act of God or the public enemy.’ It is settled, especially in the case of building contracts where the owner has taken possession of the building and is enjoying the fruits of the contractor's work in the performance of the contract, that if there has been a substantial performance thereof by the contractor in good faith, where the failure to make full performance can be compensated in damages to be deducted from the price or allowed as a counterclaim, and the omissions and deviations were not willful or fraudulent and do not substantially affect the usefulness of the building for the purposes for which it was intended, the contractor may, in an action upon the contract, recover the amount unpaid of his contract price, less the amount as damages for the failure in strict performance. [Murray's Iron Works, Inc. v. Boyce, 158 Cal. App. 4th 1279, 1292 (Cal. Ct. App. 2008)]
The doctrine of substantial performance/compliance applies only to bilateral contracts. Courts have held the substantial compliance doctrine is inapplicable when statutory notice requirements, including the time within which notice must be given, are not met.[People v. Mohammed, 162 Cal. App. 4th 920 (Cal. Ct. App. 2008)]