Uninformed: Informative Information for the Uninformed

Vol 8» 2007.Sep


Data Type Tier

Using data flow information obtained from the procedure tier, it is sometimes possible, depending on language features, to generalize data flow information to the data type tier. Generalizing to the data type tier is meant to show how formal parameters are passed between data types within the context of a given data type. This relies on the underlying language having the ability to associate procedures with data types. For example, object-oriented languages are all capable of associating procedures with data types, such as through classes defined in C++, C#, and other languages. In the case of languages where data types do not have procedures, it may instead be possible to associate procedures with the name of the source file that contains them. In both cases, it is possible to show formal parameters passing between elements that act as containers for procedures, regardless of whether the underlying elements are true data types.

The benefit of generalizing data flow information at the data type tier is that it helps to further reduce the amount of data flow information that must be represented. Since the small example source code that has been used to illustrate generalizations at each tier only involves passing formal parameters within the same data type, it is useful to consider an alternative example which involves passing data between multiple data types.

class Company {
   void AddEmployee(int num) {
      Person employee = new Person(num);
      employees.Add(employee);
      Console.WriteLine("New employee {0}", employee);
   }
   int EmployeeCount() {
      return employees.Count;
   }
   private ArrayList employees;
}

Figure 9 shows the data type data flow paths for the example code shown above. It is important to note that unlike previous tiers, the specific formal parameters that are being passed between types is not preserved. Instead, only the fact that formal parameters are passed between data types is retained. In this manner, fin indicates a data type's formal input parameter and fout indicates a data type's formal output parameter.

Figure 9: Data type tier data flow paths obtained by generalizing the procedure tier data flow paths. The context for these data flow paths is the Company data type.
Image realpath-datatype

In a fashion much the same as previous generalization tiers, a single data type data flow path can represent multiple underlying procedure data flow paths. Each generalized procedure data flow path can be associated with its corresponding data type data flow path through a one-to-many link table in a normalized database.