sources of data
TRANSCRIPT
1.2 SOURCES OF DATAH’MM
OBJECTIVES
The learners will be able to: Define Static Data and give examples Define Dynamic Data and give examples Compare the use of static information sources with dynamic information sources Define direct and indirect data source Understand the advantages and disadvantages of gathering data from direct and
indirect data sources
DATA STRUCTURE
What is a data structure?“A data structure is a collection of data items that is
implemented by various development tools.”
STATIC DATA STRUCTURE“MR. DEPENDABLE”
STATIC DATA STRUCTURE
The size of the data structure is fixedStatic data structures are very good for storing a well-defined number of
data items.For example, if we want to design an ID field for employees of an
organization. We can suggest it to be a fixed format e.g. “HIS000”; where the 1st 3 characters are the initials of the organization and the other three the employee number e.g. HIS225.
ADVANTAGES OF STATIC DATA STRUCTURES
The development tool can allocate space during compilationEasy to programEasy to check for overflowAllows random access
DISADVANTAGES OF STATIC DATA STRUCTURES
The developer has to estimate the maximum amount of space that is going to be needed.
A lot of space maybe wasted.
DYNAMIC DATA STRUCTURE“MR. ADAPTABLE”
DYNAMIC DATA STRUCTURE
There are many situations where the number of items to be stored in NOT known in advance e.g. the length of someone’s name may NOT be the same as any other’s name.
In this case, the developer would be using a dynamic data structure. This means that the data structure is allowed to grow and shrink as the demand for storage arises.
The developer should also set a maximum size to help avoid memory collisions.
DYNAMIC DATA STATIC DATAMemory is allocated to the data structure dynamically.
Memory is allocated at compile time. Fixed size.
Limitation: As the memory allocation is dynamic, it is possible to ‘overflow’ should it exceed it’s allowed limit. It can also ‘underflow’ if it becomes empty.
Benefit: The memory allocation is fixed and so there will be no problem with adding an removing data items.
Benefit: Makes the most efficient use of memory as the data structure – only uses as much memory it needs.
Limitation: Can be very inefficient as the memory for the data structure has been set aside regardless we use it or not.
Limitation: Harder to program as the software needs to keep track of its size and data item locations at all times.
Benefit: Easier to program as there is no need to check on data structure size at any point.