Академический Документы
Профессиональный Документы
Культура Документы
LAB MANUAL
UML INTRODUCTION
STUDY OF UML
AIM:
DESCRIPTION:
CLASS
OBJECT
ABSTRACTION
For example, Lassie the Dog may be treated as a Dog much of the
time, a Collie when necessary to access Collie-specific attributes or behaviors,
and as an Animal (perhaps the parent class of Dog) when counting Timmy's
pets. Abstraction is also achieved through Composition. For example, a class
ENCAPSULATION:
For example, the Dog class has a bark () method. The code for the bark()
method defines exactly how a bark happens (e.g., by inhale() and then
exhale(), at a particular pitch and volume). Timmy, Lassie's friend, however,
does not need to know exactly how she barks. Encapsulation is achieved by
specifying which classes may use the members of an object. The result is
that each object exposes to any class a certain interface — those members
accessible to that class.
POLYMORPHISM:
INHERITANCE:
For example, the class Dog might have sub-classes called Collie,
Chihuahua, and Golden Retriever. In this case, Lassie would be an instance of the
Collie subclass. Suppose the Dog class defines a method called bark() and a
property called fur Color. Each of its sub-classes (Collie, Chihuahua, and Golden
Retriever) will inherit these members, meaning that the programmer only
needs to write the code for them once.
Each subclass can alter its inherited traits. For example, the Collie
subclass might specify that the default four-Color for a collie is brown-and-
white. The Chihuahua subclass might specify that the bark () method
produces a high pitch by default. Subclasses can also add new members.
The Chihuahua subclass could add a method called tremble (). So an individual
Chihuahua instance would use a high-pitched bark () from the Chihuahua
subclass, which in turn inherited the usual bark () from Dog. The Chihuahua
object would also have the tremble () method, but Lassie would not, because
she is a Collie, not a Chihuahua. In fact, inheritance is an "a... is a"
relationship between classes, while instantiation is an "is a" relationship
between an object and a class: a Collie is a Dog ("a... is a"), but Lassie is a
Collie ("is a"). Thus, the object named Lassie has the methods from both
classes Collie and Dog.
Multiple inheritances are inheritance from more than one ancestor
class, neither of these ancestors being an ancestor of the other. For
example, independent classes could define Dogs and Cats, and a Chimera
object could be created from these two which inherits all the (multiple)
behavior of cats and dogs. This is not always supported, as it can be hard to
implement
At the center of the UML are its nine kinds of modeling diagrams, which we
describe here.
Let's look at this question from the point of view of the construction
trade. Architects design buildings. Builders use the designs to create
buildings. The more complicated the building, the more critical the
communication between architect and builder. Blueprints are the standard
graphical language that both architects and builders must learn as part of
their trade.
Classes are the "blueprints" for objects. A class wraps attributes (data) and
behaviors (methods or functions) into a single distinct entity. Objects are
instances of classes.
Use case diagrams describe what a system does from the standpoint
of an external observer. The emphasis is on what a system does rather than
how.
Actors are stick figures. Use cases are ovals. Communications are lines
that link actors to use cases.
Class diagrams:
An association has two ends. An end may have a role name to clarify the
nature of the association. For example, an Order Detail is a line item of
each Order.
Multiplicities Meaning
Packages appear as rectangles with small tabs at the top. The package
name is on the tab or inside the rectangle. The dotted arrows are
dependencies. One package depends on another if changes in the other
could possibly force changes in the first.
Sequence diagrams
Class and object diagrams are static model views. Interaction
diagrams are dynamic. They describe how objects collaborate.
Collaboration diagrams:
States are rounded rectangles. Transitions are arrows from one state
to another. Events or conditions that trigger transitions are written beside
the arrows. Our diagram has two self-transition, one on Getting SSN and
another on Getting PIN.
The initial state (black circle) is a dummy to start the action. Final
states are also dummy states that terminate the action.
The three involved classes (people, etc.) of the activity are Customer,
ATM, and Bank. The process begins at the black start
Circle at the top and ends at the concentric white/black stop circles at
the bottom. The activities are rounded rectangles.
Activity diagrams can be divided into object swimlanes that
determine which object is responsible for which activity. A single transition
comes out of each activity, connecting it to the next activity.
1. Draw the lines around the system and actors lie outside
the system.
2. Identify the actors which are interacting with the
system.
3. Separate the generalized and specialized actors.
4. Identify the functionality the way of interacting actors
with system and specify the behavior of actor.
HISTORY