Unit-3 Oose
Unit-3 Oose
Coupling and cohesion are fundamental concepts in software engineering related to the
relationships between different parts of a software system. They are crucial for
understanding the overall design and maintainability of the system.
Coupling:
• Represents the degree of interdependence between modules or components in a
system.
• High coupling indicates that modules are tightly linked and rely heavily on each other,
making them difficult to modify or reuse independently.
• Low coupling signifies modules are loosely connected and have minimal
dependencies, leading to improved modularity and maintainability.
• Aiming for low coupling is generally considered a good practice in software design.
Types of Coupling:
• Data coupling: Modules share data structures or primitive data types.
• Stamp coupling: Modules communicate through complex data structures containing
unrelated information.
• Control coupling: Modules control each other's execution flow.
• Common coupling: Modules share access to global data or resources.
• Content coupling: Modules share implementation details and algorithms. Cohesion:
• Represents the degree to which the elements within a module are related and
focused on a single purpose.
• High cohesion indicates that elements within a module are tightly related and
contribute to a single, well-defined function.
• Low cohesion suggests that elements within a module are loosely related and serve
multiple purposes, making the module less focused and more difficult to understand.
• Aiming for high cohesion is generally considered a good practice for creating
reusable and maintainable modules.
Types of Cohesion:
• Functional cohesion: All elements within a module contribute to a single, well-defined
function.
• Sequential cohesion: Elements within a module are related in a sequential order,
where the output of one element is the input for the next.
• Communicational cohesion: All elements within a module operate on the same data
structure.
• Procedural cohesion: Elements within a module follow a specific procedural flow.
• Temporal cohesion: Elements within a module are related by timing constraints or
events.
• Logical cohesion: Elements within a module are related by a general logical
relationship.
The Facade Design Pattern is a structural design pattern that simplifies the access to a
complex system by providing a single, unified interface. It acts as a gateway to the
underlying system, hiding its internal complexity and providing a more user-friendly interface
for clients.
It is used to hide the complexities of a system and present a unified and simplified interface
to the client or calling code. The Facade pattern is part of the Gang of Four design patterns
and promotes the principle of encapsulation.
Here are the key points about the Facade Design Pattern:
Intent:
• Provide a simplified interface to a complex system.
• Decouple the client from the internal implementation of the system.
• Make the system easier to use and maintain.
Structure:
• Facade: This is the single interface that clients use to interact with the system. It
delegates calls to the appropriate subsystem components.
• Subsystems: These are the individual components that make up the complex
system. They are hidden from the client by the facade.
Benefits:
• Simplified interface: Clients only need to interact with a single interface, which makes
the system easier to use.
• Reduced complexity: The facade hides the internal complexity of the system, making
it easier to understand and maintain.
• Decoupling: The client is decoupled from the implementation details of the system,
which makes it more flexible and adaptable.
• Improved maintainability: Changes to the internal implementation of the system can
be made without affecting the client code.
When to use the Facade Design Pattern:
• When you have a complex system with a large number of interfaces or classes.
• When you want to simplify the use of a system for clients.
• When you want to decouple the client from the implementation details of a system.
• When you want to create a layer of abstraction that can be used to control access to
the system.
1. **System Architect:**
- Defines the structure and organization of the components and their relationships.
2. **System Analyst:**
3. **Database Designer:**
- Designs the structure and organization of the database(s) within the system.
4. **Network Architect:**
- Defines the layout, protocols, and security measures for data transmission.
5. **UI/UX Designer:**
6. **Software Architect:**
- Focuses on the software aspects of the system.
7. **Security Architect:**
- Designs the security measures for the system to protect against threats.
- Defines testing strategies and plans to ensure the quality of the system.
- Identifies and manages testing activities throughout the development life cycle.
9. **Project Manager:**
- Manages the overall planning, coordination, and execution of the system design project.
1. **Sequential Execution:**
3. **Repetition (Loops):**
4. **Jump Statements:**
- Alter the normal flow of execution by jumping to a different part of the program.
- Examples include `goto` (though its use is generally discouraged), `break`, `continue`.
5. **Exception Handling:**
- Enables the program to respond to exceptional situations (e.g., errors) in a structured way.
6. **Subroutines (Functions/Procedures/Methods):**
- Encapsulate a set of instructions into a single unit, which can be called from various parts
of the program.
- Control flow transfers to the subroutine when it is called and returns after execution.
8. **State Machines:**
- Represent the system's behavior as a set of states and transitions between those states.
9. **Event-Driven Programming:**
10. **Coroutines:**
- Generalization of subroutines that allows multiple entry points for suspending and resuming
execution.
1. **Entities:**
- **Traffic Information:** Represents real-time data about road conditions and traffic.
2. **Relationships:**
- **User-Route:** Many-to-Many relationship indicating that a user can have multiple
saved routes, and a route can be used by multiple users.
- **Route-Location:** One-to-Many relationship indicating that a route consists of
multiple locations, and each location can be part of multiple routes.
- **Route-Vehicle:** One-to-One relationship indicating the specific vehicle
associated with a particular route.
- **Route-Traffic Information:** One-to-One relationship indicating the real-time traffic
information associated with a route.
3. **Key Functionalities:**
- **Route Planning:** The system should allow users to plan a route by selecting
starting and destination locations.
- **Optimization:** The system should optimize routes based on factors such as
shortest distance, fastest time, or avoiding traffic.
- **Saved Routes:** Enable users to save and manage their frequently used routes.
This illustration provides a high-level overview of the analysis model for a Route Planning
System, capturing the main entities, relationships, functionalities, and a couple of use case
scenarios. The actual model might be more detailed based on specific requirements and
system complexities.
Layers:
**Definition:**
Layers in system architecture refer to the logical separation of components or modules
based on their functionality. Each layer is responsible for a specific set of tasks and interacts
with adjacent layers in a well-defined manner. This separation promotes a modular design,
making it easier to understand, maintain, and update the system.
**Key Points:**
1. **Abstraction:** Each layer abstracts the complexity of the underlying layers, providing a
clear and distinct interface.
5. **Examples:**
- **Presentation Layer:** Handles user interface and interaction.
Partitions:
**Definition:**
Partitions, in the context of system architecture, refer to the physical or logical division of the
system into segments or partitions. Partitions help manage complexity by grouping related
components together, providing a clear boundary for different aspects of the system.
**Key Points:**
5. **Examples:**
Layers and partitions are often used together to create a comprehensive system
architecture. Each layer may span multiple partitions, and each partition may involve multiple
layers. The key is to strike a balance that optimizes the organization, maintainability, and
performance of the system.
In summary, layers define the functional aspects of a system, while partitions define the
physical or logical segmentation. Both concepts contribute to the overall design and
structure of a system, making it more scalable, maintainable, and adaptable to changes.
Here are key components and concepts associated with Deployment Diagrams:
Components:
1. **Node:**
- A node represents a physical or virtual device in the deployment diagram, such as a
server, desktop computer, laptop, or even a networked device.
- Nodes can be used to represent both hardware (e.g., servers) and software (e.g.,
runtime environments).
2. **Artifact:**
- An artifact represents a tangible piece of the system, such as a file, library, or executable.
It can be associated with a node, indicating where the specific artifact is deployed.
3. **Deployment Specification:**
- A deployment specification is a set of properties that can be assigned to an artifact,
specifying how it will be deployed on a node (e.g., configuration details, installation
instructions).
4. **Association:**
- Associations between nodes and artifacts indicate the relationships between them. For
example, an association line between a node and an artifact shows that the artifact is
deployed on that particular node.
5. **Dependency:**
- A dependency relationship between nodes or artifacts indicates that changes in one may
affect the other. For example, a dependency between a software component and a database
server indicates that changes in the software may affect the database.
Concepts:
1. **Node Instances:**
- Nodes can have instances, representing multiple instances of the same node. This is
particularly useful when dealing with distributed systems and multiple instances of a server
or a runtime environment.
2. **Communication Paths:**
- Communication paths between nodes represent the connections and communication
channels between physical or virtual devices. These paths show how nodes interact with
each other.
3. **Deployment Environment:**
- Deployment diagrams can also include information about the deployment environment,
such as development, testing, or production environments. This helps in visualizing how
the system transitions across different stages.
Example:
Deployment diagrams are valuable for system architects, developers, and other stakeholders
to understand the physical deployment of software components and their interactions in a
real-world environment. They provide insights into the distribution of hardware and software
resources, helping in planning, optimization, and troubleshooting.
1. Introduction
Purpose
The purpose of the Online Shopping System is to provide a convenient and user-friendly
platform for customers to browse, select, and purchase products online.
Scope
The system will include user registration, product catalog, shopping cart functionality, order
processing, and user account management.
2. System Architecture
Overview
- **Data Layer:** Database for storing product information, user data, and orders.
Technologies
- Frontend: HTML5, CSS3, JavaScript, React.js
- Database: MySQL
3. Database Design
Database Schema
- **Users Table:**
- Username
- Password
- **Products Table:**
- ProductName
- Price
- StockQuantity
- **Orders Table:**
- Quantity
- TotalAmount
4. System Modules
User Management
- User registration and authentication.
Shopping Cart
Order Processing
- Confirming orders.
5. Security
Authentication
Authorization
6. Data Flow
7. System Interfaces
User Interface
API Interfaces
8. Testing Strategy
Unit Testing
Integration Testing
9. Deployment
Deployment Environment
Deployment Procedure
Bug Tracking
a) Identifying Services:
**Definition:**
Identifying services is a crucial system design activity that involves determining the functional
components or units of work that the system provides. Services represent distinct
functionalities or operations that the system offers to its users or other systems.
**Key Activities:**
1. **Requirement Analysis:**
- Understand and analyze the system requirements to identify the core functionalities
expected by the users.
2. **Decomposition:**
- Break down the overall system into smaller, manageable units or services. These could
be features, processes, or operations.
3. **Use-Case Analysis:**
- Consider use cases and scenarios to identify the services required to fulfill specific user
interactions or business processes.
4. **Stakeholder Collaboration:**
- Collaborate with stakeholders, including end-users and domain experts, to gather insights
and validate the identified services.
5. **Prioritization:**
- Prioritize services based on their importance to the overall system and the value they
provide to users or stakeholders.
6. **Service Definition:**
- Clearly define each service, outlining its inputs, outputs, dependencies, and any specific
requirements.
• Improved modularity: Breaking down the system into smaller services makes it easier
to understand, develop, and maintain.
• Increased scalability: Services can be scaled independently to meet changing needs.
• Enhanced fault tolerance: Failures in one service are less likely to impact other
services.
• Promotes loose coupling: Services communicate through well-defined interfaces,
reducing dependencies between them.
**Definition:**
Reviewing the system design model involves a comprehensive assessment of the design
documentation, diagrams, and other artifacts created during the system design phase. The
goal is to ensure that the design aligns with the requirements, follows best practices, and is
suitable for implementation.
**Key Activities:**
1. **Document Inspection:**
- Review design documents, including architecture diagrams, data models, and interface
specifications, to ensure clarity, completeness, and accuracy.
2. **Consistency Check:**
- Verify that the system design is consistent with the requirements specified in earlier
phases, addressing any inconsistencies or discrepancies.
4. **Feasibility Assessment:**
- Assess the feasibility of implementing the design, considering factors such as technology
constraints, resource availability, and project timelines.
5. **Risk Identification:**
- Identify and evaluate potential risks associated with the design, including dependencies,
integration points, and potential points of failure.
6. **Performance Considerations:**
- Evaluate the design from a performance perspective, considering factors such as
scalability, response times, and resource utilization.
• Reduces risks: Identifying and addressing potential problems early in the design
process can save time and money in the long run.
• Improves quality: A well-reviewed design is more likely to be reliable, secure, and
maintainable.
• Increases stakeholder confidence: Reviewing the design with stakeholders can help
to build trust and ensure everyone is on the same page.
Outcome: The outcome of reviewing the system design model is a set of insights and
recommendations for improving the design before moving to the implementation phase. It
helps in ensuring the quality and effectiveness of the design, reducing the likelihood of
issues during development and deployment.
2. Client-Server Style:
• Description: This style involves two types of components: clients and servers. Clients
initiate requests for services from servers, which process the requests and return
responses.
• Benefits: Promotes scalability and resource sharing. Clients can be easily distributed
across different locations. Improves fault tolerance as server failures affect only
specific clients.
• Drawbacks: Requires careful design of communication protocols between clients and
servers. Centralized servers can become bottlenecks if overloaded.
• Example: Web applications with web browsers as clients and web servers as servers.
3. Event-Driven Style:
• Description: This style focuses on communication through events. Components
communicate by subscribing to events and publishing events to notify other
components of changes.
• Benefits: Highly responsive and efficient for systems with dynamic interactions and
complex event flows. Decouples components, making them more resilient to
changes.
• Drawbacks: Requires careful design to avoid race conditions and ensure proper
event handling. Debugging event-driven systems can be challenging.
• Example: Real-time chat applications where users publish messages as events and
other users subscribe to receive those messages.
4. Microservices Style:
• Description: This style decomposes the system into small, independent services that
are deployed and managed individually. Services communicate through well-defined
APIs.
• Benefits: Highly scalable and flexible, allowing for independent development and
deployment of services. Promotes loose coupling and facilitates technology diversity.
• Drawbacks: Increased complexity due to distributed nature and potential for
communication overhead. Requires robust service management and monitoring
practices.
• Example: E-commerce platforms where separate services handle product
management, shopping cart, payment processing, and order fulfillment.
5. Data-Centric Style:
• Description: This style focuses on data as the central element of the system. The
architecture revolves around managing and accessing data efficiently.
• Benefits: Simplifies data management and access, making it suitable for
dataintensive applications. Provides a clear understanding of data flow and
relationships.
• Drawbacks: Requires careful data modeling and normalization to avoid performance
bottlenecks. Can lead to complex data access logic if not designed correctly.
• Example: Data warehouse systems where the focus is on storing, processing, and
analyzing large amounts of data.
• Benefits: Easier to maintain and debug as all code resides in a single location,
simplifying troubleshooting and updates.
• Drawbacks: Failure in any part of the application can bring down the entire system,
leading to significant downtime.
• Example: Traditional web applications built with a single programming language and
framework.
Design goals in the context of software and system design refer to the desired outcomes and
attributes that a well-designed system should exhibit. These goals guide the decision-making
process during the design phase and help ensure that the resulting system meets specific
criteria. Here is a list of common design goals:
1. **Scalability:**
- **Goal:** The ability of the system to handle growing amounts of work by adding resources
or distributing the load.
- **Importance:** Crucial for systems expecting an increase in users, data, or transactions.
2. **Reliability:**
- **Goal:** The system should consistently perform its intended functions without
failures or errors.
- **Importance:** Essential for systems where downtime or errors could have
significant consequences.
3. **Maintainability:**
- **Goal:** The ease with which the system can be modified, updated, and enhanced
over time.
- **Importance:** Reduces the cost and effort required for ongoing development and
support.
4. **Flexibility:**
- **Goal:** The system's ability to adapt to changes in requirements without major redesign.
- **Importance:** Supports evolving business needs and technology advancements.
5. **Usability:**
- **Goal:** The system should be easy to understand, learn, and use by its intended users.
- **Importance:** Enhances user satisfaction, productivity, and reduces the learning curve.
6. **Performance:**
- **Goal:** The system should respond promptly and efficiently to user interactions and
requests.
- **Importance:** Critical for delivering a positive user experience and meeting service
level agreements.
7. **Security:**
- **Goal:** Protecting the system from unauthorized access, data breaches, and ensuring
data integrity.
- **Importance:** Crucial for safeguarding sensitive information and maintaining user trust.
8. **Interoperability:**
- **Goal:** The ability of the system to interact and operate seamlessly with other
external systems or components.
- **Importance:** Necessary for integration with third-party services and achieving a
connected ecosystem.
9. **Portability:**
- **Goal:** The ease with which the system can be transferred or adapted to different
environments or platforms.
- **Importance:** Enables deployment across various hardware and software
configurations.
10. **Efficiency:**
- **Goal:** Optimizing resource utilization (CPU, memory, network) to ensure efficient system
operation.
- **Importance:** Reduces operational costs and ensures optimal performance.
11. **Maintainability:**
- **Goal:** The system should be designed in a way that facilitates easy maintenance,
troubleshooting, and debugging.
- **Importance:** Reduces downtime and makes it easier for development teams to
address issues.
12. **Testability:**
- **Goal:** Design the system in a way that facilitates effective testing of its
components and features.
- **Importance:** Simplifies the identification and resolution of defects during
development and maintenance.
13. **Cost-Effectiveness:**
- **Goal:** Optimize the design to achieve the desired functionality while minimizing
development and operational costs.
- **Importance:** Ensures that the benefits of the system outweigh its costs.
14. **Adaptability:**
- **Goal:** The ability of the system to evolve and adapt to changes in technology, business
processes, and user requirements.
- **Importance:** Supports long-term sustainability and relevance.
15. **Simplicity:**
- **Goal:** Design the system in a simple and straightforward manner, avoiding
unnecessary complexity.
- **Importance:** Enhances understandability, reduces development time, and
minimizes the potential for errors.
These design goals are often interconnected, and achieving a balance among them is crucial
for creating a well-rounded, effective system. The specific emphasis on each goal may vary
depending on the nature of the project, its requirements, and the priorities of stakeholders.
1. **Performance Limits:**
- **Description:** Constraints on system performance, such as response time,
throughput, and resource utilization.
- **Example:** The system must respond to user requests within two seconds under
peak load conditions.
2. **Scalability Limits:**
- **Description:** Constraints related to the system's ability to scale in terms of users,
transactions, or data volume.
- **Example:** The system should support a 20% annual increase in user base without
significant degradation in performance.
3. **Security Requirements:**
- **Description:** Conditions related to the protection of sensitive data and prevention
of unauthorized access.
- **Example:** The system must comply with industry standards for data encryption,
and access to certain features is restricted based on user roles.
4. **Regulatory Compliance:**
- **Description:** Conditions imposed by legal or regulatory standards that the system
must adhere to.
- **Example:** The system must comply with data protection regulations such as
GDPR or HIPAA.
5. **Technology Constraints:**
- **Description:** Limitations imposed by the technology stack, tools, or platforms used
in the system.
- **Example:** The system must be compatible with browsers X, Y, and Z, and the
database must be MySQL version 8.0.
6. **Data Integrity:**
- **Description:** Conditions ensuring the accuracy, consistency, and reliability of data
stored and processed by the system.
- **Example:** The system must implement data validation checks to prevent the entry
of inconsistent or erroneous data.
7. **Availability Requirements:**
- **Description:** Constraints related to the system's availability and uptime. -
**Example:** The system must be available 99.9% of the time, excluding planned
maintenance periods.
8. **Interoperability Constraints:**
- **Description:** Requirements for the system to interact seamlessly with other
external systems or components.
- **Example:** The system must be able to integrate with third-party payment
gateways and APIs.
9. **Budgetary Limits:**
- **Description:** Constraints related to the financial resources available for system
development, deployment, and maintenance.
- **Example:** The total project cost should not exceed $X, including development,
testing, and infrastructure expenses.
• Improved Robustness: By considering edge cases and potential failures, the system
can be designed to handle them gracefully and minimize downtime.
• Enhanced Security: Identifying and addressing security vulnerabilities early in the
design process can help to prevent attacks and data breaches.
• Increased Scalability: Carefully considering resource management and performance
limitations allows the system to be designed for future growth and scalability.
• Better User Experience: Addressing error handling and user input validation can lead
to a more positive and intuitive user experience.
• Reduced Development Costs: Identifying and addressing boundary conditions
upfront can save time and money during development and testing.