Business Data Structures: Organizing Information for Use
Business applications handle customer details, product codes, service requests, and transaction histories. Business data structures organize these values so that an application can perform the operations its work requires. Choosing a structure begins with practical questions: what belongs together, how will you find it, can values repeat, and does processing order matter?
Values, records, and collections
A data structure is a way of organizing data together with rules for accessing and changing it. The same business facts can support different operations depending on their structure. A collection arranged for processing requests in arrival order serves a different purpose from one arranged for finding a request by its identifier.
Start by separating individual values from grouped information. A string stores text, such as a customer name or product code. An identifier such as 00472 should usually be stored as a string when every character matters. Treating it as a number can remove its leading zeros. Digits do not automatically make a value a quantity for arithmetic.
A record groups named fields describing one item or event. A delivery record might contain a delivery identifier, recipient name, parcel count, and status. Its fields can hold different types of values. A collection then holds multiple records or values.
These levels work together: a list can contain delivery records, and each record can contain strings and numbers. Selecting a collection does not eliminate the need to design its individual records.
Match the structure to the operation
Common structures emphasize different access rules. The names below describe their usual abstract behavior; a programming language may provide several implementations.
Structure | Main organizing rule | Typical business use |
|---|---|---|
List | Maintains a sequence; repeated values are allowed | Keeping invoice line items in their entered order |
Map or dictionary | Associates each unique key with a value | Finding a product record by product code |
Set | Holds distinct elements and supports membership checks | Tracking which delivery identifiers have already been scanned |
Queue | Adds at the rear and removes from the front | Processing requests in arrival order |
Stack | Adds and removes at the same end | Reversing the most recent reversible action first |
A queue follows first in, first out, often abbreviated FIFO. A stack follows last in, first out, or LIFO. A list provides sequence, but the application must still enforce any special processing rule. A basic FIFO queue does not automatically move urgent requests ahead of earlier requests.
Check identity, repetition, and change
For a map, a key must distinguish the entries you intend to keep. Customer names are often unsuitable because different customers can share a name. A customer identifier is usually a better key when the application guarantees its uniqueness.
Sometimes identity depends on a combination. If a product has a separate stock record at each warehouse, the pair of warehouse identifier and product code can identify a stock record. Product code alone would merge entries that the business needs to keep separate. The program must represent the pair consistently, without ambiguous combinations.
Repeated values also need interpretation. An invoice can legitimately contain repeated product codes, so removing duplicates could destroy valid line items. A set is appropriate when repeated occurrences should count as one member, not whenever repetition happens to exist.
An application may need more than one structure. A map can support request lookup while a queue stores request identifiers awaiting service. If a request is cancelled, the application needs a rule for updating or checking the waiting queue so that it does not process the cancelled request.
What to remember
- Group one item's named fields into a record, then choose a collection for the required operations.
- Use strings for identifiers whose characters, including leading zeros, matter.
- Check whether keys are unique and whether repeated values are meaningful.
- Use FIFO for arrival order and LIFO for most recent first.
- Keep structures consistent when they represent the same changing business items.
Example: Organizing a Parcel Collection Desk
A parcel collection desk is building a small application. Each collection request has a unique four-character identifier, such as 0068. The application must preserve all four characters, store the recipient name and collection status, and let staff retrieve a request by its identifier. Waiting requests are served in arrival order, with no priority exceptions. A separate scanner should recognize repeated scans of the same parcel identifier during a shift; each parcel should be counted as present only once.
Assume requests are processed sequentially and no requests are cancelled in this example.
A) Recommend how to represent one collection request and how to organize all requests for lookup.
First identify the fields describing one request: request identifier, recipient name, and collection status. Group them into a record so that each value has a named role.
Next choose the identifier's representation. Store 0068 as a string because all four characters matter. An ordinary integer representation would lose the ________.
Finally, place request records in a map keyed by request identifier. The identifier is guaranteed to be unique, so each key selects one request record. A recipient name would be a weaker choice because different recipients can share a name.
The result is a map from four-character request identifiers to request records.
B) Recommend how to manage waiting requests while retaining lookup by identifier.
The service rule is arrival order, so select a FIFO queue. Store request identifiers in the queue and retain the full records in the map.
When a request arrives, create its record, store it in the map, and add its identifier at the queue's ________. When staff are ready for the next request, remove the identifier at the ________ and use it to retrieve the corresponding record from the map. Update that record's status as service progresses.
This combination serves two different operations: the queue determines who is next, while the map finds the details of any identified request. Under the stated assumptions, serving from the front preserves arrival order.
C) Recommend a structure for recognizing repeated parcel scans during a shift.
The scanner needs to decide whether a parcel identifier has already appeared. It does not need to retain every repeated occurrence for the stated counting task, so use a set of parcel identifiers for that shift.
For each scan, check membership. If the identifier is absent, add it and count the parcel as newly present. If the identifier is already present, leave the set unchanged and do not count another parcel.
Use parcel identifiers rather than recipient names because one recipient may have several parcels. Begin a new set for a new shift, matching the stated tracking period. The resulting set contains each scanned parcel identifier once.
A business application can organize stored elements in several ways. Match each data structure to the description of its organization, rather than to a particular business use.
Organizes elements into parent–child branches, with one parent for each element except the top element and no cycles.
Stores elements in neighbouring memory locations and supports direct access by position number.
Connects separately stored elements through references that identify the next element in a sequence.
Array
Linked list
Rooted tree
A distributor assigns every supplier a six-character identifier made entirely of digits. The identifier 000583 must be displayed and exchanged exactly as assigned. The distributor never performs arithmetic on identifiers. Which storage choice best preserves their meaning?