concept development in category blockchain

This is an excerpt from Manning's book Blockchain in Action.
Structurally, a smart contract is a standalone piece of code similar to a class in an object-oriented program. It is a deployable module of code with data and functions. Functions serve the specific purposes of verification, validation, and enabling recording of the messages sent. A contract in the real world involves rules, conditions, laws, regulations to be enforced, criteria, contingencies, and items for provenance such as dates and signatures. Similarly, the smart contract in a blockchain context implements the contract rules for solving a decentralized problem. It functions as a rules engine as well as a gatekeeper, so understandably, the smart contract design requires careful consideration. Following is an explanation of a smart contract modified to include the code aspects.