Aggregate Data Type

Aggregate data type also refer to complex data structure, is any type of data that can be referenced as a single entity, and yet consists of more than one piece of data. This data type is used to keep all related data together in a way that emphasizes the relationship of the data.  Examples of aggregate data are strings, arrays, classes, and structures.

Aggregate Data Type is use to create higher-level structures, and for a more effective data use.  A proper used of sturctured data helps to make programs less complicated, easier to understand and maintain.

Structured Data in Aggregate Data Type

Benefits of Structured Data:

  • Avoid one-off errors - In languages that have zero-based indices, it is common for programmers to try to access memory outside the bounds of the aggregate data type. Know your limits; use sizeof()!
  • Use structured data to make the relationships between data clear.
  • Use structured data to make operations of blocks of data simpler.
  • Use structured data to make parameter passing clearer, easier and simpler. 
Abstract Data Types (ADTs)

An abstract data type is a collection of data and operation that work on that data.

Benefits of Using Abstract Data Type:

  • Support informastion hiding
  • Minimize the effect of changes in program. 
  • Improve ability to enhance code
  • Program becomes more self-documenting
  • Allows for object-oriented concepts
  • It defines operations dealing with real-world entities

Example Set #1:  A large C++ program showing good and bad examples of all four tips.
Example Set #2:  C++ example - good and bad use of structured data
Example Set #3:  Java example - good and bad use of structured data
Example Set #4: C example - bad use of structured data

Authors:  Vince Sorensen, Mandy Aldcorn
Revise Authors: Alice Mok, Rena Xu, Mandy Wong, Anthony Leung,  Andy Ho, Gary Lo
Reference: Code Complete, A Practical Handbook of Software Construction. Steve McConnell. Microsoft Press (1993)
Last Modified: December 6, 2000
Copyright 2000, University of Regina. All rights reserved.

Copyright: Department of Computer Science, University of Regina.

[Guide to Online Writing] [CS Dept Home Page]