



















Preview text:
lOMoAR cPSD| 58647650
1.1 Why do we need to study Software Architecture and Design? (3 pages)
1.1.1. What is Software Architecture and Software Design?
Software development is a complex process that requires careful planning and
structuring to ensure efficiency, maintainability, and scalability. Two fundamental
aspects that contribute to the success of software systems are software architecture and software design.
a. What is Software Architecture?
Software architecture represents the high-level structure of a software system,
serving as a blueprint that guides development teams through the implementation
process. It encompasses the fundamental organization of the system, including: •
System components and their relationships •
External properties of these components •
The principles guiding the system's design and evolution Common software architectural styles include: •
Monolithic Architecture – A single codebase that handles all functionalities. •
Microservices Architecture – A distributed system where functionalities are
broken into independent services. •
Layered Architecture – Separates concerns into different layers (e.g.,
presentation, business logic, data).
b. What is Software Design?
Software design focuses on translating architectural decisions into implementable solutions.
Key aspects of software design: • Detailed component design • Interface specifications • Data structure selection • Algorithm development.
Common software design principles: lOMoAR cPSD| 58647650 •
SOLID Principles – Guidelines for writing maintainable and scalable code. •
Design Patterns – Proven solutions to recurring design problems (e.g.,
Singleton, Factory, Observer). •
DRY (Don't Repeat Yourself) – Encourages reusability to reduce redundancy.
1.1.2. Importance in Modern Software Development
Software architecture is a critical aspect of software development that influences
long-term system success. Understanding its importance helps developers build
software that meets business and technical requirements effectively. a. Business Impact •
Cost Efficiency - Streamlined development and maintenance lower costs and optimize resource use. •
Risk Management - Early detection and robust security enhance system
reliability and disaster recovery.
b. Innovation and Adaptation •
Technology Integration: Facilitates new tech adoption, enhances integration
capabilities, supports modern practices, and boosts competitive advantage. •
Market Responsiveness: Accelerates feature deployment and bug fixes,
enhancing user experience and customer satisfaction. c. Technical Benefits •
System Quality: Enhanced performance, scalability, security, and reliability. •
Development Efficiency: Accelerated development cycles, improved team
collaboration, organized code, and streamlined testing procedures. 1.1.4. Conclusion
Understanding software architecture and design is essential for creating successful
software systems. It provides the foundation for building scalable, maintainable, and
efficient applications while ensuring long-term success and sustainability. By
mastering these concepts, developers can: •
Create more robust and reliable systems •
Improve development efficiency and team collaboration lOMoAR cPSD| 58647650 •
Reduce maintenance costs and technical debt •
Enable faster adaptation to changing requirements •
Enhance overall system quality and user satisfaction
The investment in learning and applying proper software architecture and design
principles pays dividends throughout the entire software lifecycle, making it an
essential area of study for all software professionals.
1.2 Monolithic and Microservice. Microservice and AGILE ([1] [2] write 7 pages) 1. Introduction
Software architecture refers to the organization and design of applications,
determining how their components interact. Among the most debated architectural
styles are Monolithic Architecture and Microservices Architecture. Although
monolithic systems have long been the conventional choice, microservices have
emerged as a preferred approach for modern development, prized for their
adaptability, scalability, and alignment with Agile methodologies. This section
examines the distinctions between these two architectures and highlights how
microservices enhance agility in software development, enabling teams to iterate
rapidly and respond to evolving requirements.
2. Monolithic Architecture
a. What is Monolithic Architecture?
Core Concept A monolithic architecture is a traditional software design approach
where an entire application operates as a single, cohesive unit. In this model, all
application components (interface, business logic, and data layer) are integrated into one unified codebase.
b. Characteristics of Monolithic Architecture •
Unified Codebase: The entire application's functionality resides in a single,
comprehensive codebase •
Interconnected Components: All modules are closely integrated, creating strong dependencies •
Unified Deployment: Updates require deploying the complete application •
Centralized Database: A single database serves all application data needs
c. Advantages of Monolithic Architecture lOMoAR cPSD| 58647650 •
Streamlined Development Process: Simplifies development, testing, and deployment •
Optimal Performance: Direct communication between components eliminates service overhead •
Efficient Troubleshooting: Consolidated codebase makes issue tracking straightforward
d. Disadvantages of Monolithic Architecture •
Limited Scalability: Difficult to scale individual components •
Development Bottlenecks: Growth leads to increased complexity in feature additions •
Technical Constraints: Changing technologies requires significant restructuring •
Heightened Risk: Component failures can affect the entire system
e. When to Use Monolithic Architecture? Best for: •
Small and Medium Projects: Perfect for startups and simpler applications •
Integrated Business Logic: Effective for closely connected functionalities •
Rapid Prototyping: Enables quick development and deployment •
Basic DevOps Requirements: Suitable for teams with limited infrastructure expertise Not if: •
Regular Updates: Need for frequent independent deployments •
Variable Scaling: Different components require separate scaling capabilities •
Parallel Development: Multiple teams need to work independently on features
3. Microservices Architecture
a. What is Microservices Architecture?
Core Concept Microservices architecture represents a modern software design
pattern that breaks down applications into smaller, independent components. Each
component operates as a standalone service, handling specific business functions
and communicating through APIs. This modular approach allows for independent
development, deployment, and scaling of services.
b. Characteristics of Microservices Architecture lOMoAR cPSD| 58647650 •
Service Independence: Each service focuses on a specific business function
(like payment processing or user authentication) •
Distributed Data Management: Services maintain their own databases •
Flexible Deployment: Individual services can be updated independently •
Technology Flexibility: Different services can utilize various programming languages and tools
c. Advantages of Microservices Architecture •
Enhanced Scalability: Services can be scaled based on individual demands •
Accelerated Development: Multiple teams can work concurrently on different services •
Robust Fault Tolerance: Service failures remain isolated without systemwide impact •
Simplified Maintenance: Updates and improvements can be made to individual services
d. Disadvantages of Microservices Architecture •
System Complexity: Orchestrating multiple services requires sophisticated management •
Deployment Requirements: Needs advanced tools for service management and containerization •
Data Management: Maintaining consistency across distributed databases presents challenges
e. When to Use Microservices Architecture? Best for: •
Enterprise-Scale Systems: Suitable for complex applications serving large user bases •
High-Growth Platforms: When different components need independent scaling •
Agile Development: Supports continuous integration and deployment •
Multi-Technology Projects: When different services require different tech stacks Not if: lOMoAR cPSD| 58647650 •
Small-Scale Projects: Applications with limited scaling requirements •
Limited DevOps Capability: Teams without necessary technical expertise •
Simple Applications: Where microservices would add unnecessary complexity
4. Comparing Monolithic and Microservices Architecture Feature
Monolithic Architecture
Microservices Architecture Codebase Single, unified Multiple independent services Easy (individual services can Scalability Difficult scale) Services deployed Deployment Entire app deployed at once independently Multiple technologies per Technology Stack Single technology stack service
System failure affects the entire Failure of one service does not Fault Tolerance app impact others
Development Speed Slower for large applications
Faster due to independent teams Maintenance Harder as the system grows
Easier due to modular approach 5. What is Agile?
a. Definition of Agile
Agile is a software development methodology that focuses on iterative
development, collaboration, and flexibility. It emphasizes delivering small,
functional increments of software rather than completing a large project in one go.
Agile enables teams to adapt to changing requirements quickly and improves
customer satisfaction by continuously delivering value.
b. Key Principles of Agile (from the Agile Manifesto)
• Individuals and Interactions Over Processes and Tools – Teams should focus
on collaboration rather than rigid procedures.
• Working Software Over Comprehensive Documentation – Deliver functional
software frequently instead of excessive planning.
• Customer Collaboration Over Contract Negotiation – Involve stakeholders in the development process. lOMoAR cPSD| 58647650
• Responding to Change Over Following a Plan – Be flexible and adjust to new requirements as needed.
c. Agile Development Approaches
Agile is implemented using various methodologies, including:
• Scrum – Uses fixed-length development cycles (sprints) with daily stand-up meetings.
• Kanban – Focuses on continuous delivery and visualizing work using boards.
• Extreme Programming (XP) – Emphasizes frequent releases and test-driven development (TDD). d. Benefits of Agile
Faster Time-to-Market – Frequent releases mean quicker product updates.
Increased Collaboration – Agile encourages cross-functional teamwork.
Higher Quality – Continuous testing improves software reliability.
Greater Flexibility – Agile makes it easier to adjust to new business needs.
6. How Microservices Support Agile Development
a. Microservices and Agile: A Perfect Match
Core Concept Agile is a modern software development philosophy that
prioritizes adaptability, collaboration, and continuous delivery. Instead of following
a rigid, linear development path, Agile promotes delivering software in small,
functional increments, allowing teams to respond quickly to changing requirements
and maintain high customer satisfaction.
b. Key Features of Microservices That Align with Agile Feature How It Supports Agile
Agile teams can focus on smaller, independent Modular Architecture
services instead of a large monolithic system.
Teams can release updates for one service without
Independent Deployment affecting the entire application.
Agile encourages teams with diverse skills; Cross-functional Teams
microservices let teams own specific services. lOMoAR cPSD| 58647650
Continuous Integration & Microservices enable rapid development and Deployment (CI/CD)
frequent releases, key goals of Agile.
Agile requires adaptability; microservices allow Scalability & Flexibility
easy scaling of different services.
c. How Agile Teams Work with Microservices
- Small, Autonomous Teams •
In an Agile-microservices environment, teams are structured around specific
services (e.g., an order management team, a payment team). •
Each team works independently, reducing interdependencies.
- Frequent Deployments with CI/CD •
Agile promotes frequent iterations; microservices facilitate continuous
integration and continuous deployment (CI/CD). •
Example: Amazon deploys code every 11.7 seconds using microservices
- Faster Development and Testing •
Each microservice is developed and tested individually, reducing the risk of widespread failures. •
Example: Netflix runs thousands of automated tests daily to ensure service stability.
- Microservices Encourage DevOps Culture •
Agile development often goes hand-in-hand with DevOps, where developers
and operations teams work together. •
Microservices help implement Infrastructure as Code (IaC), making
deployments faster and more reliable.
d. Challenges of Using Microservices with Agile •
Increased Complexity – Managing multiple services requires strong DevOps practices. •
Service Communication Issues – Requires well-defined APIs and message brokers. lOMoAR cPSD| 58647650 •
Testing Difficulties – Testing microservices in isolation and integration
requires robust test strategies.
7. Real-World Examples of Microservices in Agile Environments
• E-commerce Platform (e.g., Amazon, eBay)
• Agile Aspect: Teams work independently on shopping cart, payment, and recommendation services.
• Microservices Example: The order service is separate from the inventory
service, allowing updates to pricing without affecting transactions.
• Streaming Service (e.g., Netflix, Spotify)
• Agile Aspect: Continuous experimentation and A/B testing for personalized recommendations.
• Microservices Example: The content delivery service is independent from the
user profile service, allowing Netflix to scale based on demand.
• Ride-Sharing App (e.g., Uber, Grab)
• Agile Aspect: Frequent updates to driver and passenger experiences.
• Microservices Example: The ride-matching service is separate from the
payment service, ensuring reliability even if one service goes down. 8. Conclusion
The choice between monolithic and microservices architecture depends on
business needs, team expertise, and scalability requirements. While monolithic
architecture is suitable for small to medium applications, microservices offer
flexibility and scalability, making them ideal for large-scale, Agile-driven
development environments. By integrating microservices with Agile methodologies,
organizations can achieve faster development cycles, improved resilience, and better scalability. lOMoAR cPSD| 58647650
1.3 Decomposing a Software System into Microservices
a. Decomposing an E-commerce System Business Requirements
An e-commerce platform (like Amazon) needs:
✔ Product catalog management
✔ User authentication & profiles
✔ Shopping cart & checkout ✔ Order processing
✔ Payment gateway integration ✔ Inventory management
✔ Review & rating system
Microservices Breakdown Service Functionality User Service
Manages users, authentication, roles Product Service
Handles product catalog, categories, pricing Cart Service Stores items added by users Order Service
Manages order placement and tracking Payment Service
Integrates with payment gateways (PayPal, Stripe) Review Service
Manages product reviews and ratings Inventory Service Tracks stock availability Shipping Service
Handles order fulfillment and delivery lOMoAR cPSD| 58647650
b. Decomposing a Medicine System Business Requirements
A healthcare management system needs:
✔ Patient registration & records
✔ Doctor scheduling & appointments ✔ Prescription management ✔ Medical billing ✔ Pharmacy inventory
Microservices Breakdown Service Functionality Patient Service
Manages patient records, history Doctor Service
Stores doctor profiles, specializations Appointment Service
Handles scheduling and availability Prescription Service
Manages electronic prescriptions Billing Service
Handles invoices, payments, and insurance Pharmacy Service
Tracks drug inventory and orders lOMoAR cPSD| 58647650
c. Decomposing a Tourist Assistant System Business Requirements
A tourism assistant platform (like TripAdvisor) needs:
✔ User profile & authentication
✔ Destination search & recommendations
✔ Hotel & flight booking ✔ Itinerary planning
✔ Review & rating system
Microservices Breakdown Service Functionality User Service
Handles registration, authentication Destination Service Manages places, attractions Booking Service
Handles hotels, flights, tours Itinerary Service
Generates personalized travel plans Review Service Allows users to post feedback lOMoAR cPSD| 58647650
d. Decomposing a University Management System Business Requirements
A university system (like a digital campus) needs:
✔ Student enrollment & records ✔ Course management
✔ Faculty & staff profiles ✔ Timetable scheduling ✔ Examination & grading
Microservices Breakdown Service Functionality Student Service
Manages student data, enrollment Course Service
Stores course details, schedules Faculty Service
Handles instructor assignments Exam Service
Manages tests, grading, results Library Service
Manages books, borrowing, digital resources
e. Decomposing a Grab Car Management System Business Requirements
A ride-hailing service (like Uber or Grab) needs: lOMoAR cPSD| 58647650
✔ Driver & passenger profiles ✔ Ride matching ✔ Fare calculation ✔ Payment processing ✔ GPS tracking
Microservices Breakdown Service Functionality User Service Handles passenger accounts Driver Service
Stores driver profiles, licenses Ride Matching Service Assigns rides to drivers Pricing Service Calculates fares dynamically Payment Service
Processes transactions securely
1.4. Install python and Django (see guide below). Create PROJECT
tensinhvien_project1 and APPLICATION customer, cart and book
(Customer & Item Management in e-commerce)
1.5. Develop modules customer, cart, book in microservice with Django 1. Book lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 2. Cart