-
PRG 210
November 29, 2010
-
Data Structures, Arrays, and Modularizing In a computer, “the data structure becomes an object that includes data and functions” (Robertson, 2007). It stores and organizes the data in a computer. Data structures make it possible to sort through large databases and internet indexing services. These would include online libraries, such EBSCOhost through universities, and search websites, such as Google. These would also include member profiles such as Facebook. Arrays “provide the programmer with a way of organising a collection of homogeneous data items (that is, items that have the same type and the same length) into a single data structure. An array, then, is a data structure that is made up of a number of variables all of which have the same data type” (Robertson, 2007). For example, there are 40 students in the first grade. A single variable name such as ‘first’ can be used with all 40 first grade students. “The individual data items that make up the array are referred to as the elements of the array. Elements in the array are distinguished from one another by the use of an index or subscript, enclosed in parentheses, following the array name” (Robertson, 2007), such as ‘first (8)’. This subscript refers to the eighth student in the first grade. The smallest element of an array must also be the size of the largest element, so in using the months of the year as an example, the names of the shorter months must be padded with blank spaces. The month of May must be as long as the month of September. Modularization breaks down the complexity of programming. That means that the complex problem gets divided into smaller parts, thus creating subtasks or functions from the major tasks. The subtasks can then be further divided into smaller subtasks, as long as each task or subtask is independent of all others. “There are a number of benefits from using modular design.