



















Preview text:
lOMoAR cPSD| 58647650
Họ và Tên: Nguyễn Hoàng Đăng Mã sinh viên: B21DCCN208
1.1 Why do we need to study Software Architecture and Design?
a. Building Strong Foundations
Imagine building a house. If you start without a plan and just put bricks anywhere,
you might end up with something that could collapse or doesn't meet your needs.
Software architecture is like the blueprint of a house—it helps you plan where
everything should go and how everything should connect before you start
building. This ensures the software is stable and can handle changes or growth over time.
b. Improving Communication
When many people are working on the same project, they need a clear plan to
follow. Good software architecture provides a common language for developers,
designers, and stakeholders. It's like a map that everyone can refer to, ensuring
that all team members understand the project's structure and goals. This helps
reduce confusion and mistakes, making the team more efficient. c. Enhancing Quality
Software needs to be reliable, fast, and easy to use. Architects look at the big
picture to ensure the software will perform well under different conditions and
meet users' needs. They think about how to make the software safe from errors or
security threats and how it will interact with other systems. It’s like making sure
your house has good locks, enough bathrooms, and won’t fall apart in a storm.
d. Making Changes Easier
Software often needs to change to add new features, fix problems, or adapt to
new technologies. A well-designed architecture makes it easier to change parts of
the software without breaking everything else. Think of it like having a Lego set; if
you want to change the design, you can just rearrange or replace some of the
blocks without having to start from scratch. lOMoAR cPSD| 58647650
e. Saving Time and Money
Spending time on designing architecture might seem slow at first, but it actually
saves time and money in the long run. When the architecture is clear and well-
planned, developers can build the software more quickly because they have fewer
problems to solve. It’s like taking a few minutes to organize your tools and
materials before you start a craft project—it might take a bit of time at the
beginning, but it makes the whole process smoother and faster.
f. Scalability and Performance
As more users start using the software, it needs to handle more data and more
simultaneous tasks without slowing down or crashing. Good architecture ensures
that the software can grow and perform well even as demand increases. This is
similar to planning a party; you need to make sure you have enough space, food,
and activities to handle the number of guests. g. Risk Reduction
One of the fundamental reasons to invest time in learning software architecture is
risk management. Complex software projects often involve significant
investments, not only in terms of money but also time and resources. A well-
thought-out architectural plan helps identify potential problems early in the
development process, such as integration issues, scalability limits, or technological
bottlenecks. By foreseeing these issues, you can mitigate them before they turn
into costly, time-consuming disasters.
For instance, imagine you’re planning a road trip across several countries.
By mapping out your route beforehand, you identify areas where roads might be
in poor condition or where traffic jams often occur. Knowing these risks ahead of
time, you can plan alternative routes or start at times when traffic is lighter, thus
avoiding delays and frustration. Similarly, good software architecture allows teams
to identify and manage risks early, ensuring the software is robust and reliable. lOMoAR cPSD| 58647650
h. Facilitating Technology Upgrades and Integration
In the rapidly evolving tech world, software needs to continuously integrate with
new technologies and systems. Learning SAD equips you with the ability to design
software in a way that it can easily adapt to new technologies and integrate with
other systems or software. Effective architecture divides the system into modules
with well-defined interfaces, making it simpler to upgrade individual components
without disrupting the entire system.
Imagine your software is like a smartphone. Over time, new apps come out that
you want to use. A well-designed smartphone allows you to download and
integrate these new apps seamlessly without needing to replace the phone itself.
In the same way, a well-architected software system can incorporate new features
or technologies smoothly, ensuring longevity and relevance in a changing environment.
By focusing on architecture and design, you learn to create systems that not only
meet current requirements but are also prepared for future challenges and
expansions. This knowledge empowers you to build more flexible, resilient, and
cost-effective software solutions. Thus, understanding SAD is not just about
making software work; it’s about
making it work well now and in the future, responding adeptly to both user needs and technological advances.
1.2 Monolithic and Microservice. Microservice and AGILE
Understanding Monolithic Architecture
What is Monolithic Architecture?
Monolithic architecture is a traditional software design pattern where all
components of the software are integrated into a single codebase. In this
architecture, components such as the database operations, business logic, and
user interface are tightly coupled and deployed as one unit. lOMoAR cPSD| 58647650
Characteristics of Monolithic Architecture
1. Unified Model: In a monolithic architecture, all components and
functionalities are managed as a single unit. This means that any action,
from input handling to database interactions, is processed within a single application environment.
2. Simplicity in Management: Having a single codebase makes it easier to
manage dependencies, deployment processes, and testing protocols. It’s
akin to managing a single team under one roof with one clear set of rules.
3. Consistent Development and Deployment Environment: Developers work
on the same platform, using the same stack of technologies and tools,
which can streamline development processes and reduce the learning curve for new team members.
Advantages of Monolithic Architecture
1. Ease of Development: When starting a new project, especially smaller ones,
monolithic architectures allow for quicker launches because all parts of the
application are developed in unison.
2. Simplicity in Deployment: Deployment involves managing just one package
or executable file, simplifying operations like continuous integration and delivery.
3. Performance Optimizations: Since all components reside in the same
memory space and on the same operating system, communication between
components can be highly efficient, leading to potentially better
performance for small to medium-sized applications.
Disadvantages of Monolithic Architecture
1. Scalability Issues: As the application grows, so does the complexity of
managing the entire system. Scaling specific functionalities can become
challenging, as the entire system needs to scale rather than just the parts that require more resources.
2. Difficulty in Adopting New Technologies: Due to its tightly coupled nature,
integrating new technologies or frameworks into a monolithic architecture lOMoAR cPSD| 58647650
can be cumbersome and risky, potentially requiring significant changes to the entire application.
3. Risk of Application Downtime: Updating a monolithic application often
means redeploying the entire platform, which can lead to downtime and
potential disruptions in service.
Ideal Use Cases for Monolithic Architecture
1. Small to Medium-sized Applications: For applications that don't require
extensive scalability and are manageable in size, a monolithic architecture often makes sense.
2. Simple Applications with Limited Scope: Projects with a clearly defined
scope that are unlikely to need significant modifications or scaling over time
can benefit from the monolithic approach.
3. Rapid Prototype Development: Startups and companies looking to quickly
develop and deploy a proof-of-concept to validate ideas might find
monolithic architecture advantageous due to its straightforward
deployment and development cycle. Understanding Microservices Architecture
What is Microservices Architecture?
Microservices architecture is a method of designing software applications as a
collection of loosely coupled services, where each service is responsible for a
unique feature or function within the application.
Characteristics of Microservices Architecture
1. Decentralization: Each service in a microservices architecture operates
independently. This decentralization allows for the individual components
to be developed, deployed, tested, and scaled independently.
2. Diversity of Technology Stack: Microservices can be built using different
programming languages and technology stacks, allowing developers to
choose the best tools for specific tasks within the application. lOMoAR cPSD| 58647650
3. Resilience: By distributing responsibilities across multiple services, systems
designed with microservices architecture can avoid single points of failure. If
one service fails, others can continue to operate.
Advantages of Microservices Architecture
1. Scalability: Services can be scaled independently, allowing for more precise
allocation of resources, which is particularly useful in handling varying loads.
2. Flexibility in Development and Maintenance: Teams can develop, update,
deploy, and scale different parts of an application without interfering with
the functionality of other services. This flexibility also facilitates continuous
integration and continuous delivery practices.
3. Enhanced Productivity: Smaller, focused teams can manage individual
services, leading to increased productivity and faster development cycles as
teams can work in parallel without waiting on one another.
Disadvantages of Microservices Architecture
1. Complexity in Management: The independence of services increases the
complexity of managing the application, including challenges related to data
integrity, transaction management, and inter-service communication.
2. Operational Overhead: Each service might require its own deployment
mechanism, monitoring setup, and database, which can increase the
operational cost and complexity.
3. Network Latency: Inter-service communication over networks can introduce
latency, potentially impacting the overall performance of the application.
Ideal Use Cases for Microservices Architecture
1. Large-scale Applications Requiring High Scalability: Applications that need
to scale rapidly or handle high loads at varying times are well-suited to
microservices because individual components can be scaled as needed.
2. Complex Applications with Multiple Business Capabilities: Large
enterprises with complex systems can benefit from microservices, as they
allow for flexible development and deployment strategies across different departments or teams. lOMoAR cPSD| 58647650
3. Organizations with Multiple Small Teams: Companies that prefer to assign
small, autonomous teams to work on different parts of an application will
find microservices architecture beneficial due to its support for
decentralized governance and development. Integration of
Microservices with Agile Methodologies
What is Agile Methodology?
Agile methodology is a project management and software development approach
that emphasizes flexibility, customer satisfaction, continuous improvement, and
high adaptability to change. Agile methodologies promote a disciplined project
management process that encourages frequent inspection and adaptation, a
leadership philosophy that encourages teamwork, self-organization and
accountability, a set of engineering best practices intended to allow for rapid
delivery of high-quality software, and a business approach that aligns
development with customer needs and company goals.
Synergy Between Microservices and Agile
1. Iterative Development: Agile methodologies focus on iterative
development, where requirements and solutions evolve through
collaboration. Microservices complement this by allowing individual
services to be developed and improved in short cycles, aligning with Agile’s
emphasis on iterative and incremental delivery.
2. Autonomy and Cross-functional Teams: Agile methodologies encourage
teams to be self-organizing and cross-functional; microservices architecture
supports this by enabling small teams to take full responsibility for specific
services from development to deployment.
3. Continuous Delivery and Deployment: Agile’s focus on continuous delivery
meshes well with microservices, which are conducive to being continuously
developed, released, and deployed independently. This enhances the ability
to rapidly introduce changes and improvements, minimizing the risk of disruptions. lOMoAR cPSD| 58647650
Challenges and Considerations
1. Complex Coordination: While microservices allow for decentralized control
and independent project progress, they require careful coordination and
communication to ensure consistency and alignment with overall project objectives.
2. Cultural Shift Required: Both microservices and Agile require a shift in
organizational culture towards embracing flexibility, autonomy, and
collaboration across teams. Companies must be prepared to invest in this
cultural shift to fully reap the benefits.
3. Technical and Process Adjustments: Adopting microservices within an Agile
framework may require changes to existing processes and tools, including
adopting new technologies for service deployment, monitoring, and communication. Conclusion
Understanding and applying Monolithic and Microservices architectures, along
with Agile methodologies, are crucial for developing software that is robust,
scalable, and aligned with business needs. By choosing the appropriate
architectural style and development methodology, teams can enhance their
productivity, adaptability, and ultimately, the success of their software projects.
This detailed exploration helps lay a solid foundation for beginners, providing
them with the necessary insights to make informed decisions in the complex field of software development. lOMoAR cPSD| 58647650 1.3
Decomposing an E-Commerce System into Microservices
In a microservices architecture, an e-commerce system is broken down into
independent, loosely coupled services, each responsible for a specific business
capability. This modular approach enhances scalability, maintainability, and
flexibility. Key Microservices in an E-Commerce System. 1. User Service
● Manages user registration, authentication, and profiles.
● Handles roles and permissions (admin,seller, buyer). ● Integrates
with OAuth and identity providers.
2. Product Catalog Service
● Manages product details, categories, inventory, and pricing.
● Supports search and filtering functionality.
● Interfaces with inventory and recommendation services. 3. Order Service
● Handles order creation, updates, and status tracking.
● Communicates with the cart, payment, and inventory services. ●
Supports order history and invoice generation. 4. Cart Service
● Manages users' shopping carts.
● Supports adding, updating, and removing items.
● Synchronizes with the product catalog and order service. 5. Payment Service
● Processes payments using third-party gateways (e.g., Stripe, PayPal).
● Manages transactions, refunds, and security compliance (PCI DSS). ●
Integrates with the order service to confirm payments. 6. Delivery Service
● Manages order fulfillment, delivery tracking, and shipment status.
● Communicates with third-party logistics providers. ● Sends real-
time delivery updates to customers.
7. Notification Service
● Sends emails, SMS, and push notifications for order updates, promotions, and alerts. lOMoAR cPSD| 58647650
● Supports customizable notification templates.
8. Review & Rating Service
● Manages customer reviews and product ratings. ● Includes
moderation and spam detection.
● Displays average ratings on the product catalog.
9. Recommendation Service
● Provides personalized product recommendations based on user behavior.
● Uses machine learning or rule-based algorithms. ● Enhances
user engagement and conversions. 10.Admin Service
● Provides a dashboard for managing users, products, orders, and reports.
● Offers analytics and business insights.
● Includes role-based access control (RBAC).
Decomposing a Medicine Management System into Microservices A Medicine
Management System in a microservices architecture consists of multiple
independent services, each handling a specific aspect of the system. This
structure enhances scalability, flexibility, and maintainability. 1. User Service
● Manages authentication, roles (doctor, pharmacist, patient, admin). lOMoAR cPSD| 58647650
● Stores user profiles and medical history
● Integrates with identity providers for secure access.
2. Medicine Catalog Service
● Manages details of medicines, dosage, manufacturers, and categories.
● Allows searching and filtering of medicines. ● Provides real- time stock availability.
3. Prescription Service
● Enables doctors to create, manage, and share prescriptions ●
Integrates with pharmacies for medicine fulfillment ● Ensures
compliance with medical regulations. 4. Order Service
● Manages medicine orders from patients or pharmacies.
● Tracks order status, processing, and delivery.
● Ensures secure transactions for online medicine purchases 5. Payment Service
● Handles transactions via multiple payment gateways ● Manages
insurance billing and reimbursements.
● Supports refunds and secure payment processing.
6. Pharmacy Management Service
● Manages inventory and stock levels for pharmacies ●
Tracks medicine expiration dates and availability. ● Notifies suppliers for restocking.
7. Notification Service
● Sends SMS, email, or app notifications for prescription refills, orders, and appointments.
● Alerts users about low stock and medicine recalls
8. Appointment & Consultation Service
● Schedules doctor appointments and virtual consultations
● Manages reminders and patient-doctor interactions
● Supports video consultations and chat features
9. Review & Rating Service
● Allows patients to review doctors, medicines, and pharmacies. lOMoAR cPSD| 58647650
● Ensures feedback moderation and spam detection
10. Analytics & Reporting Service
● Generates reports on medicine usage, sales, and patient health trends.
● Provides insights for healthcare providers and pharmacies.
Decomposing a Tourist Assistant System into Microservices
A Tourist Assistant System built using microservices architecture ensures
scalability, flexibility, and ease of maintenance. It consists of independent
services that handle various aspects of travel assistance, from itinerary planning
to real-time recommendations. Key Microservices in a Tourist Assistant System 1. User Service
● Manages user authentication, roles (traveler, guide, admin) ●
Stores user preferences, past trips, and profile details.
2. Destination & Attraction Service
● Provides information on tourist spots, hotels, restaurants, and cultural attractions.
● Supports search and filter functionalities based on user preferences
● Integrates with review platforms for real-time feedback
3. Itinerary Planning Service
● Helps users create, modify, and manage travel itineraries. lOMoAR cPSD| 58647650
● Suggests optimal routes and activities based on user interests. ●
Integrates with maps and transportation services. 4. Booking Service
● Manages hotel, flight, and activity reservations.
● Integrates with third-party booking platforms. ● Send confirmations and updates.
5. Navigation & Transportation Service
● Provides real-time public transport, ride-hailing, and car rental options.
● Suggests optimal routes based on live traffic and weather conditions.
6. Language & Translation Service
● Offers real-time translation for different languages
● Provides voice and text translation for traveler convenience.
7. Recommendation & AI Assistant Service
● Uses AI to suggest personalized attractions, restaurants, and activities.
● Provides real-time recommendations based on traveler behavior.
8. Weather & Alerts Service
● Delivers weather forecasts and emergency alerts
● Notifies travelers of any disruptions (e.g., storms, strikes, or safety warnings)
9. Payment & Currency Exchange Service
● Handles payments for bookings, activities, and purchases ●
Provides real-time currency exchange rates.
10. Social & Review Service
● Allows users to rate and review destinations, hotels, and restaurants.
● Supports travel blogging and experience sharing. lOMoAR cPSD| 58647650
Decomposing a University Management System into Microservices A University
Management System using a microservices architecture ensures scalability,
flexibility, and efficient management of different academic and administrative
processes. Each microservice is responsible for a specific functionality, ensuring
modularity and ease of maintenance.
Key Microservices in a University Management System 1. User Management Service
● Handles authentication, role-based access control (Admin, Student, Faculty, Staff).
● Manages user profiles and permissions
2. Student Information Service
● Stores Student personal details, academic records, and progress. ●
Provides course history, grades, and transcripts.
3. Faculty Management Service
● Maintains Faculty profiles, qualifications, and assigned courses. ● Tracks performance and feedback.
4. Course Management Service
● Manages course creation, modifications, and prerequisites.
● Allows faculty to upload syllabi, assignments, and learning materials. lOMoAR cPSD| 58647650
5. Enrollment & Registration Service
● Facilitates Student course enrollment and seat allocation. ●
Handles waitlists and drop/add course requests.
6. Timetable & Scheduling Service
● Generates class schedules, faculty assignments, and room bookings.
● Integrates with course registration to prevent scheduling conflicts
7. Attendance & Monitoring Service
● Tracks student and faculty attendance
● Integrates with RFID, biometric, or mobile app-based attendance systems.
8. Financial & Fee Management Service
● Handles tuition fees,scholarships, and financial aid
● Manages payroll for faculty and staff
9. Communication & Notification Service
● Sends notifications for deadlines, events, and announcements. ●
Integrates with email, SMS, and mobile push notifications.
10. Hostel & Accommodation Service
● Manages student hostel applications, room assignments, and facilities.
● Tracks maintenance requests and payments.
Decomposing a Grab Car Management System into Microservices A Grab
Car Management System built with microservices architecture ensures high lOMoAR cPSD| 58647650
availability, scalability, and modularity. Each microservice handles a specific
business function, enabling efficient ride-hailing operations
Key Microservices in a Grab Car Management System 1. User Management Services
● Handles user registration, authentication, and profile management (drivers & passengers).
● Manages user roles, preferences, and ratings.
2. Driver Management Service
● Stores driver details, background checks, and licensing information.
● Manages availability status, ride history, and ratings
3. Ride Matching & Dispatch Service
● Matches passengers with available drivers based on location, preferences, and pricing.
● Optimizes ride allocation using AI-based algorithms.
4. Location & Navigation Service
● Provides real-time GPS tracking of rides.
● Integrates with third-party map services (Google Maps, OpenStreetMap).
● Optimizes routes for efficiency
5. Fare Calculation & Payment Service
● Calculates fares based on distance, time, and dynamic pricing algorithms.
● Manages digital payments via credit cards, wallets, and cash.
● Handles refunds and promo codes
6. Trip History & Analytics Service
● Maintains ride history, receipts, and trip summaries
● Generates reports and insights for users, drivers, and admins.
7. Review & Rating Service
● Allows passengers and drivers to rate each other.
● Implements AI-based fraud detection to prevent fake reviews.
8. Fleet & Vehicle Management Service
● Tracks company-owned vehicles, maintenance, and insurance. ●
Ensures compliance with safety regulations.
9. Surge Pricing & Demand Forecasting Service
● Implements surge pricing based on real-time demand. lOMoAR cPSD| 58647650
● Uses AI/ML to predict peak hours and optimize pricing
10. Notification & Communication Service
● Sends SMS, push notifications, and in-app messages for ride updates.
● Manages ride confirmations, ETAs, and emergency alerts. 1.5 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650 lOMoAR cPSD| 58647650