Skip to content

Week 11 - November 25

Class Description

This week we explore two powerful architectural patterns in software engineering: Entity Component Systems (ECS) in game engines and cryptographic algorithms for secure communication. These topics may seem distinct, but both demonstrate how thoughtful system design enables complex functionality through elegant composition and transformation of data.

ECS Architecture: Modern game engines like Unity and Bevy use the Entity Component System pattern to manage thousands of game objects efficiently. Instead of traditional object-oriented hierarchies, ECS separates data (Components) from behavior (Systems), with Entities serving as lightweight identifiers. This data-oriented design enables performance optimization and flexible composition.

Cryptography: While games process visible data, cryptography transforms data to protect it. You'll explore fundamental cryptographic concepts including encryption, hashing, and encoding—understanding both the mathematical foundations and practical applications that secure everything from passwords to HTTPS connections.

Key Connection: Data-oriented design patterns → Separation of concerns → Performance and security → Real-world system architecture.

Key Learning Objectives:

  • Understand the Entity Component System (ECS) architectural pattern
  • Distinguish between entities, components, and systems in game design
  • Compare ECS to traditional object-oriented game architectures
  • Recognize how data-oriented design improves cache performance and scalability
  • Implement basic ECS patterns in Python or your preferred language
  • Understand fundamental cryptographic concepts: encryption, hashing, and encoding
  • Distinguish between symmetric and asymmetric encryption
  • Implement basic cryptographic operations using standard libraries
  • Understand password hashing and why it differs from encryption
  • Apply cryptographic principles to secure data in applications
  • Recognize common cryptographic algorithms (AES, RSA, SHA-256)
  • Understand practical applications: HTTPS, password storage, digital signatures

Before Class

Videos to Watch Before Class

Entity Component Systems (ECS)

Cryptography

Hashing

LLM Learning Prompts

Use these prompts with ChatGPT, Claude, or other AI assistants to deepen your understanding:

Entity Component System (ECS) Fundamentals:

Explain the Entity Component System (ECS) pattern used in game engines. What are 
entities, components, and systems? How does ECS differ from traditional object-oriented 
game design? Show me a simple example in Python of a game with entities that have 
position and velocity components, and a movement system.

ECS vs OOP:

Compare traditional object-oriented game design (with inheritance hierarchies) to 
Entity Component System design. What problems does ECS solve? What are the trade-offs? 
Show me how you'd model a flying enemy that shoots projectiles in both paradigms.

Data-Oriented Design:

Explain data-oriented design and how it relates to ECS. Why does separating data 
(components) from behavior (systems) improve cache performance? How does this help 
games that need to process thousands of entities every frame?

ECS Implementation:

Walk me through implementing a minimal ECS framework in Python. I need to support 
adding/removing entities, attaching components to entities, and running systems that 
process entities with specific components. Show me concrete code examples.

Composition over Inheritance:

Explain "composition over inheritance" using game entities as examples. How does ECS 
enable flexible entity composition? Show me how to create a flying fire-breathing 
dragon enemy by composing components rather than using deep inheritance hierarchies.

Cryptography Fundamentals:

Explain the difference between encryption, hashing, and encoding. When would I use 
each? Give me practical examples in Python using standard libraries. Why is encoding 
(like base64) not secure?

Symmetric vs Asymmetric Encryption:

Teach me the difference between symmetric and asymmetric encryption. What are the 
use cases for each? Explain AES (symmetric) and RSA (asymmetric). Show me Python 
examples of encrypting and decrypting data with both approaches.

Hashing and Password Storage:

Explain cryptographic hashing and why it's one-way. Why do we hash passwords instead 
of encrypting them? What are salts and why are they important? Show me how to properly 
hash and verify passwords in Python using bcrypt or similar libraries.

HTTPS and SSL/TLS:

Explain how HTTPS works. What role do symmetric and asymmetric encryption play in 
establishing a secure connection? Walk me through the SSL/TLS handshake process in 
simple terms. How do certificates and certificate authorities fit in?

Digital Signatures:

Explain digital signatures and how they provide authentication and integrity. How 
are they different from encryption? Show me a Python example of signing data with 
a private key and verifying the signature with a public key.

Practical Cryptography:

I'm building a web application. Walk me through the cryptographic considerations I 
need to think about: password storage, session tokens, API authentication, sensitive 
data storage, and secure communication. What libraries should I use and what are 
the best practices?

General Understanding:

I'm learning about [ECS or cryptography topic]. Can you create a small practice 
problem for me? After I attempt it, review my solution and suggest improvements 
and best practices.

Additional Resources

Entity Component Systems:

Cryptography: