SQL
SQL
UML is a standard language for specifying, visualizing, constructing, and documenting the of software
systems. UML was created by the Object Management Group (OMG). UML 1.0 specification draft was
proposed to the OMG in January 1997.
A conceptual model can be defined as a model which is made of concepts and their relationships. A
conceptual model is the first step before drawing a UML diagram. It helps to understand the entities
in the real world and how they interact with each other.
The conceptual model of UML can be mastered by learning the following three major elements.
OBJECT-ORIENTED CONCEPTS
The purpose of OO analysis is to identify objects of a system to be designed. This analysis is also done
for an existing system. After identifying the objects, their relationships are identified and finally the
design is produced.
THINGS
Things are the most important building blocks of UML. Things can be −
● Structural
● Behavioral
● Grouping
● Annotational
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.
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.
BEHAVIORAL THINGS
A behavioral thing consists of the dynamic parts of UML model. Following are the behavioral things −
Interaction − behavior that consist of a group of messages exchanged among elements to
accomplish a specific task.
State Machine − The sequence of states an object goes through in response to events. Events
are external factors responsible for state change
GROUPING THINGS
A mechanism to group UML elements together. There is only one grouping thing available −
Package − Package is the only one grouping thing available for gathering structural and
behavioral things.
ANNOTATIONAL THINGS
RELATIONSHIP
It shows how the elements are associated with each other and this association describes the
functionality of an application.
There are four kinds of relationships available.
DEPENDENCY
A relationship between two things in which change in one element also affects the other.
4|M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
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.
GENERALIZATION
A relationship which connects a specialized element with a generalized element. It basically describes
the inheritance relationship in the world of objects.
REALIZATION
A relationship in which two elements are connected. One element describes some responsibility, which
is not implemented and the other one implements them. This relationship exists in case of interfaces.
UML DIAGRAMS
UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are used to make
a complete UML diagram and the diagram represents a system. The visual effect of the UML diagram is the most
important part of the entire process. All the other elements are used to make it complete.
● Class diagram
● Object diagram
● Use case diagram
● Sequence diagram
● Collaboration diagram
● Activity diagram
● State chart diagram
● Deployment diagram
● Component diagram
5|M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
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.
These internal and external agents are known as actors. Use case diagrams consists of actors, use cases and their
relationships. The diagram is used to model the system/subsystem of an application. A single use case diagram
captures a particular functionality of a system.
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. However, this definition is too
generic to describe the purpose, as other four diagrams (activity, sequence, collaboration, and State-chart) also
have the same purpose. We will look into some specific purpose, which will distinguish it from other four
diagrams.
Use case diagrams are used to gather the requirements of a system including internal and external influences.
These requirements are mostly design requirements. Hence, when a system is analyzed to gather its
functionalities, use cases are prepared and actors are identified.
When the initial task is complete, use case diagrams are modelled to present the outside view.
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 defined as something that interacts with the
system.
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.
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
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.
Give a suitable name for actors.
Show relationships and dependencies clearly in the diagram.
Do not try to include all types of relationships, as the main purpose of the diagram is to identify the
requirements.
Use notes whenever required to clarify some important points.
6|M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
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.
As we have already discussed there are five diagrams in UML to model the dynamic view of a system. Now each
and every model has some specific purpose to use. Actually, these specific purposes are different angles of a
running system.
To understand the dynamics of a system, we need to use different types of diagrams. Use case diagram is one of
them and its specific purpose is to gather system requirements and actors.
Use case diagrams specify the events of a system and their flows. But use case diagram never describes how they
are implemented. Use case diagram can be imagined as a black box where only the input, output, and the
function of the black box is known.
These diagrams are used at a very high level of design. This high-level design is refined again and again to get a
complete and practical picture of the system. A well-structured use case also describes the pre-condition, post
condition, and exceptions. These extra elements are used to make test cases when performing the testing.
Although use case is not a good candidate for forward and reverse engineering, still they are used in a slightly
different way to make forward and reverse engineering. The same is true for reverse engineering. Use case
diagram is used differently to make it suitable for reverse engineering.
In forward engineering, use case diagrams are used to make test cases and in reverse engineering use cases are
used to prepare the requirement details from the existing application.
Use case diagram is a kind of UML diagram. Here is a list of Unified Modeling Language (UML) notations
supported in a UML use case diagram:
Icon Name
Use Case
Association
Actor
System
Include
Extend
Dependency
Generalization
Realization
Collaboration
USE CASE
A use case is the specification of a set of actions performed by a system, which yields an observable result that
is typically of value for one or more actors or other stakeholders of the system.
What is a use case in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1, page 606), use case is:
ASSOCIATION
8|M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Actor and use case can be associated to indicate that the actor participates in that use case. Therefore, an
association correspond to a sequence of actions between the actor and use case in achieving the use case.
What is an association in UML? According to the OMG Unified Modeling Language (OMG UML) specification
(UML Superstructure Specification version 2.4.1, page 36), association is:
An association describes a set of tuples whose values refer to typed instances. An instance of an association is
called a link. A link is a tuple with one value for each end of the association, where each value is an instance of
the type of the end.
An association specifies a semantic relationship that can occur between typed instances. It has at least two ends
represented by properties, each of which is connected to the type of the end. More than one end of the
association may have the same type.
An end property of an association that is owned by an end class or that is a navigable owned end of the
association indicates that the association is navigable from the opposite ends; otherwise, the association is not
navigable from the opposite ends.
ACTOR
Actors are the entities that interact with a system. Although in most cases, actors are used to represent the users
of system, actors can actually be anything that needs to exchange information with the system. So, an actor may
be people, computer hardware, other systems, etc.
Note that actor represents a role that a user can play but not a specific user. So, in a hospital information system,
you may have doctor and patient as actors but not Dr. John, Mrs. Brown as actors.
What is an actor in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1), actor is:
An actor specifies a role played by a user or any other system that interacts with the subject. (The term "role" is
used informally here and does not necessarily imply the technical definition of that term found elsewhere in this
specification.)
An Actor models a type of role played by an entity that interacts with the subject (e.g., by exchanging signals
and data) but which is external to the subject (i.e., in the sense that an instance of an actor is not a part of the
instance of its corresponding subject). Actors may represent roles played by human users, external hardware, or
other subjects. Note that an actor does not necessarily represent a specific physical entity but merely a particular
facet (i.e., “role") of some entity that is relevant to the specification of its associated use cases. Thus, a single
physical instance may play the role of several different actors and conversely, a given actor may be played by
multiple different instances.
SYSTEM
9|M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
The scope of a system can be represented by a system (shape), or sometimes known as a system boundary. The
use cases of the system are placed inside the system shape, while the actor who interact with the system are put
outside the system. The use cases in the system make up the total requirements of the system.
What is a system in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1, page 608), system is:
If a subject (or system boundary) is displayed, the use case ellipse is visually located inside the system boundary
rectangle. Note that this does not necessarily mean that the subject classifier owns the contained use cases, but
merely that the use case applies to that classifier.
INCLUDE
An include relationship specifies how the behavior for the inclusion use case is inserted into the behavior defined
for the base use case.
What is an include in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1, page 604), include is:
An include relationship defines that a use case contains the behavior defined in another use case.
EXTEND
An extend relationship specifies how the behavior of the extension use case can be inserted into the behavior
defined for the base use case.
What is an extend in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1, page 601), extend is:
A relationship from an extending use case to an extended use case that specifies how and when the behavior
defined in the extending use case can be inserted into the behavior defined in the extended use case.
...
10 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
This relationship specifies that the behavior of a use case may be extended by the behavior of another (usually
supplementary) use case. The extension takes place at one or more specific extension points defined in the
extended use case. Note, however, that the extended use case is defined independently of the extending use
case and is meaningful independently of the extending use case. On the other hand, the extending use case
typically defines behavior that may not necessarily be meaningful by itself. Instead, the extending use case defines
a set of modular behavior increments that augment an execution of the extended use case under specific
conditions.
Note that the same extending use case can extend more than one use case. Furthermore, an extending use case
may itself be extended.
DEPENDENCY
A dependency relationship represents that a model element relies on another model element for specification
and/or implementation.
What is a dependency in UML? According to the OMG Unified Modeling Language (OMG UML) specification
(UML Superstructure Specification version 2.4.1, page 61), dependency is:
A dependency is a relationship that signifies that a single or a set of model elements requires other model
elements for their specification or implementation. This means that the complete semantics of the depending
elements is either semantically or structurally dependent on the definition of the supplier element(s).
GENERALIZATION
A generalization relationship is used to represent inheritance relationship between model elements of same type.
The more specific model element share the same specification with. the more general the model element but
carries more details in extra.
What is a generalization in UML? According to the OMG Unified Modeling Language (OMG UML) specification
(UML Superstructure Specification version 2.4.1, page 70), generalization is:
A generalization is a taxonomic relationship between a more general classifier and a more specific classifier. Each
instance of the specific classifier is also an indirect instance of the general classifier. Thus, the specific classifier
inherits the features of the more general classifier.
REALIZATION
What is a realization in UML? According to the OMG Unified Modeling Language (OMG UML) specification (UML
Superstructure Specification version 2.4.1, page 131), realization is:
Realization is a specialized abstraction relationship between two sets of model elements, one representing a
specification (the supplier) and the other represents an implementation of the latter (the client). Realization can
be used to model stepwise refinement, optimizations, transformations, templates, model synthesis, framework
composition, etc.
COLLABORATION
What is a collaboration in UML? According to the OMG Unified Modeling Language (OMG UML) specification
(UML Superstructure Specification version 2.4.1, page 174), collaboration is:
A collaboration describes a structure of collaborating elements (roles), each performing a specialized function,
which collectively accomplish some desired functionality. Its primary purpose is to explain how a system works
and, therefore, it typically only incorporates those aspects of reality that are deemed relevant to the explanation.
Thus, details, such as the identity or precise class of the actual participating instances are suppressed.
12 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
ER DIAGRAM
The ER or (Entity Relational Model) is a high-level conceptual data model diagram. Entity-Relation model is based
on the notion of real-world entities and the relationship between them. ER modeling helps you to analyze data
requirements systematically to produce a well-designed database. So, it is considered a best practice to complete
ER modeling before implementing your database.
An Entity–relationship model (ER model) describes the structure of a database with the help of a diagram, which
is known as Entity Relationship Diagram (ER Diagram). An ER model is a design or blueprint of a database that
can later be implemented as a database. The main components of E-R model are: entity set and relationship set.
An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and these
entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in database, so by
showing relationship among tables and their attributes, ER diagram shows the complete logical structure of a
database.
Here are the geometric shapes and their meaning in an E-R Diagram
1. Entity
2. Attribute
3. Relationship
1. ENTITY
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the relationship with other entity
is called weak entity. The weak entity is represented by a double rectangle. For example – a bank account cannot
be uniquely identified without knowing the bank to which the account belongs, so bank account is a weak entity.
2. ATTRIBUTE
An attribute describes the property of an entity. An attribute is represented as Oval in an ER diagram. There are
four types of attributes:
1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
1. KEY ATTRIBUTE:
A key attribute can uniquely identify an entity from an entity set. For example, student roll number can
uniquely identify a student from a set of students. Key attribute is represented by oval same as other attributes
however the text of key attribute is underlined.
2. COMPOSITE ATTRIBUTE:
14 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
An attribute that is a combination of other attributes is known as composite attribute. For example, In student
entity, the student address is a composite attribute as an address is composed of other attributes such as pin
code, state, country.
3. MULTIVALUED ATTRIBUTE:
An attribute that can hold multiple values is known as multivalued attribute. It is represented with double
ovals in an ER Diagram. For example – A person can have more than one phone numbers so the phone number
attribute is multivalued.
4. DERIVED ATTRIBUTE:
A derived attribute is one whose value is dynamic and derived from another attribute. It is represented by dashed
oval in an ER Diagram. For example – Person age is a derived attribute as it changes over time and can be derived
from another attribute (Date of birth).
3. RELATIONSHIP
A relationship is represented by diamond shape in ER diagram, it shows the relationship among entities. There
are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
When a single instance of an entity is associated with a single instance of another entity then it is called one to
one relationship. For example, a person has only one passport and a passport is given to one person.
15 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
When a single instance of an entity is associated with more than one instances of another entity then it is called
one to many relationships. For example – a customer can place many orders but a order cannot be placed by
many customers.
When more than one instances of an entity is associated with a single instance of another entity then it is called
many to one relationship. For example – many students can study in a single college but a student cannot study
in many colleges at the same time.
When more than one instances of an entity is associated with more than one instances of another entity then it
is called many to many relationships. For example, a can be assigned to many projects and a project can be
assigned to many students.
A Total participation of an entity set represents that each entity in entity set must have at least one relationship
in a relationship set. For example: In the below diagram each college must have at-least one associated Student.
16 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
HISTORY OF ER MODELS
ER diagrams are a visual tool which is helpful to represent the ER model. It was proposed by Peter Chen in 1971
to create a uniform convention which can be used for relational database and network. He aimed to use an ER
model as a conceptual modeling approach.
Entity relationship diagram displays the relationships of entity set stored in a database. In other words, we can
say that ER diagrams help you to explain the logical structure of databases. At first look, an ER diagram looks
very similar to the flowchart. However, ER Diagram includes many specialized symbols, and its meanings make
this model unique.
Sample ER Diagram
17 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
● Entities
● Attributes
● Relationships
Example
For example, in a University database, we might have entities for Students, Courses, and Lecturers. Students
entity can have attributes like Rollno, Name, and DeptID. They might have relationships with Courses and
Lecturers.
18 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
WHAT IS ENTITY?
A real-world thing either living or non-living that is easily recognizable and nonrecognizable. It is anything in
the enterprise that is to be represented in our database. It may be a physical thing or simply a fact about the
enterprise or an event that happens in the real world.
An entity can be place, person, object, event or a concept, which stores data in the database. The characteristics
of entities are must have an attribute, and a unique key. Every entity is made up of some 'attributes' which
represent that entity.
Examples of entities:
Notation of an Entity
ENTITY SET:
Student
An entity set is a group of similar kind of entities. It may contain entities with attribute sharing similar values.
Entities are represented by their properties, which also called attributes. All attributes have their separate
values. For example, a student entity may have a name, age, class, as attributes.
RELATIONSHIP
Relationship is nothing but an association among two or more entities. E.g., Tom works in the Chemistry
department.
Entities take part in relationships. We can often identify relationships with verbs or verb phrases.
WEAK ENTITIES
A weak entity is a type of entity which doesn't have its key attribute. It can be identified uniquely by
considering the primary key of another entity. For that, weak entity sets need to have participation.
19 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Strong entity set always has a primary key. It does not have enough attributes to build a primary key.
It contains a Primary key represented by the It contains a Partial Key which is represented by a dashed
underline symbol. underline symbol.
The member of a strong entity set is called as The member of a weak entity set called as a subordinate
dominant entity set. entity set.
Primary Key is one of its attributes which helps to In a weak entity set, it is a combination of primary key and
identify its member. partial key of the strong entity set.
In the ER diagram the relationship between two The relationship between one strong and a weak entity
strong entity set shown by using a diamond set shown by using the double diamond symbol.
symbol.
The connecting line of the strong entity set with the The line connecting the weak entity set for identifying
relationship is single. relationship is double.
ATTRIBUTES
It is a single-valued property of either an entity-type or a relationship-type. An attribute is represented by an
Ellipse
20 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Simple attribute Simple attributes can't be divided any further. For example, a student's contact
number. It is also called an atomic value.
Composite attribute It is possible to break down composite attribute. For example, a student's full name
may be further divided into first name, second name, and last name.
Derived attribute This type of attribute does not include in the physical database. However, their values
are derived from other attributes present in the database. For example, age should
not be stored directly. Instead, it should be derived from the DOB of that employee.
Multivalued attribute Multivalued attributes can have more than one values. For example, a student can
have more than one mobile number, email address, etc.
CARDINALITY
Defines the numerical attributes of the relationship between two entities or entity sets.
Different types of cardinal relationships are:
● One-to-One Relationships
● One-to-Many Relationships
● May to One Relationships
● Many-to-Many Relationships
21 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
1.One-to-one:
One entity from entity set X can be associated with at most one entity of entity set Y and vice versa.
Example: One student can register for numerous courses. However, all those courses have a single line back to that one
student.
2.One-to-many:
One entity from entity set X can be associated with multiple entities of entity set Y, but an entity from entity set
Y can be associated with at least one entity.
For example, one class is consisting of multiple students.
3. Many to One
More than one entity from entity set X can be associated with at most one entity of entity set Y. However, an
entity from entity set Y may or may not be associated with more than one entity from entity set X.
For example, many students belong to the same class.
22 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
4. Many to Many:
One entity from X can be associated with more than one entity from Y and vice versa.
For example, Students as a group are associated with multiple faculty members, and faculty members can be associated
with multiple students.
ER- Diagram is a visual representation of data that describe how data is related to each other.
In a university, a Student enrolls in Courses. A student must be assigned to at least one or more Courses. Each course is
taught by a single Professor. To maintain instruction quality, a Professor can deliver only one course
● Student
● Course
● Professor
Once, you have a list of Attributes, you need to map them to the identified entities. Ensure an attribute is to be paired with
exactly one entity. If you think an attribute should belong to more than one entity, use a modifier to make it unique.
Once the mapping is done, identify the primary Keys. If a unique key is not readily available, create one.
Course_ID CourseName
SUMMARY
UML Sequence diagrams are interaction diagrams that detail how operations are carried out. As sequence
diagrams can be used to capture the interaction between objects in the context of a collaboration, one of the
primary uses of sequence diagrams is in the transition from requirements expressed as use cases to the next and
more formal level of refinement. Use cases are often refined into one or more sequence diagrams.
Sequence diagrams are time focus and they show the order of the interaction visually by using the vertical axis
of the diagram to represent time what messages are sent and when.
high-level interactions between user of the system and the system, between the system and other systems,
or between subsystems (sometimes known as system sequence diagrams)
the interaction that takes place in a collaboration that either realizes a use case or an operation (instance
diagrams or generic diagrams)
Represent objects interact in (Model, View / Controller) MVC pattern of software framework
ACTOR
An Actor a type of role played by an entity that interacts with the subject (e.g., by exchanging signals and data).
An actor can also be an external to the subject (i.e., in the sense that an instance of an actor is not a part of the
instance of its corresponding subject). They typically represent roles played by human users, external hardware,
or other subjects.
Note That:
An actor does not necessarily represent a specific physical entity but merely a particular role of some entity
A person may play the role of several different actors and, conversely, a given actor may be played by multiple
different persons.
ACTIVATION
An activation is represented by a thin rectangle on a lifeline) represents the period during which an element is
performing an operation. The top and the bottom of the of the rectangle are aligned with the initiation and the
completion time respectively
MESSAGES
CALL MESSAGE
A call message defines a particular communication between lifelines of an interaction, which represents an
invocation of operation of target lifeline.
RETURN MESSAGE
A return message defines a particular communication between lifelines of an interaction, which represents the
pass of information back to the caller of a corresponded former message.
27 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
SELF MESSAGE
A self-message defines a particular communication between lifelines of an interaction, which represents the
invocation of message of the same lifeline.
RECURSIVE MESSAGE
A recursive message defines a particular communication between lifelines of an interaction, which represents the
invocation of message of the same lifeline. It's target points to an activation on top of the activation where the
message was invoked from.
CREATE MESSAGE
A create message defines a particular communication between lifelines of an interaction, which represents the
instantiation of (target) lifeline.
DESTROY MESSAGE
A destroy message defines a particular communication between lifelines of an interaction, which represents the
request of destroying the lifecycle of target lifeline.
DURATION MESSAGE
A duration message defines a particular communication between lifelines of an interaction, which shows the
distance between two-time instants for a message invocation.
28 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
NOTE
A note (comment) gives the ability to attach various remarks to elements. A comment carries no semantic force,
but may contain information that is useful to a modeler.
Identify a set of objects that will participate in the general collaboration (or use case scenario)
If you derive the sequence diagram based on a scenario of a use case, select the normal scenarios first
You should know the primary actor(s) who activates the use case
Consider the first point of the scenario (or if you get it from the first point of the flow of event of a use case)
Consider what the system needs to be done in order to response to the actor, when the actor send the
message to the system
What the system needs to be handled before the return message response back from the system?
E.g., A customer inserted an ATM card to the machine, the system will display "input pin number" in the
normal scenario, right?
Guess, what will to be handled inside the ADM by a set of objects at the "back" of the system? Something
like, read and verify the ATM card (card reader), read the card information of the card holder (by the bank)
and ask for the pin, or, return "invalid card type, insert another card", and etc.
By this way, you will identify the candidate objects and operations of the target application for that particular
scenario and you can also use this information as a basis to derive the class diagram incrementally.
Repeat each of the point of the scenario (or flow of event) and until you complete all the points in the
scenario.
Draw a set of corresponding sequence diagrams for the exception or alternative scenarios.
The sequence diagram example below shows the interactions between a user and a ticket booking system in
booking a seat. It consists of mainly four parts: The actor, which is the user, the boundary object ‘interface', the
controller object ‘main controller' and two entity objects routes and route.
29 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
The sequence diagram example below shows a patient admission process. It shows the use of timing and duration
constraint.
The sequence diagram example shows how recursive message can be used in interaction modeling.
30 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
CLASS?
A Class is a blueprint that is used to create Object. The Class defines what object can do.
Class Diagram gives the static view of an application. A class diagram describes the types of objects in the system
and the different types of relationships that exist among them. This modeling method can run with almost all
Object-Oriented Methods. A class can refer to another class. A class can have its objects or may inherit from
other classes.
UML Class Diagram gives an overview of a software system by displaying classes, attributes, operations, and their
relationships. This Diagram includes the class name, attributes, and operation in separate designated
compartments.
Class Diagram helps construct the code for the software application development.
Class Diagram Illustrates data models for even very complex information systems
It provides an overview of how the application is structured before studying the actual code. This can easily
reduce the maintenance time
It helps for better understanding of general schematics of an application.
Allows drawing detailed charts which highlights code required to be programmed
Helpful for developers and other stakeholders.
1. Class Name
2. Attributes
3. Operations
31 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
CLASS NAME
The name of the class is only needed in the graphical representation of the class. It appears in the topmost
compartment. A class is the blueprint of an object which can share the same relationships, attributes, operations,
& semantics. The class is rendered as a rectangle, including its name, attributes, and operations in sperate
compartments.
ATTRIBUTES:
An attribute is named property of a class which describes the object being modeled. In the class diagram, this
component is placed just below the name-compartment.
A derived attribute is computed from other attributes. For example, an age of the student can be easily computed
from his/her birth date.
32 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Attributes characteristics
The attributes are generally written along with the visibility factor.
Public, private, protected and package are the four visibilities which are denoted by +, -, #, or ~ signs
respectively.
Visibility describes the accessibility of an attribute of a class.
Attributes must have a meaningful name that describes the use of it in a class.
RELATIONSHIPS
1. Dependencies
2. Generalizations
3. Associations
Dependency
A dependency means the relation between two or more classes in which a change in one may force changes in
the other. However, it will always create a weaker relationship. Dependency indicates that one class depends on
another.
Generalization:
A generalization helps to connect a subclass to its superclass. A sub-class is inherited from its superclass.
Generalization relationship can't be used to model interface implementation. Class diagram allows inheriting
from multiple super classes.
Association:
This kind of relationship represents static relationships between classes A and B. For example; an employee works
for an organization.
In this example, the relationship between student and college is shown which is studies.
33 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Multiplicity
A multiplicity is a factor associated with an attribute. It specifies how many instances of attributes are created
when a class is initialized. If a multiplicity is not specified, by default one is considered as a default multiplicity.
Let's say that that there are 100 students in one college. The college can have multiple students.
Aggregation
Aggregation is a special type of association that models a whole- part relationship between aggregate and its
parts.
For example, the class college is made up of one or more student. In aggregation, the contained classes are never
totally dependent on the lifecycle of the container. Here, the college class will remain even if the student is not
available.
Composition:
The composition is a special type of aggregation which denotes strong ownership between two classes when
one class is a part of another class.
For example, if college is composed of classes student. The college could contain many students, while each
student belongs to only one college. So, if college is not functioning all the students also removed.
Aggregation Composition
Aggregation indicates a relationship where the Composition display relationship where the child will never
child can exist separately from their parent class. exist independent of the parent. Example: House (parent)
Example: Automobile (Parent) and Car (Child). So, and Room (child). Rooms will never separate into a House.
if you delete the Automobile, the child Car still
exist.
34 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
ABSTRACT CLASSES
It is a class with an operation prototype, but not the implementation. It is also possible to have an abstract class
with no operations declared inside of it. An abstract is useful for identifying the functionalities across the classes.
Let us consider an example of an abstract class. Suppose we have an abstract class called as a motion with a
method or an operation declared inside of it. The method declared inside the abstract class is called a move ().
This abstract class method can be used by any object such as a car, an animal, robot, etc. for changing the current
position. It is efficient to use this abstract class method with an object because no implementation is provided
for the given function. We can use it in any way for multiple objects.
In UML, the abstract class has the same notation as that of the class. The only difference between a class and an
abstract class is that the class name is strictly written in an italic font.
In the above abstract class notation, there is the only a single abstract method which can be used by multiple
objects of classes.
Creating a class diagram is a straightforward process. It does not involve many technicalities. Here, is an example:
ATMs system is very simple as customers need to press some buttons to receive cash. However, there are multiple
security layers that any ATM system needs to pass. This helps to prevent fraud and provide cash or need details
to banking customers.
Class diagrams can be used in various software development phases. It helps in modeling class diagrams in three
different perspectives.
1. Conceptual perspective: Conceptual diagrams are describing things in the real world. You should draw a
diagram that represents the concepts in the domain under study. These concepts related to class and it is always
language-independent.
3. Implementation perspective: This type of class diagrams is used for implementations in a specific language
or application. Implementation perspective, use for software implementation.
Class diagrams are the most important UML diagrams used for software application development. There are
many properties which should be considered while drawing a Class Diagram. They represent various aspects of
a software application.
Here, are some points which should be kept in mind while drawing a class diagram:
The name given to the class diagram must be meaningful. Moreover, It should describe the real aspect
of the system.
The relationship between each element needs to be identified in advance.
The responsibility for every class needs to be identified.
For every class, minimum number of properties should be specified. Therefore, unwanted properties can
easily make the diagram complicated.
36 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
User notes should be included whenever you need to define some aspect of the diagram. At the end of
the drawing, it must be understandable for the software development team.
Lastly, before creating the final version, the diagram needs to be drawn on plain paper. Moreover, It
should be reworked until it is ready for final submission.
CONCLUSION
UML is the standard language for specifying, designing, and visualizing the artifacts of software systems
A class is a blueprint for an object
A class diagram describes the types of objects in the system and the different kinds of relationships which
exist among them
It allows analysis and design of the static view of a software application
Class diagrams are most important UML diagrams used for software application development
Essential elements of UML class diagram are 1) Class 2) Attributes 3) Relationships
Class Diagram provides an overview of how the application is structured before studying the actual code. It
certainly reduces the maintenance time
The class diagram is useful to map object-oriented programming languages like Java, C++, Ruby, Python,
etc.
Regards,
DBMS / SQL
1. What is DBMS?
A Database Management System (DBMS) is a program that controls creation, maintenance and use of a
database. DBMS can be termed as File Manager that manages data in a database rather than saving it in
file systems.
2. What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS store the data into the collection of
tables, which is related by common fields between the columns of the table. It also provides relational
operators to manipulate the data stored into the tables.
3. What is SQL?
SQL stands for Structured Query Language, and it is used to communicate with the Database. This is a
standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a
database. Standard SQL Commands are Select.
4. What is a Database?
Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data.
This is also known as structured form of data which can be accessed in many ways.
Example: School Management Database, Bank Management Database.
Example:.
Table: Employee.
Field: Emp ID, Emp Name, Date of Birth.
Data: 201456, David, 11/15/1960.
9. What is a join?
This is a keyword used to query data from more tables based on the relationship between the fields of the
tables. Keys play a major role when JOINs are used.
Inner Join.
Inner join return rows when there is at least one match of rows between the tables.
Right Join.
38 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Right join return rows which are common between the tables and all rows of right-hand side table.
Simply, it returns all the rows from the right-hand side table even though there are no matches in the left-
hand side table.
Left Join.
Left join return rows which are common between the tables and all rows of Left-hand side table. Simply,
it returns all the rows from Left hand side table even though there are no matches in the Right-hand side
table.
Full Join.
Full join return rows when there are matching rows in any one of the tables. This means, it returns all the
rows from the left-hand side table and all the rows from the right hand side table.
This should remove all the duplicate columns from the table. Creation of tables for the related data and
identification of unique columns.
Meeting all requirements of the first normal form. Placing the subsets of data in separate tables and
Creation of relationships between the tables using primary keys.
This should meet all requirements of 2NF. Removing the columns which are not dependent on primary key
constraints.
Meeting all the requirements of third normal form and it should not have multi- valued dependencies.
Unique Index.
This indexing does not allow the field to have duplicate values if the column is unique indexed. Unique
index can be applied automatically when primary key is defined.
39 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Clustered Index.
This type of index reorders the physical order of the table and search based on the key values. Each table
can have only one clustered index.
NonClustered Index.
NonClustered Index does not alter the physical order of the table and maintains logical order of data. Each
table can have 999 nonclustered indexes.
25. What are local and global variables and their differences?
40 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
Local variables are the variables which can be used or exist inside the function. They are not known to
the other functions and those variables cannot be referred or used. Variables can be created whenever
that function is called.
Global variables are the variables which can be used or exist throughout the program. Same variable
declared in global cannot be used in functions. Global variables cannot be created whenever that function
is called.
45. How can you create an empty table from an existing table?
Example will be -.
42 | M C 1 0 0 4 0 2 1 8 0 – M U H A M M A D B A B A R
49. What is the command used to fetch first 5 characters of the string?
Regards,
SQL COMMANDS
SQL is a programming language for Relational Databases. It is designed over relational algebra and tuple
relational calculus. SQL comes as a package with all major distributions of RDBMS.
SQL comprises both data definition and data manipulation languages. Using the data definition
properties of SQL, one can design and modify database schema, whereas data manipulation properties
allows SQL to store and retrieve data from database.
SQL Commands:
The standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT,
UPDATE, DELETE and DROP. These commands can be classified into groups based on their nature:
DROP Deletes an entire table, a view of a table or other object in the database.
The DDL section is used for creating database objects, such as tables. In practice, people often use a GUI
for creating tables and so on, so it is less common to hand-write DDL statements than it used to be.
SQL uses the following set of commands to define database schema
CREATE
Creates new databases, tables and views from RDBMS.
DROP
Drops commands, views, tables, and databases from RDBMS. For example−
ALTER
Modifies database schema.
DELETE
DELETE removes some rows if WHERE clause is used
DROP
Removes a table from the database. Table structures, indexes, privileges, constraints will also be
removed.
TRUNCATE
It Removes all rows from a table, but the table structures and its columns, constraints, indexes remain.
SQL is equipped with data manipulation language (DML). DML modifies the database instance by inserting,
updating and deleting its data. DML is responsible for all froms data modification in a database. SQL contains
the following set of commands in its DML section −
SELECT/FROM/WHERE
INSERT INTO/VALUES
UPDATE/SET/WHERE
DELETE FROM/WHERE
These basic constructs allow database programmers and users to enter data and information into the
database and retrieve efficiently using a number of filter options.
SELECT/FROM/WHERE
SELECT − This is one of the fundamental query commands of SQL. It is similar to the projection
operation of relational algebra. It selects the attributes based on the condition described by WHERE clause.
FROM − This clause takes a relation name as an argument from which attributes are to be
selected/projected. In case more than one relation names are given, this clause corresponds to Cartesian
product.
WHERE − This clause de ines predicate or conditions, which must match in order to qualify the
attributes to be projected.
SELECT column1, column2, ...
FROM table_name;
INSERT INTO/VALUES
This command is used for inserting values into the rows of a table (relation). Syntax−
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
UPDATE/SET/WHERE
This command is used for updating or modifying the values of columns in a table (relation).
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE/FROM/WHERE
This command is used for removing one or more rows from a table (relation).
<?php
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("testdb", $conn);
?>
Here
localhost is host name
root is user name
“” password is empty
testdb is database name
Regards,