Simplenotes
Simplenotes
• UML can be described as the successor of object-oriented (OO) analysis and design.
• An object contains both data and methods that control the data.
• A class describes an object and they also form a hierarchy to model the real-world system.
• The hierarchy is represented as inheritance and the classes can also be associated in different
ways as per the requirement.
• Objects are the real-world entities that exist around us and the basic concepts such as
abstraction, encapsulation, inheritance, and polymorphism all can be represented using UML.
• UML is powerful used to represent all the concepts that exist in object-oriented analysis and
design.
• Encapsulation − Encapsulation is the mechanism of binding the data together and hiding them
from the outside world.
• Inheritance − Inheritance is the mechanism of making new classes from existing ones.
• UML is a standard language for specifying, visualizing, constructing, and documenting the
artifacts of software systems.
• UML was created by the Object Management Group (OMG) and UML 1.0 specification draft was
proposed to the OMG in January 1997.
• OMG is continuously making efforts to create a truly industry standard.
• UML is different from the other common programming languages such as C++, Java, COBOL, etc.
• UML can be described as a general purpose visual modeling language to visualize, specify,
construct, and document software system.
• Although UML is generally used to model software systems, it is not limited within this
boundary.
• UML is not a programming language but tools can be used to generate code in various languages
using UML diagrams.
• UML has a direct relation with object oriented analysis and design.
UML View:
• There are five different views that the UML aims to visualize through different modeling
diagrams. These five views are:
1. User's View
2. Structural Views
3. Behavioral Views
4. Environmental View
5. Implementation View
1) User's view
• This contains the diagrams in which the user's part of interaction with the software is defined.
2) Structural view
• In the structural view, only the structure of the model is explained.
• The diagram that this view includes are: Class Diagrams, Object Diagrams
3) Behavioral view
• The behavioral view contains the diagrams which explain the behavior of the software.
• These diagrams are: Sequence Diagram, Collaboration Diagram, State chart Diagram, Activity
Diagram
4) Environmental view
• The environmental view contains the diagram which explains the after deployment behavior of
the software model.
• This diagram usually explains the user interactions and software effects on the system.
• The diagrams that the environmental model contain is: Deployment diagram
5) Implementation view
• The implementation view consists of the diagrams which represent the implementation part of
the software.
• This is the only view in which the internal workflow of the software is defined.
• Structural things define the static part of the model. They represent the physical and conceptual
elements. Following are the brief descriptions of the structural things.
• Interface − Interface defines a set of operations, which specify the responsibility of a class.
• Collaboration −Collaboration defines an interaction between elements.
• Use case −Use case represents a set of actions performed by a system for a specific goal.
• Node − A node can be defined as a physical element that exists at run time
• A behavioral thing consists of the dynamic parts of UML models. Following are the behavioral
things −
• State machine − State machine is useful when the state of an object in its life cycle is important.
1. Structural Modeling
Classes diagrams
Objects diagrams
Deployment diagrams
Package diagrams
• Structural model represents the framework for the system and this framework is the place
where all other components exist.
• Hence, the class diagram, component diagram and deployment diagrams are part of structural
modeling.
• They all represent the elements and the mechanism to assemble them.
• The structural model never describes the dynamic behavior of the system.
2. Behavioral Modeling
Activity diagrams
Interaction diagrams
Use case diagrams
3. Architectural Modeling
Relationship:
• It shows how the elements are associated with each other and this association describes the
functionality of an application.
1. Dependency
• Dependency is a relationship between two things in which change in one element also affects
the other.
2. Association
• Association is basically a set of links that connects the elements of a UML model.
• It also describes how many objects are taking part in that relationship.
3. Generalization
• One element describes some responsibility, which is not implemented and the other one
implements them.
Common Mechanisms:
1. Specifications
2. Adornments
3. Common Divisions
4. Extensibility Mechanisms
1. Specifications
• In UML, behind each graphical notation, there is a textual statement denoting the syntax and
semantics.
• The specifications provide a semantic backplane that contains all the parts of a system and the
relationship among the different paths.
2. Adornments
• Besides, there are notations to represent the important aspects of an element like name, scope,
visibility, etc.
3. Common Divisions
c) An object is the concrete instance that has actual existence in the system.
4. Extensibility Mechanisms
• It is possible to extend the capabilities of UML in a controlled manner to suit the requirements
of a system.
Stereotypes − It extends the vocabulary of the UML, through which new building blocks
can be created out of existing ones.
Classifiers:
• In general, the modeling elements that can have instances are called classifiers
• Use case: Set of a sequence of actions, including variants, that a system performs that yields an
observable result or value to a particular actor
• Datatype: A type whose values have no identity, including primitive built-in types (such as
numbers anti strings), as well as enumeration types (such as Boolean)
• Component: Physical and replaceable part of a system that conforms to and provides the
realization of a set of interfaces
• Node: A physical element that exists at run time and that represents a computational resource,
generally having at least some memory anti often processing capability
Visibility:
• Public [+]: All outside classifiers that have visibility to the given classifier, can use this feature
• Protected [#]: All descendants of the classifier can use the feature
• The owner scope of a feature specifies whether the feature appears in each instance of the
classifier or whether there is just a single instance of feature for all instances of the classifier.
• Multiplicity:
Dependency:
• Specifying a change in the specification of one thing may affect another thing, but not
necessarily the reverse
• There are eight stereotypes that apply to dependency relationships among classes and objects
in class diagrams
Advanced Relationship:
Two stereotypes that apply to dependency relationships among packages
• Access - Source package is granted the right to reference the elements of the target package
• Include - Source use case explicitly incorporates the behavior of another use case at a location
specified by the source
• In the context of organizing the elements of your system into subsystem and model
• Trace - Target is a historical ancestor of the source (model relationship among elements in
different models)
Generalization
• A generalization is a relationship between a general thing and a more specific kind of that thing
• In multiple Inheritance one class may have more than one parent
• Complete: Means that all children in the generalization have been indicated in the model and
that no additional children are permitted
• Incomplete: Means that all children of the generalization may not have been included and new
ones can be added later
• Disjoint: Depicts that objects of the parent do not overlap, i.e., they belong to only one child
class
• Overlapping: Indicates that objects of the parent may have more than one of the children as a
type
• Association
• Visibility: Objects at that end are not accessible to any objects outside the association
• Qualification: This is an attribute whose values partition the set of objects related to an object
across an association.
• Composition: A form of an aggregation with strong ownership and coincident lifetime of the
parts by the whole
Constraints:
• Ordered: The set of objects at one end of an association are in a piece of order
• AddOnly: New links may be included from an object on the opposite end of the association
• XOR: Over a set of relationships, exactly one is apparent for each associated object
Realization
• A type is a stereotype of a class used to specify a domain of objects, together with the
operations (but not the methods) applicable to the object.
• Stereotype type is used to formally model the semantics of an abstraction and its conformance
to a specific interface.
Class Diagram:
• Class diagram is not only used for visualizing, describing, and documenting different aspects of a
system but also for constructing executable code of the software application.
• Class diagram describes the attributes and operations of a class and also the constraints
imposed on the system.
• The class diagrams are widely used in the modeling of object oriented systems because they are
the only UML diagrams, which can be mapped directly with object-oriented languages.
• First of all, Order and Customer are identified as the two elements of the system. They have a
one-to-many relationship because a customer can have multiple orders.
• Order class is an abstract class and it has two concrete classes (inheritance relationship)
SpecialOrder and NormalOrder.
• The two inherited classes have all the properties as the Order class. In addition, they have
additional functions like dispatch () and receive ().
Object Diagram:
• Object diagrams are derived from class diagrams so object diagrams are dependent upon class
diagrams.
• The basic concepts are similar for class diagrams and object diagrams.
• Object diagrams also represent the static view of a system but this static view is a snapshot of
the system at a particular moment.
• Object diagrams are used to render a set of objects and their relationships as an instance.
• First, analyze the system and decide which instances have important data and association.
• Second, consider only those instances, which will cover the functionality.
• Before drawing an object diagram, the following things should be remembered and
understood clearly −
• Objects and links are the two elements used to construct an object diagram.
• After this, the following things are to be decided before starting the construction of the
diagram −
• The object diagram should have a meaningful name to indicate its purpose.
• Customer
• Order
• SpecialOrder
• NormalOrder
• Now the customer object (C) is associated with three order objects (O1, O2, and O3). These
order objects are associated with special order and normal order objects (S1, S2, and N1). The
customer has the following three orders with different numbers (12, 32 and 40) for the
particular time considered.
• The customer can increase the number of orders in future and in that scenario the object
diagram will reflect that. If order, special order, and normal order objects are observed then you
will find that they have some values.
• For orders, the values are 12, 32, and 40 which implies that the objects have these values for a
particular moment (here the particular time when the purchase is made is considered as the
moment) when the instance is captured
• The same is true for special order and normal order objects which have number of orders as 20,
30, and 60. If a different time of purchase is considered, then these values will change
accordingly.
• The following object diagram has been drawn considering all the points mentioned above
Component diagram:
• Now the question is, what are these physical aspects? Physical aspects are the elements such as
executables, libraries, files, documents, etc. which reside in a node.
• Component diagrams are used to visualize the organization and relationships among
components in a system.
• Component diagrams can also be described as a static implementation view of a system. Static
implementation represents the organization of the components at a particular moment.
• A single component diagram cannot represent the entire system but a collection of diagrams is
used to represent the whole.
• Component diagrams are used to describe the physical artifacts of a system. This artifact
includes files, executables, libraries, etc
• The purpose of this diagram is different. Component diagrams are used during the
implementation phase of an application. However, it is prepared well in advance to visualize the
implementation details.
• Initially, the system is designed using different UML diagrams and then when the artifacts are
ready, component diagrams are used to get an idea of the implementation.
• This diagram is very important as without it the application cannot be implemented efficiently. A
well-prepared component diagram is also important for other aspects such as application
performance, maintenance, etc.
• Before drawing a component diagram, the following artifacts are to be identified clearly −
• Relationships among the artifacts. Following is a component diagram for order management
system. Here, the artifacts are files. The diagram shows the files in the application and their
relationships. In actual, the component diagram also contains dlls, libraries, folders, etc.
• In the following diagram, four files are identified and their relationships are produced.
Component diagram cannot be matched directly with other UML diagrams discussed so far as it
is drawn for completely different purpose.
• The following component diagram has been drawn considering all the points mentioned
above
• After identifying the artifacts, the following points need to be kept in mind.
• Use a meaningful name to identify the component for which the diagram is to be drawn.
• Only static behavior is not sufficient to model a system rather dynamic behavior is more
important than static behavior.
• In UML, there are five diagrams available to model the dynamic nature and use case diagram is
one of them.
• Now as we have to discuss that the use case diagram is dynamic in nature, there should be
some internal or external factors for making the interaction.
• Use case diagrams consists of actors, use cases and their relationships. The diagram is used to
model the system/subsystem of an application.
• Hence to model the entire system, a number of use case diagrams are used.
• The purpose of use case diagram is to capture the dynamic aspect of a system.
• Use case diagrams are considered for high level requirement analysis of a system.
• When the requirements of a system are analyzed, the functionalities are captured in use cases.
• We can say that use cases are nothing but the system functionalities written in an organized
manner.
• The second thing which is relevant to use cases are the actors.
• Actors can be a human user, some internal applications, or may be some external applications.
• When we are planning to draw a use case diagram, we should have the following items
identified.
Actors
• Use case diagrams are drawn to capture the functional requirements of a system. After
identifying the above items, we have to use the following guidelines to draw an efficient use
case diagram
1. The name of a use case is very important. The name should be chosen in such a way so that it can
identify the functionalities performed.
4. Do not try to include all types of relationships, as the main purpose of the diagram is to identify
the requirements.
• Following is a sample use case diagram representing the order management system.
• Hence, if we look into the diagram then we will find three use cases (Order, SpecialOrder, and
NormalOrder) and one actor which is the customer.
• The SpecialOrder and NormalOrder use cases are extended from Order use case. Hence, they
have extended relationship. Another important point is to identify the system boundary, which
is shown in the picture. The actor Customer lies outside the system as it is an external user of
the system.
• Reverse engineering.
• Forward engineering.