Welcome to the SDA2 Software Architecture Workshop! This repository contains hands-on exercises to understand different architectural styles through practical Python implementations using Test-Driven Development (TDD).
By the end of this workshop, you will understand:
- The characteristics and trade-offs of different architectural styles
- How architectural decisions impact code organization and maintainability
- The practical implementation of monolithic, layered, and event-driven architectures
- Test-Driven Development as a learning and design tool
- Progressive complexity in software architecture design
This repository uses a two-branch strategy for educational purposes:
βββ 01-monolith/ # Monolithic Architecture
β βββ todo_manager.py # TDD starter template with failing tests
β βββ guide.md # Architecture learning guide and exercise-specific instructions
βββ 02-layered/ # Layered Architecture
β βββ library_system.py # TDD starter template with failing tests
β βββ guide.md # Architecture learning guide and exercise-specific instructions
βββ 03-eventdriven/ # Event-Driven Architecture
β βββ library_system.py # TDD starter template with failing tests
β βββ guide.md # Architecture learning guide and exercise-specific instructions
βββ LICENSE # MIT License
βββ README.md # This file
- Same structure as
mainbranch - Contains complete, working solutions
- All tests pass
- Includes interactive demos
git clone https://github.com/bfh-teaching/sda2-workshop-architectural-styles
cd ssda2-workshop-architectural-stylesgit branch
# Should show: * main- Python 3.7+ required
- No external dependencies needed
- Use your favorite IDE/editor
This workshop uses TDD to guide your learning:
- Read failing tests - They define exactly what to implement
- Implement functions - Make tests pass one by one
- Get immediate feedback - Know instantly if your solution works
- Learn through testing - Tests serve as requirements and documentation
# Navigate to any exercise directory
cd 01-monolith
# Run the starter template to see failing tests
python todo_manager.py
# Implement functions to make tests pass
# Run again to see progress
python todo_manager.pyComplexity: π΅ Beginner
- Theory: Direct coupling, simple structure
- Implementation: Complete
01-monolith/todo_manager.py - Discussion: When to use monoliths?
Key Concepts:
- Global state and direct function calls
- Tight coupling between components
- Simple deployment and development
Complexity: π‘ Intermediate
- Theory: Separation of concerns, controlled communication
- Implementation: Complete
02-layered/library_system.py - Discussion: Benefits and limitations
Key Concepts:
- Data Access β Business Logic β Presentation layers
- Controlled inter-layer communication
- Service isolation and testability
Complexity: π΄ Advanced
- Theory: Loose coupling, async communication
- Implementation: Complete
03-eventdriven/library_system.py - Discussion: Scalability and distributed systems
Key Concepts:
- Message broker and event routing
- Service isolation through events
- Eventually consistent systems
- Event sourcing and audit trails
- Compare the three implementations
- Discuss architectural trade-offs
- Real-world application scenarios
- Read the Architecture Guide (
guide.md) - Understand theory and patterns - Analyze Failing Tests - They define exactly what to implement
- Implement Functions - Follow TDD: Red β Green β Refactor
- Run Tests Frequently - Get immediate feedback on progress
- Complete Integration - Ensure all tests pass
- Compare with Solution - When finished or stuck
# View a solution file without leaving main branch
git show solutions:01-monolith/todo_manager.py
# Create a reference file for comparison
git show solutions:01-monolith/todo_manager.py > solution_reference.py# Save your work first!
git add .
git commit -m "My progress on monolith exercise"
# Switch to solutions branch
git checkout solutions
# View complete implementations
cat 01-monolith/todo_manager.py
# Return to main branch
git checkout main# Temporarily save your work
git stash push -m "Monolith exercise progress"
# Switch to solutions
git checkout solutions
# Return to main and restore work
git checkout main
git stash pop# Method 1: Commit your work
git add .
git commit -m "Exercise progress"
# Method 2: Stash your work
git stash push -m "Work in progress"
# Method 3: Create backup files
cp 01-monolith/todo_manager.py my_backup.pygit status # See what files you've modified
git diff # See your changes- β Simple development and deployment
- β Direct function calls and shared state
- β Difficult to scale individual components
- β Tight coupling between all parts
- β Clear separation of concerns
- β Each layer has specific responsibility
- β Easier to test and maintain
- β Can become rigid and bottlenecked
- β Loose coupling between services
- β Highly scalable and flexible
- β Independent service development
- β More complex to debug and reason about
- β Eventually consistent (not immediately)
- Read test names carefully - They describe what to implement
- Start with simple functions - Build complexity gradually
- Run tests frequently - Get immediate feedback
- Read error messages - They guide you to the problem
- Don't copy solutions early - Try to understand the problem first
- Focus on making tests pass - Don't over-engineer initially
- One test at a time - Implement incrementally
- Tests are requirements - They define expected behavior
- Red-Green-Refactor - Fail β Pass β Improve
- Save work before switching branches - Avoid losing progress
- Use meaningful commit messages - Track your progress
- Create backup files - Safety net for important work
- Check
git statusoften - Know what you've changed
- Immediate Feedback - Know instantly if you're on track
- Clear Requirements - No ambiguity about what to implement
- Progressive Learning - Build complexity step by step
- Professional Skills - Learn industry-standard TDD practices
- AI-Resistant - Must understand logic, not just fill blanks
Simple β Organized β Distributed
β β β
Monolith β Layered β Event-Driven
β β β
Direct β Layer β Message
Calls Isolation Passing
Your understanding will be demonstrated by:
- All tests passing - Correct implementation
- Clean code structure - Following architectural principles
- Explaining trade-offs - Understanding when to use each pattern
- Progressive complexity - Appreciating the learning journey
This project is licensed under the MIT License - see the LICENSE file for details.
You are free to:
- β Use this material for educational purposes
- β Modify and adapt for your own courses
- β Share with students and colleagues
- β Create derivative works
- Inspired by real-world architectural patterns used in industry
- Test-driven approach based on modern software development practices
- Educational methodology designed for progressive skill building
- Examples chosen for clarity and practical relevance
Ready to master software architecture through hands-on practice? Let's build! π
Questions? Issues? Create a GitHub issue or reach out during the workshop.
Happy coding and architectural thinking! ποΈ