In Component Development, a component was developed to perform this function. One of the properties defined for the component was the material of the plate, which you defined as a simple String. When the user selected a value for the material from a predefined menu of materials (aluminum, steel, or wood), that value was used in the Executor to set a value for the density by selecting from a set of predefined values in the code. A more ideal solution is to represent the material using a custom datatype that can store all the relevant properties for the material and provide a means to access those properties. As a result values do not have to be predefined in any component code and can instead be provided dynamically to the components. Considering step 1 in Understanding the Basic Steps, you can identify the following information for this datatype: A material has a name and a number of associated properties that typically are defined by standards set from significant physical testing, such as those set by the ASTM (American Society for Testing Materials). For the purposes of this example, you will limit the material properties to the following:
Others could be added as desired. Begin every datatype development with an assessment similar to this one so that you know the exact quantities you have to work with when developing your wrapper classes (Renderer, Editor, Value). |