OOMD-CourseMaterial_f0b00fda685f42d22366e3cbbe7fd81c
OOMD-CourseMaterial_f0b00fda685f42d22366e3cbbe7fd81c
On
Module-1
The Unified Modeling Language (UML) is a standardized visual language designed for
modeling the structure and behavior of software systems. It provides a comprehensive set of
diagrams and notation techniques to facilitate the visualization, specification, construction,
and documentation of software artifacts.
Models are abstractions that focus on essential aspects of reality while omitting or
simplifying less critical details. This simplification allows individuals to analyze, study,
and make decisions about complex systems without being overwhelmed by their full
complexity.
Why do we model?
“We build models so that we can better understand the system we are developing.”
Why do we model the large and complex systems?
“We build models of complex systems because we cannot comprehend such a system in its
entirety.”
No process dependent
➢ Building blocks of the UML: The vocabulary of the UML encompasses three kinds
of building:Things, Relationships and Diagrams.
Collaboration: Collaboration defines an interaction and is a society of roles and other
elements that work together to provide some cooperative behavior that's bigger than the
sum of all the elements. Therefore, collaborations have structural, as well as behavioral,
dimensions. A given class might participate in several collaborations.
Use case: Use case represents a set of actions performed by a system for a specific goal. A
use case is used to structure the behavioral things in a model
ii. Behavioral things: A behavioral thing consists of the dynamic parts of UML models.
Following are the behavioral things:
Visual Paradigm is a software tool designed for software development teams to model
business information system and manage development processes. Visual Paradigm supports
key industry modeling languages and standards such as Unified Modeling Language (UML),
SoaML, BPMN, XMI, etc.
Perform the steps below to create a UML diagram in Visual Paradigm.
3. Click Next.
4. Enter the diagram name and description. The Location field enables you to select a
model to store the diagram.
5. Click OK.
Class
• A class is a description of a set of objects that share the same attributes, operations,
relationships, and semantics.
• A class implements one or more interfaces.
• The UML provides a graphical representation of class
Names
Every class must have a name that distinguishes it from other classes.
A name is a textual string that name alone is known as a simple name;
a path name is the class name prefixed by the name of the package in which that class lives.
Simple Name Path Name
Attributes
At the other extreme, the things you model may be drawn directly from the programming
language you are using to implement a solution.
Typically, these abstractions involve primitive types, such as integers, characters, strings,
and even enumeration types
To model primitive types
Relationships
Dependencies
Generalization
Generalization
Association
Role
Multiplicity
Aggregation
Structural Relationships
Common Mechanisms
Stereotypes
Tagged Values
Constraints
A constraint specifies conditions that must be held true for the model to be well-formed.
A constraint is rendered as a string enclosed by brackets and placed near the associated
element
Graphically, a constraint is rendered as a string enclosed by brackets and placed near the
associated element or connected to that element or elements by dependency relationships.
Diagram
Common Modeling Techniques
o If your diagram is still complex, print it in its entirety and hang it on a convenient large
wall. You lose the interactivity an online version of the diagram brings, but you can
step back from the diagram and study it for common patterns.
Module-2
Advanced Classes
Advanced classes in UML (Unified Modeling Language) encompass more complex features and
relationships than the basic class diagrams. They help in modeling sophisticated systems with
intricate structures and interactions. Here’s an overview of advanced class modeling concepts
in UML:
Generalization:
• Notation: An arrow with a hollow triangle pointing from the subclass to the superclass.
• Example: A Vehicle class might be generalized into Car and Truck subclasses.
Specialization:
• Definition: The process of creating a subclass that extends or refines the behavior of
a superclass.
Use Case: Use generalization to define common features in a superclass and specific features
in subclasses, reducing redundancy and promoting reuse.
2. Realization
Definition:
Notation:
• An arrow with a dashed line and a hollow triangle pointing from the implementing class
to the interface.
Example: If you have an interface Drawable with methods like draw(), a class Circle that
implements this interface will show a realization relationship to Drawable.
Use Case: Use realization to define how classes implement the behavior specified by
interfaces, ensuring a consistent contract across different implementations.
3. Dependency
Definition:
Notation:
• A dashed arrow pointing from the dependent class to the class it depends on.
Example: A Printer class might depend on a Paper class to perform printing operations.
Use Case: Use dependency to show how classes interact or rely on each other, highlighting
areas where changes may have ripple effects.
Aggregation:
• Notation: A diamond at the end of the association line near the whole class.
• Example: A Library class and a Book class, where a library contains books but books
can exist independently.
Composition:
• Definition: Represents a strong whole-part relationship where the part cannot exist
independently of the whole. It indicates a stronger relationship than aggregation.
• Notation: A filled diamond at the end of the association line near the whole class.
• Example: A House class and a Room class, where rooms cannot exist independently
of a house.
Use Case: Use aggregation for loosely coupled whole-part relationships and composition for
tightly coupled whole-part relationships where the lifecycle of the part is tied to the whole.
5. Association Classes
Definition:
• A class that represents an association between two or more classes. It allows you to
add attributes and methods to the association itself.
Notation:
Example: A Student and Course association with an association class Enrollment that holds
additional information like grade and enrollmentDate.
Use Case: Use association classes to model complex relationships that require additional
information or behavior beyond a simple association.
Multiplicity:
• Definition: Specifies the number of instances of a class that can be associated with
an instance of another class.
• Notation: Numbers or ranges at the ends of association lines (e.g., 1, 0..*, 1..5).
Role Names:
• Definition: Descriptive names for the roles that classes play in associations, helping
to clarify the purpose of the association.
Example: In an association between Author and Book, multiplicity might show that an author
can write multiple books (e.g., 1..*), and a book can have multiple authors (e.g., 0..*). Role
names like writes and authoredBy clarify the association.
Use Case: Use multiplicity to define the number of allowed relationships and role names to
describe the nature of these relationships.
Interfaces:
• Definition: Define a contract that classes must adhere to. Interfaces specify methods
without implementing them.
• Notation: Represented as a rectangle with the <<interface>> stereotype or as a
circle with the interface name.
Abstract Classes:
• Definition: Classes that cannot be instantiated and are used to provide common base
functionality for subclasses. They can have abstract methods (without implementation)
and concrete methods (with implementation).
Example: An interface Shape with methods draw() and resize(), and an abstract class
Polygon with some concrete methods and abstract methods like calculateArea().
Use Case: Use interfaces to define common behavior across disparate classes and abstract
classes to provide shared functionality and a base for other classes.
8. Nested Classes
Definition:
• Classes defined within the scope of another class. They can be used to group related
classes and manage complexity.
Notation:
Example: A Bank class with a nested Account class that models different types of accounts.
Use Case: Use nested classes to logically group related classes and encapsulate them within
the context of another class.
9. Class Stereotypes
Definition:
• Stereotypes provide additional semantics to UML elements. They extend the basic UML
model with domain-specific concepts.
Notation:
Use Case: Use stereotypes to add domain-specific meanings to classes, enhancing the
expressiveness of your UML model.
• Refers to capturing how classes change and interact over time, including their state
changes and interactions during runtime.
Notation:
• Includes dynamic diagrams such as sequence and state diagrams linked with class
diagrams.
Example: A User class with methods that change state based on user actions and
interactions, illustrated through state diagrams and sequence diagrams.
Use Case: Use dynamic class modeling to represent and understand how classes interact and
evolve during system operation.
Advanced Relationships
* There are two stereotypes that apply to dependency relationships among packages.
* Two stereotypes apply to dependency relationships among use cases:
16 send Specifies that the source operation sends the target event
* We'll use trace when you want to model the relationships among elements in different
models
Common Modeling Techniques
1. When you model the vocabulary of a complex system, you may encounter dozens, if not
hundreds or thousands, of classes, interfaces, components, nodes, and use cases.
2. Establishing a crisp boundary around each of these abstractions is hard
3. This requires you to form a balanced distribution of responsibilities in the system as a
whole, with individual abstractions that are tightly cohesive and with relationships that
are expressive, yet loosely coupled
Names
• Every interface must have a name that distinguishes it from other interfaces.
• A name is a textual string. That name alone is known as a simple name;
• A path name is the interface name prefixed by the name of the package
Operations
Common Modeling Techniques
Class Diagrams
Modeling Techniques:
o Class Diagram vs. ERD: While class diagrams are more about object-oriented
design, ERDs focus on database structure. However, both diagrams help in
structuring data and relationships.
Object Diagrams
Introduction:
• Purpose: Useful for illustrating the static structure of a system or showing how objects
interact at a given point in time.
MODULE -III
Interactions
Messages
Flat Sequence
Flow of Control by Time
Modeling the context of a system involves drawing a line around the whole system and
asserting which actors lie outside the system and interact with it.Here, you'll apply use case
diagrams to specify the actors and the meaning of their roles.
Modeling the requirements of a system involves specifying what that system should do
(from a point of view of outside the system), independent of how that system should do it.
Here, you'll apply use case diagrams to specify the desired behavior of the system.
Modeling the Context of a System
In the context of system modeling, events and signals are crucial concepts for capturing and
managing dynamic behaviors and interactions. Here’s a detailed look at these concepts,
including modeling a family of signals and handling exceptions.
1. Events:
• Characteristics:
o Types of Events:
2. Signals:
• Definition: A signal is a specific type of event that carries information or data from
one object or component to another. It is a communication mechanism used to notify
or alert an object about some occurrence or change.
• Characteristics:
o Signal Receiver: The object or component that receives and processes the
signal.
o Signal Name: The name or identifier of the signal, which represents the type
of communication or data being conveyed.
• Definition: A family of signals refers to a group of related signals that share common
characteristics or serve a similar purpose. Modeling a family of signals involves
organizing and defining these signals in a way that reflects their relationships and
variations.
• Techniques:
o Signal Classification: Categorize signals based on their types, purposes, or
sources. For example, you might classify signals into error signals, status
update signals, or control signals.
Exceptions
1. Exceptions:
• Characteristics:
2. Modeling Exceptions:
• Purpose: To represent potential error conditions and the mechanisms for handling
them within the system.
• Techniques:
State machines are a fundamental concept in modeling the behavior of systems and objects
by defining their states, transitions, and the events that trigger these transitions. They are
particularly useful for modeling the lifetime of an object, illustrating how an object moves
through different states over time. Here’s a detailed overview:
State Machines
1. State Machines:
• Definition: A state machine is a model that describes the behavior of an object or
system in terms of its states, transitions between states, and the events that trigger
these transitions.
• Components:
o Initial State: The starting state of the object when it is created or initialized.
o Final State: The state indicating the end of the object's lifecycle.
• Lifecycle: Represents the sequence of states through which an object passes from
creation to termination.
1. State Diagram:
• Purpose: Illustrates the different states an object can be in and how it transitions
between these states.
• Elements:
o Transitions: Arrows between states indicating the movement from one state
to another.
o Actions: Activities that occur during state transitions or while in a state, often
noted near the transitions.
o Transitions:
• Definition: A state machine where states can contain other states, allowing for a more
detailed and organized representation of complex behaviors.
• Purpose: To model complex objects that have nested states or sub-states, improving
clarity and manageability.
• State Machine Diagram: Focuses on the states and transitions of an object and is
particularly useful for modeling object lifecycles.
• Activity Diagram: Focuses on the flow of activities or actions and can be used to
represent workflows. It’s more about the flow of control rather than object states.
5. UML Notation:
• Transition: Represented by an arrow from one state to another, often labeled with
the event that triggers the transition.
Processes
1. Definition:
2. Key Characteristics:
• Isolation: Each process runs in its own memory space and is isolated from other
processes. This ensures that processes do not interfere with each other's memory or
resources.
• Context: A process maintains its own execution context, including its own stack, heap,
and registers.
• Creation and Termination: Processes are created by the operating system through
system calls (e.g., fork in Unix-like systems). They can terminate by completing their
execution or by being terminated by other processes or the operating system.
3. Process Management:
• Process States: Processes typically go through several states, including New, Ready,
Running, Waiting, and Terminated.
Threads
1. Definition:
• A thread is the smallest unit of execution within a process. Threads within the same
process share the same memory space and resources, but each thread has its own
execution stack and program counter.
2. Key Characteristics:
• Concurrency: Multiple threads within the same process can run concurrently,
enabling parallel execution of tasks.
• Context Switching: Threads within the same process share the same context, which
can make context switching between threads faster compared to switching between
processes.
3. Thread Management:
• Creation and Termination: Threads are created within a process by thread libraries
or APIs (e.g., POSIX threads, Java threads). They can terminate by completing their
execution or being explicitly terminated.
• Thread Scheduling: The operating system or thread library schedules threads within
a process, determining how and when threads are executed.
• Isolation:
o Processes: Have separate memory spaces and are isolated from each other.
o Threads: Share the same memory space within a process and can directly
access shared data.
• Overhead:
• Communication:
• Fault Tolerance:
o Threads: Failures in one thread can potentially impact other threads in the
same process due to shared resources.
Use Cases
• Processes:
o Useful for security and fault isolation, as failures in one process are less likely
to impact others.
• Threads:
o Ideal for tasks that require concurrent execution within the same application
(e.g., handling multiple client requests in a web server).
1. Time Constraints:
• Definition: Time constraints specify the timing requirements for various operations
and interactions within a system. These constraints can include deadlines, periodic
tasks, response times, and latency.
o Latency: The delay between the initiation of an action and its effect.
o Storage Requirements: The amount of disk space required for data storage.
• Timing Diagrams: Used to show the behavior of objects over time, including state
changes and interactions. Timing diagrams represent time on the horizontal axis and
events or states on the vertical axis.
• Formal Verification: Use formal methods and tools to verify that timing constraints
are met. These methods can help analyze and ensure that the system behaves
correctly under timing constraints.
Distribution of Objects
1. Distributed Systems:
1. Object Migration:
• Definition: Refers to the movement of objects from one location or server to another
within a distributed system. Migration can be for load balancing, fault tolerance, or
resource optimization.
• Types of Migration:
• State Diagrams: Show how the state of an object changes during migration, including
any transitions or interactions required for the migration process.
• Deployment Diagrams: Illustrate how objects are distributed across nodes and how
migration affects their placement.
• Consistency: Ensuring that the object's state remains consistent before and after
migration.
• Reactivation: Restoring the object's functionality and state after migration to ensure
seamless operation.
State chart diagrams (also known as state diagrams or state machine diagrams) are a key
tool in modeling the behavior of reactive objects in software systems. They help illustrate how
objects respond to various events by transitioning between different states. Here’s a detailed
overview of state chart diagrams, their use in modeling reactive objects, and the processes
of forward and reverse engineering.
1. Definition:
• State Chart Diagram: A graphical representation that depicts the states an object or
system can be in, the transitions between these states, and the events that trigger
these transitions. It shows the dynamic behavior of the object in response to events.
2. Components:
• Transitions: Arrows connecting states, indicating how an object moves from one state
to another, typically triggered by events.
• Events: Triggers for transitions, such as user actions, messages, or other stimuli.
• Actions: Activities that occur as a result of a transition or while in a state, often noted
alongside transitions.
• Initial State: Denoted by a filled circle, representing the starting point of the object's
lifecycle.
• Final State: Represented by a filled circle within a larger circle, marking the end of
the object's lifecycle.
1. Reactive Objects:
• Identify States: Determine the different states an object can be in based on its
behavior and requirements.
• Define Events: Identify the events that cause state changes, such as user
interactions, system signals, or other triggers.
• Map Transitions: Draw transitions between states to show how the object moves
from one state to another in response to events.
• Detail Actions: Specify any actions or activities that occur as part of state transitions
or while the object is in a particular state.
3. Example:
o Transitions:
1. Forward Engineering:
• Code Generation: Use tools or frameworks that can automatically generate code from
state chart diagrams. This involves translating states, transitions, and actions into
programming constructs such as classes, methods, and event handlers.
3. Reverse Engineering:
• Definition: The process of creating models or diagrams from existing code or systems.
In the context of state chart diagrams, reverse engineering involves analyzing existing
code to create or update state diagrams.
• Code Analysis: Examine the source code to identify the states, transitions, and events
used in the system. Tools or manual analysis can be used to infer the state machine
from the code.
• Model Extraction: Use reverse engineering tools that can generate state chart
diagrams from existing codebases, helping to visualize and understand the system's
behavior.
• UML Tools: Software tools like Enterprise Architect, Visual Paradigm, or IBM Rational
Rose can assist in both forward and reverse engineering by providing features for
generating state diagrams from code and vice versa.
• Manual Methods: In cases where automated tools are not available, manual
extraction and modeling may be necessary, involving detailed code review and
diagram creation.
MODULE -V
ARCHITECTURAL MODELING
Component Modeling
• Interface: A contract that defines the services a component offers and expects. It
includes the methods or operations that other components can use.
• Deployment: The process of placing components into an environment where they can
interact and execute.
2. Modeling Components:
1. Executables:
• Definition: Files or programs that can be executed by a computer, such as .exe files
on Windows or binary files on Unix-like systems.
• Modeling Executables:
• Modeling Libraries:
Modeling Tables
1. Tables:
• Modeling Tables:
1. Files:
• Modeling Files:
2. Documents:
• Definition: Files that contain formatted text, images, or other content, such as
reports, user manuals, or configuration files.
• Modeling Documents:
o Data Flow Diagrams (DFD): Show how documents flow through the system,
including creation, processing, and storage.
• Definition: A set of rules and tools for building software applications. An API defines
how different software components should interact and can include functions,
procedures, and protocols.
2. Modeling APIs:
• Interface Diagrams: Depict the functions and methods exposed by the API, including
the input and output parameters.
o Sequence Diagrams: Show how API calls are made between components or
systems, illustrating the flow of messages and interactions.
• UML Tools: Use tools like Enterprise Architect or Visual Paradigm to create detailed
component diagrams and deployment diagrams.
Deployment and component diagrams are vital for understanding and designing how software
components are distributed and interact across different physical and logical environments.
They help in modeling the architecture of a system, including how components are deployed
and how they interact. Here’s an in-depth look at these concepts:
Deployment Diagrams
• Nodes: Physical elements that can host software components, such as servers,
desktops, or mobile devices. Nodes are depicted as 3D boxes.
• Artifacts: Physical pieces of software that are deployed on nodes. Artifacts include
executables, libraries, and databases.
4. Example:
Component Diagrams
• Component Diagram: Can be used to illustrate how different software modules (e.g.,
executables, libraries) are released and deployed.
• Component Diagram: Can be used to model systems that need to adapt to changing
environments or requirements.
Forward Engineering:
• Techniques:
Reverse Engineering:
• Techniques:
Deployment diagrams are a powerful tool in UML (Unified Modeling Language) for visualizing
the physical distribution of software components across hardware nodes and their
interactions. They help model various types of systems, including embedded systems,
client/server systems, and fully distributed systems. They also play a crucial role in forward
and reverse engineering processes.
Deployment Diagrams
Embedded System:
Modeling Techniques:
• Nodes: Represent the hardware components such as microcontrollers, sensors, and
actuators.
Example:
Client/Server System:
• Definition: A system architecture where clients request services from servers, which
process the requests and return the results. This model is common in web applications,
databases, and network services.
Modeling Techniques:
• Nodes: Represent servers (e.g., web servers, application servers) and clients (e.g.,
user workstations, mobile devices).
Example:
o Nodes: Web server, application server, email server, client devices (e.g.,
desktops, smartphones).
o Connections: HTTP connections between clients and the web server, SMTP
connections between the email server and clients.
• Definition: A system where components are spread across multiple networked nodes
without a central server. Examples include distributed databases, peer-to-peer
networks, and blockchain systems.
Modeling Techniques:
Example:
Forward Engineering:
• Techniques:
Reverse Engineering:
• Techniques: