Different ways a contract is discharged
The law of contract is defined by Justice Yorokamu Bamwine in the Greenboat entertainment ltd v city council of Kampala  as," in law when we talk of a contract we mean an agreement enforceable by the law. For a contract to be valid and legally enforceable ,there must be capacity to contract, intention to contract ,consensus and idem ;valuable consideration ,legality of purpose and sufficient certainty of terms". For a contract to be valid it must have offer, acceptance and consideration. The laws applicable in contractual obligations in Uganda are enshrined in the contract Act.cap.73. 
Discharge of a contract is where by parties to a contract are relieved from contractual obligations .under certain conditions, a contract may be discharged by performance, agreement, frustration, and breach
1) By performance:  When both parties to a contract have both performed their duties and their obligations, then the contract is discharged .The general rule is that performance must be precise and exact .The hardship of this rule is illustrated in Cutter v Powell  , where court held that the widow could not get any payment since Cutter had not completed voyage but had died midway.
In case of performance, it must be complete and must be performed at the time and place agreed upon. Where no time has been specified, it must be completed within a reasonable time and this is illustrated in the case of Panesor v Popat  where court of appeal held that the respondent did not have to accept delivery and explained that in contracts where time is of the essence, it is upon the other party to give notice requiring completion within acceptable time.
However, there may be exceptions to the previous case of Cutter v Powell when a contract is divisible, part performance of divisible contract, non-completion due to fault of defendant, partial performance, and prevention of performance.
Partial performance; however the other party must have a genuine choice whether to accept the partial performance like in the Sumpter v Hedges  where the plaintiff’s claim of quantum meruit failed and he had no choice whether to accept or reject the partial performance.
Substantial performance; Plaintiff can recover amount of money for work done if he can plead on the above doctrine like in the case of Darkin v Lee  where a contract to repair a house was done but when work was done, it did not conform to the contract. In certain aspects, court held that plaintiff was entitled to the payment in subject to a counterclaim or set off for damages by defendant for failure to accurately perform.
Prevention of performance  ; where a party to a contract prevents the other party from carrying out his obligations under the contract because of some act or omission, then the strict rule cannot apply. Like in Planche v Colburn  .Where court held that author was entitled to recover half his fee for his wasted work on a quantum meruit  basis.
Tender of performance; it occurs where a party has offered to complete his obligations under contract but the other party has unreasonably refused to accept performance like illustrated in Startup v MacDonald  .The court held that the seller was able to claim that he had tendered performance.
GW Treitel in law of contract(p.702)states that such cases, the question whether particular obligation is entire or severable is one of conclusion and to where a party agrees to do work under a contract ,courts are reluctant to construe contract so as to require complete performance due.
2) By agreement; what has been created by agreement can as well be extinguished agreement. Where agreement for discharge is not under seal, legal position varies according to whether discharge is bilateral or unilateral.
Bilateral discharge; this is where both parties to a contract have some right to surrender and agreements and it has several effects. This is in Berry v Berry  where court held that this simple contract was a good defense to an action brought by wife to recover the sum fixed by deed of separation.
Accord and satisfaction; Parties may intend to rescind their agreement and nothing more .Like in Good v Chessman  .The other effects include rescission, variation and waiver.
Unilateral discharge; Here only one party has rights to surrender. Where one party has entirely performed his part of the agreement, he is no longer under obligation but has rights to compel performance agreement of other. In the case of Russian Gazette v Associated Newspapers Ltd  .There is one exception to that rule in that a unilateral discharge requires consideration. It was held that the letter written by Mr.Tabolt recorded an agreement in which consideration was a promise for a promise.
3) By Frustation; Doctrine of frustration is that parties to a contract are excused from further performance of their obligations of some unexpected event occurs during currency without fault of either party.
a)Where performance of contract is illegal ;A contract can be discharged by a supervening prohibition where performance is illegal and this is seen in the Fibrosa case  where contract for sale of machinery to be shipped at Gdynia which was frustrated when that port was occupied by enemy during second world war. Contract was discharged due to strong public interest in ensuring that no aid was given to enemy in time of war.
b) Destruction of subject matter; when both parties contemplate to a particular matter as forming the basis of their contract, If it gets destroyed, the contract is then frustrated like in Taylor v Caldwell  where defendant let a certain hall for a musical show .The hall was destroyed by fire; it was held that contract was frustrated. Another case is Krell v Henry  where plaintiff agreed to let a room for purpose of viewing a procession. The procession was cancelled it was held that purpose for getting a room was frustrated and defendant was discharged from paying.
c)Government or statutory intervetion;This is where a law makes the current contract void like in Metropolitan water board vDick Kerr  where Kerr was contracted to construct a reservoir and in February 1916,minister of Munitions ordered respondent to cease work and sell plant thus frustrating the contract.
d)Unavailability; contract can be discharged if a person or thing essential for the performance of a contract is unavailable like in Samson Engola v Nabitalo  where a contract for sale of car was held to be frustrated by seizure of car at gunpoint by soldiers.
4) By breach; This is a method of discharge. Breach also brings to an end of obligations created by a contract on the part of each .Breach of a contract can be through breaching a condition like in the Schuler AG v Wickman Mackintools sales ltd  where court held that despite classification of the term in contract, the only available remedy would have been damages, as for the breaches of the term generally. Breach of a contract can be anticipatory where by this one occurs before the date of performance of the contract .It is accepted as a breach because one party expressly gives notice to the other party that he will not complete his obligations like in the Hochster v DelaTour  where court held that there was no requirement that victim of breach of contract be obliged to wait until contract was breached before being able to sue. Discharge by breach will generally give rise to obligations to pay damages. Discharge by performance gives no rise to secondary obligations while discharge by frustration does not give to secondary obligations but rights under restitute.
Discharge of valid contract should be distinguished from termination of an invalid contract, as with mistake&Restraint of trade  where agreement is deemed void. In such circumstances no obligations can said to have existed whereas in the case of a valid contract, the primary obligations cease but contract may remain in existence and give rise to the secondary obligations to pay damages.