UML Charts

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

UML Charts

Software Engineering
Assoc. Prof. Dr. Ahmet Çağdaş SEÇKİN
• Unified Modeling Language • Class Diagram
• Object Diagram
(UML) is a standardized
• Use Case Diagram
modeling language used in
• Sequence Diagram
software engineering for • Activity Diagram
visualizing, specifying, • State Machine Diagram
constructing, and • Component Diagram
documenting software • Deployment Diagram
systems. • Package Diagram
• UML includes several • Communication Diagram
diagram types, each serving • Composite Structure Diagram
a specific purpose. • Timing Diagram
• Interaction Overview Diagram
• Profile Diagram
• Component Interaction Diagram
• Information Flow Diagram
A class diagram represents the
static structure of a system by
showing classes, their attributes,
methods, and the relationships
between classes.
• StockExchange is a class representing a stock
exchange with properties such as name and
location. It has a one-to-many relationship
with Trader classes, indicating that one stock
exchange can have multiple traders. It also
contains multiple Stock objects.
• Stock is a class representing a stock with
properties like symbol, company name, and
price.
• Trader is a class representing a trader with
properties such as ID and name. Traders can
buy and sell stocks, which are represented by
associations with the Stock class.
An object diagram represents instances of classes and their
relationships at a specific point in time. It provides a snapshot
of the system's runtime state

We define three classes (StockExchange, StockTrader, and Stock) and create object instances of these classes to
represent a stock exchange scenario. The diagram shows the "NY Stock Exchange" as the stock exchange entity,
two traders ("Alice" and "Bob") as members of the exchange, and their ownership of stocks (AAPL and GOOG).
The diagram illustrates the relationships between objects and their attributes.
• A use case diagram models the interactions between an external actor and the system to show how the system
responds to various inputs or actions.
• Actors: Investor, StockBroker, and Administrator are the primary actors interacting with the stock exchange system.
• Use Cases:
• View Market: Both investors and stockbrokers can view the stock market.
• Place Order: Investors can place orders to buy or sell stocks.
• View Portfolio: Investors can view their stock portfolio.
• Execute Order: Stockbrokers execute the orders placed by investors.
• Manage Stocks: Administrators can manage stock-related operations, which extends the functionality of "View Market." If an
administrator manages stocks, it implies viewing the market as well.
• Manage Users: Administrators can manage user-related operations, which also extends the functionality of "View Market."
• The key concept demonstrated here is "extending" use cases. When one use case extends another, it means that it
provides additional or optional behavior. In the example, we use the <<extends>> notation to indicate that the
"Place Order" use case extends the "Execute Order" use case. This means that under certain conditions (e.g., a
specific order type or scenario), the "Place Order" use case may trigger an extension of the "Execute Order" use
case.
• A sequence diagram depicts interactions between objects in a particular
scenario or over a specific time period. It shows the order of messages
exchanged between objects.
• The sequence starts with the trader's
request to buy a stock. The stock
exchange system activates and
subsequently involves a broker to find
an appropriate broker for executing the
order. Once the broker is found, the buy
order is executed and the result is
communicated back to the trader.
• Trader is a participant who initiates the
sequence by requesting to buy stock.
• StockExchange represents the stock
exchange system.
• Broker is an intermediary involved in
executing the buy order.
• Activity diagrams describe the flow of
activities or processes within a system.
They are used to model workflow,
business processes, and the logic of
algorithms.

Here's an explanation of the diagram:


• The diagram starts with the "Stock Exchange" activity, which is the initial point.
• The process then branches into two options: "Buy" or "Sell" activities, which represent the user's choice.
• If the user chooses to "Buy" stock, it checks if the stock is available. If available, it proceeds to "Confirm Transaction." If the transaction is successful, it
completes the transaction; otherwise, it cancels it. If the stock is not available, it notifies the user of unavailability.
• If the user chooses to "Sell" stock, it checks if the user owns the stock. If they do, it proceeds to "Confirm Transaction." If the transaction is successful, it
completes the transaction; otherwise, it cancels it. If the user doesn't own the stock, it notifies them of insufficient stock.
• The diagram ends with the "stop" symbol, indicating the end of the process.
• State machine diagrams model the behavior of an object In this State Machine Diagram:
or system as a finite state machine. They define various • The system starts in the Idle state
states, transitions between states, and events triggering when it's initiated.
• From Idle, it transitions to the
those transitions. Open state when the market
opens.
• In the Open state, trading can
occur through the Buy and Sell
transitions, which represent
order placements.
• Successful order placements lead
to the Match state, where trade
execution takes place.
• The Close state represents the
market closing, and it transitions
back to the Open state when the
market reopens.
• In the event of an emergency, the
system can transition to the Halt
state, temporarily stopping
trading. It can then resume by
transitioning back to the Open
state.
• The system eventually returns to
the Idle state when it's shut
down.
• Component diagrams show the physical
structure of a system, including the components
(e.g., classes, packages, and libraries) and their
dependencies.

EXCHANGE, BROKER, TRADER, DATABASE, and NOTIFIER


represent components in the stock exchange system.
The <<interface>> stereotype is used to define the interfaces
that the components implement or rely on.
Arrows indicate the relationships between the components. For
example:
• EXCHANGE uses BROKER, TRADER, DATABASE, and NOTIFIER.
• BROKER and TRADER use DATABASE for storing information.
• EXCHANGE communicates with the BROKER and TRADER
components, possibly through interfaces defined in the
actual diagrams.
• A deployment diagram represents the
hardware and software components of a
system and their interconnections in a
physical or runtime environment.
• In this example:
• The "Stock Exchange System" is represented as a
package.
• Inside the package, we have components such as
the stock exchange itself and a database.
• There are three hardware nodes: "Internet,"
"Web Server," and "Database Server."
• The Internet cloud represents the external
network.
• The "Web Server" node contains a web
application that communicates with the stock
exchange and the database.
• The "Database Server" node contains a database
server instance.
• Package diagrams are used to organize
and manage large-scale systems by
showing how various components
(classes, packages, etc.) are grouped into
packages and their relationships.
• In this example, we have represented a
"Stock Exchange System" with several
packages. The Stock Exchange System
contains the main components like
"Stock Exchange," "Trading," and
"Market Data." "Trading Participants"
and "Regulatory Bodies" are separate
packages, each containing relevant
components.
• The relationships between the packages
are shown with arrows to indicate
dependencies and associations between
them. The diagram provides a high-level
overview of how the components in the
stock exchange system are organized into
different packages.

You might also like