Software Engineering Principles and Practices / Software Design

Data Designs

Data design translates the data objects defined during the requirements phase into a set of data structures that can be implemented in code or a database.


🧬 The Three Levels of Data Design

A professional data designer works through three distinct levels of abstraction:

  1. Conceptual Schema: The highest level. It describes the data from a business perspective without worrying about technology. (e.g., "A Customer places an Order").

  2. Logical Schema: Maps the conceptual model into a data structures format (like tables and columns). This is where we define data types, primary keys, and relationships.

  3. Physical Schema: The "real-world" implementation. It describes how the data is stored on disks, including file structures, indexing for speed, and specific database settings (MySQL, PostgreSQL, etc.).


🏛️ Data Modeling (ER Diagrams)

The primary tool for data design is the Entity-Relationship (ER) Diagram. It uses specific symbols to show how data is structured:

  • Entities (Rectangles): The "things" we store data about (User, Product, Transaction).

  • Attributes (Ovals): The properties of those things (User_Name, Product_Price).

  • Relationships (Diamonds): How entities interact (A User buys a Product).


🖇️ Key Data Design Concepts

1. Normalization

The process of organizing data to reduce redundancy (repeating the same data) and improve integrity.

  • Why? If you store a customer's address in ten different tables and they move house, you have to update it in ten places. Normalization ensures you only update it once.

2. CRUD Operations

Every data design must support the four basic functions:

  • Create: Adding new data.

  • Read: Fetching data.

  • Update: Modifying existing data.

  • Delete: Removing data.

3. Data Integrity

Ensuring the data remains accurate over time.

  • Entity Integrity: Every table must have a unique Primary Key.

  • Referential Integrity: You shouldn't be able to delete a "User" if they still have "Active Orders" attached to them.


🗄️ Storage Choices: SQL vs. NoSQL

A major part of data design is choosing the right "bucket" for your data:

Feature

Relational (SQL)

Non-Relational (NoSQL)

Structure

Tabular (Rows & Columns).

Document, Key-Value, or Graph.

Schema

Fixed/Rigid (Must follow rules).

Dynamic/Flexible (Change on the fly).

Scaling

Vertical (Bigger Servers).

Horizontal (More Servers).

Best For

Financial systems, ERPs.

Real-time big data, Social Media.


💡 Why Data Design Fails

The most common mistake is "Hardcoding Data Logic." If your code is too tightly coupled to the way your database is structured, changing your database later becomes a nightmare. This is why we use Data Access Layers (DAL) to separate the code from the storage.