Performing data modeling using an example
The previous discussion should ignite your minds with thoughts that data modeling is an extremely important exercise for smart contracts and using the right data types for storing the values is equally important.
Let's understand the entire process using an example and assume that we again want to store employee and address information as part of a decentralized application.
Structures
The structure for employee
is quite simple and it has been purposely kept so. You can add as many elements to it as you deem necessary:
struct Employee { address identifier, bytes32 name, uint8 age, bytes32 email }
An Address
struct is shown next:
struct ContactAddress { string city; string state; }
The employee
struct in...