131.4 Designing a data dictionary

Learn how to describe the variables used in a program using a structured table called a data dictionary.

What is a data dictionary?

A data dictionary is a structured table that defines the variables used in a software system. It is beneficial during planning and documentation, and supports debugging, collaboration, and security auditing.

Each row in the dictionary describes a variable’s

  • Name

  • Data type

  • Format for display

  • Storage size

  • Description

  • Example value

  • Validation rules

Example data dictionary

Variable name
Data type
Format
Size
Description
Example
Validation

username

String

A-Z, a-z

15

User's login name

jlee01

6–15 characters

dob

Date

YYYY-MM-DD

10

Date of birth

2008-06-25

Must be before today

score

Integer

###

3

Player's current score

157

Between 0 and 999

is_active

Boolean

TRUE/FALSE

1

Whether account is active

TRUE

Must be TRUE or FALSE

How to use a data dictionary

  • During planning Use it to define what data your program needs.

  • During coding Refer to it to avoid mistakes and inconsistencies.

  • During debugging Helps check for type mismatches or invalid data.

  • During teamwork Ensures all team members understand the variables.

Data dictionaries and security

Using a data dictionary improves secure coding by:

  • Preventing the use of unsafe or undocumented variables

  • Allowing for validation rules to be documented and enforced

  • Supporting clear variable naming that avoids shadowing or reuse

  • Making input/output expectations explicit for each variable

This aligns with defensive coding practices and is a foundation for secure input handling.

Key concepts

  • A data dictionary describes variables in a software system.

  • It supports clarity, maintenance, and debugging.

  • Format, size, and validation are important for security and correctness.

  • It is a useful planning tool and documentation aid.


Linked content: Secure programming practices (410.2)

The way you name, define, and validate variables directly affects how secure your software is. In 410.2 Secure programming practices, you’ll explore how constants, data types, and input validation techniques reduce vulnerabilities such as input injection and data corruption. The principles you’re learning here in 131 lay the groundwork for secure coding later in the course.

Last updated

Was this helpful?