Storage: 0's and 1's stored in a useful structure

Foundations of Practical System Design

System Design Course for Junior Engineers

Kay Ashaolu

What is Storage?

  • Storage is data (0's and 1's) organized in a particular way to save information
  • This "particular way" is typically described by one or more data structures

Why Care About Data Structures?

  • Raw binary data is not inherently meaningful by itself
  • Storage using data structures provides shape and context to these bits
  • Efficient organization improves:
    • Retrieval speed
    • Memory usage
    • Ability to scale complex systems

First Category: Lists/Arrays/Vectors

  • A linear sequence of data
  • Elements are stored in a specific order
  • Often indexed by integers starting from 0
  • Can be extended into multiple dimensions (2D, 3D, etc.)

Arrays and Multidimensional Structures

  • 1D arrays: Simple linear lists (e.g., [a, b, c, d])
  • 2D arrays: Think of spreadsheets or tables (rows and columns)
  • Higher dimensions: Useful in advanced applications (e.g., matrices in math, tensors in machine learning)

Advantages of Arrays

  • Easy indexing: Access elements by their position
  • Often memory-efficient: Contiguous allocation can improve cache performance
  • Ideal for scenarios where order matters or when random access is frequent

Second Category: Dictionaries/Objects

  • Key-value pairs, like a real dictionary word lookup
  • Instead of numeric indices, you define the keys
  • Flexible: You can attach descriptive names to data elements

Dictionaries for Real-World Models

  • Represent complex entities naturally:
    • Example: A “person” object with keys like name, age, height
  • No need to remember integer indices
  • Extend objects with attributes and related data easily

Third Category: Trees and Graphs

  • Data points connected by relationships rather than positions or keys
  • Trees: Hierarchical structure (like a family tree)
  • Graphs: More general connections (networks, social graphs, linked documents)

Power of Trees and Graphs

  • Model relationships and dependencies
  • Efficiently represent connected structures (e.g., routes on a map)
  • Enable complex queries based on connectivity rather than just order or keys

Comparing the Three Categories

  • Arrays/Lists: Ordered sequences, fast indexing, simple structure
  • Dictionaries/Objects: Keyed lookups, descriptive data modeling
  • Trees/Graphs: Relationship-based, complex connectivity, flexible representations

The Common Thread

  • All structures store and manipulate the same basic binary data
  • Choosing the right structure depends on:
    • The type of data you have
    • The operations you need to perform (lookup, insert, traverse)
    • The patterns of data relationships

Efficiency and Scale

  • Proper data structures ensure:
    • Faster responses at scale
    • Better use of memory
    • More intuitive code and system design

Gaining Intuition

  • Recognize the patterns in data storage
  • Understand how arrays, dictionaries, and graphs influence system architecture
  • This intuition helps you design robust, maintainable, and efficient systems

Next Steps

  • In future lessons, we’ll see how to use these structures with tasks
  • We’ll explore how combining data storage with well-chosen tasks leads to building blocks
  • Keep thinking about how data is stored and why it matters!

Storage: 0's and 1's stored in a useful structure

By kayashaolu

Storage: 0's and 1's stored in a useful structure

  • 3