Software Design- v3
Software Design- v3
ITSE4306 – Software
Design
Dr Ghassan Abu Samhadana &
Dr Khaled Ismail
1
9/25/2022
Object-Oriented Thinking
Object-oriented thinking involves:
1) examining the problems or concepts at hand,
2) breaking them down into component parts,
3) and thinking of those as objects.
• For example, a tweet on Twitter or a product on an online shopping website could
be considered objects.
• Objects may have specific details associated with them, which are relevant to
users.
• A person object may have details such as name, age, gender, and occupation.
• Objects might also have behaviours or responsibilities associated with them.
• A person may have associated behaviours such as sitting down or typing.
• An electronic device may be responsible to power on or off, or to display an image.
2
9/25/2022
3
9/25/2022
Requirements
• Requirements are conditions or capabilities that must be implemented in a
product, based on client or user request.
• Eliciting requirements involves actively probing the client vision, clarifying what
may not have been told, and asking questions about issues the client may not have
even considered.
• It is also important to establish potential trade-offs the client may need to make in
the solution.
• For example, a client may decide to sacrifice a feature in order to ensure that a
program runs faster, if speed is an important need.
• Once requirements and trade-offs are established, they may serve as the
foundation for design.
• To better understand requirements, imagine you are an architect building a house.
Design
• When the initial set of requirements has been created, the next step in the process
is to produce a conceptual design and a technical design.
• Conceptual designs are created with an initial set of requirements as a basis.
• The conceptual design recognizes appropriate components, connections, and
responsibilities of the software product.
• Conceptual designs outline the more high-level concepts of your final software
product.
• Conceptual designs are expressed or communicated through conceptual mock-
ups.
• These are visual notations that provide initial thoughts for how requirements will be
satisfied.
• Mock-ups for software involving user interfaces are often presented as
wireframes, which are a kind of blueprint or basic visual representation of the
product.
4
9/25/2022
Design
• Conceptual mock-ups help to clarify design decisions with clients and users by
providing a simple way to illustrate and discuss how a product will work.
• Mock-ups illustrate major components and connections, or relations
between the components.
• Once you start to create a mock-up, you may more easily see what
components are missing or may not work.
• These flaws would require further clarification with your client or involve
additional conceptual design work.
• Every component also has a task it needs to perform. This is known as its
responsibility.
• Mock-ups do not outline technical details, because that falls outside the
scope of conceptual design.
• Best practice is to form the conceptual design before moving on to the technical design.
• The clearer the conceptual design, the better the technical design, and the more likely
your software will be built right.
Technical Design
• Technical designs build on conceptual designs and requirements to define the
technical details of the solution.
• In the conceptual design, the major components and connections as well as their
associated responsibilities of the software being developed are outlined.
• The technical design brings this information to the next stage—it aims to describe
how these responsibilities are met.
• The technical design is not finished until each component has been refined to be
specific enough to be designed in detail.
• Technical designs begin by splitting components into smaller and smaller
components that are specific enough to be designed in detail.
• By breaking down components, each with specific responsibilities, you get down to
a level where you can do a detailed design of a particular component.
• The final result is that each component will have their technical details specified.
5
9/25/2022
Technical Design
• In order to communicate technical design, technical diagrams are used.
• Technical diagrams visualize how to address specific issues for each component, as
conceptual mock-ups are generally not specific enough to capture this
information.
• A kitchen is a component of a house on its own, but it will require further smaller
components, such as flooring.
• The technical design may indicate that the flooring will need to be made of a material
that is easy to clean, particularly if the client plans on doing a lot of cooking— cooking
can be a messy business!
6
9/25/2022
7
9/25/2022
Satisfying Qualities
• Qualities are achieved through satisfying functional and nonfunctional
requirements, which in turn are the basis for the design process.
• Functional requirements describe what the system or application is expected to
do.
• A key quality to achieve by satisfying a functional requirement is that of
correctness.
• For example, if you are designing a music app, the app must be able to download and
play a song.
• The design needs to be able to outline a solution that correctly meets this requirement.
• Non-functional requirements specify how well the system or application does
what it does.
• Non-functional requirements to satisfy might include performance, resource
usage, and efficiency; these requirements can be measured from the running
software.
•For example, the music app may have non-functional requirements to download music
only to a certain memory limit.
Satisfying Qualities
• Other qualities that software often satisfies in non-functional requirements
include reusability, flexibility, and maintainability.
• This helps inform how well the code of software can evolve and allow for future
changes.
• Reviews and tests should also be used to verify that required qualities on design
and software implementation are satisfied.
• Some qualities may also be validated with feedback from end users.
• Software must satisfy qualities that matter to users as well as developers.
• How the software structure is organized may affect the quality of performance, as
understood by users,
• and the qualities of reusability and maintainability, as understood by developers.
8
9/25/2022
Satisfying Qualities
Some common trade-offs in qualities for software design:
• Performance and maintainability – High performance code may be less clear and less
modular, making it harder to maintain.
Alternately, extra code for backward compatibility may affect both performance and
maintainability.
• Performance and security – Extra overhead for high security may lessen
performance.
• It is important to prioritize and understand what qualities are needed.
• A good question to ask to help you determine what compromises can be made is:
Is there a way to cut back on a certain quality to balance another?
• To develop the product, qualities must be balanced with resources available such
as cost, time, and manpower.
9
9/25/2022
OBJECT-ORIENTED MODELLING
Entity-
Relationship
Data Flow Procedural
Diagram
Diagram Design
Interface
Data Dictionary
Design
Architectural
State-Transition
Diagram
Design
10
9/25/2022
Data Design
• Created by transforming the analysis information model (data dictionary and
ERD) into data structures required to implement the software.
• Part of the data design may occur in conjunction with the design of software
architecture.
• More detailed data design occurs as each software component is designed.
Data
Dictionary
Data Design
Entity Relationship
Diagram
11
9/25/2022
Architectural Design
Defines:
• The relationships among the major structural
elements of the software
• The “design patterns” than can be used to
achieve the requirements that have been
defined for the system
• The constraints that affect the way in which
the architectural patterns can be applied.
• It is derived from the system
• specification, the analysis model, and the
subsystem interactions defined in the
analysis model (DFD). Dataflow Diagram
Architectural Design
12
9/25/2022
Interface Design
• Describes how the software
elements communicate with each
other, with other systems and with
human users
Procedural/Component-level Design
• Created by transforming the structural elements defined by the software
architecture into procedural descriptions of software components.
• Uses information obtained from :
• Process specification (PSPEC)
• Use cases, FlowCharts, Activity Diagrams…
• Control specification (CSPEC)
• State Transition Diagram (STD), Decision tables …
13
9/25/2022
14
9/25/2022
Abstraction
• Abstraction breaks a concept down into a simplified description that ignores
unimportant details and emphasizes the essentials needed for the concept, within
some context.
• Essential attributes and behaviours should be captured with no surprises and no
definitions that fall beyond its scope.
• In object-oriented modelling, abstraction pertains most directly to the notion of a
class.
• When abstraction is used to determine the essential details for some concept, those
details may be defined in a class.
• Any object created from a class has the essential details to represent an instance
of some concept, but it may have some individual characteristics as well.
• Designer choose the most appropriate abstraction to the context of the software
development, and the context must be understood before creating an abstraction.
Abstraction
• The essential characteristics of an abstraction can be understood in two ways:
through basic attributes and through basic behaviours or responsibilities.
15
9/25/2022
Encapsulation
• This principle involves a concept that allows something to be contained in a
capsule, some of which you can access from the outside and some of which you
cannot.
• There are three ideas behind encapsulation. These are:
• The ability to “bundle” attribute values (or data) and behaviours (or functions) that
manipulate those values, into a self-contained object.
• The ability to “expose” certain data and functions of that object, which can be
accessed from other objects, usually through an interface.
• The ability to “restrict” access to certain data and functions to only within the object.
• The principle of abstraction helps determine what attributes and behaviours are
relevant about a concept in a determined context.
• Encapsulation keeps software modular and easy to work with.
• Classes are easy to manage, as their internal behaviour is not relevant to other
classes, as long as they can interface together.
Decomposition
• It consists of taking a whole thing, and dividing it into different parts.
• Alternately, decomposition can also indicate taking separate parts with different
functionalities and combining them to create a whole.
• Decomposition allows problems to broken into smaller pieces that are easier to
understand and solve.
• The general rule for decomposition is to look at the different responsibilities of a
whole and evaluate how the whole can be separated into parts that each have a
specific responsibility.
• Each of these parts are in fact separate objects that can be created from separate
classes in your design.
• In this way, decomposition is similar to abstraction where you are dividing a whole
into objects with essential characteristics.
16
9/25/2022
Generalization
• Generalization helps reduce redundancy when solving problems.
• In coding, algorithmic behaviours are often modelled through methods.
• A method allows a programmer to generalize a behaviour, so the behavior can be
applied to different input data.
• This generality reduces the need to have identical code throughout a program.
• Object-oriented modelling achieves generalization by classes through inheritance.
• In generalization we take repeated, common, or shared characteristics between
two or more classes and factor them out into another class.
• Both methods and inheritance exemplify the generalization design principle
through the D.R.Y. or “Don’t Repeat Yourself” rule.
Abstraction Example
• Abstraction can be applied at the design level using UML class diagrams. The
design is eventually turned into code.
• CRC cards capture components in systems design. Components can eventually be
refined into functions, classes, or collections of other components.
An example of a CRC card, as abstracted for a food item
in the context of a grocery store.
17
9/25/2022
Abstraction Example
• Every concept or class in a class diagram is represented with a box.
• The class name is the same as the class name in your ▪ In the example above, food objects have a
Java class. method to return if it is on sale or not. This
• The properties section is equivalent to Java’s member method has been named “isOnSale”.
variables. ▪ The method will return a boolean to represent if
it is on sale. A Boolean value is either true or
• Variable types can be classes or primitive types.
<variable name>:<variable type> false. The isOnSale operation takes no parameter,
so no parameter list is included.
• The operations section is equivalent to Java’s methods. This
▪ If you were to add a parameter to the operation,
section defines the behaviours of the abstraction.
<name>( <parameter list> ) : <return type> such as a date in this case, the parameter would
follow the same template as the class diagram’s
properties. The final section would read:
isOnSale(date: Date) : Boolean
Abstraction Example
• Class diagrams distinguish a difference between responsibilities that become
properties and responsibilities that become operations, whereas CRC cards list
them together.
• Helping distinguish this ambiguity makes class diagrams easier to translate into
code for a programmer.
• we can see how easy it is to turn a class diagram into a class in Java.
• It is possible to use this mapping in reverse to turn code into class diagrams.
public class Food {
public String groceryID;
public String name;
public String manufacturer;
public Date expiryDate;
public double price;
public boolean isOnSale( Date date ) {
}
}
18
9/25/2022
Encapsulation Example
The design principle of encapsulation involves three ideas:
• Data and functions that manipulate that data are “bundled” into a self-contained
object.
• Data and functions of the object can be exposed or made accessible from other
objects.
• Data and functions of the object can be restricted to only within the object.
• In a UML class diagram, encapsulation is expressed by having all of the object’s
relevant data defined in attributes of the class, and by providing specific methods
to access those attributes.
• UML class diagrams can express encapsulation. The class diagram itself already
bundles data and functions in a self-contained object.
• However, access and restriction (two aspects of visibility) can be represented as
well, through the use of symbols – and +.
Encapsulation Example
Example of a UML class diagram for a student.
• The minus sign indicates that a method or attribute is private and can only be accessed from within
the class.
• The plus sign indicates that a method can be accessed publicly. In this case, the public methods can be
used to manipulate the student’s GPA.
• Encapsulation in UML class diagrams helps you determine the “gate” to controlling data, by using only public
methods to access the data attributes of the class.
19
9/25/2022
Decomposition
• The design principle of decomposition takes a whole thing and divides it into
different parts.
• It also does the reverse, and takes separate parts with different
functionalities, and combines them to form a whole.
• There are three types of relationships in decomposition, which define the
interaction between the whole and the parts:
▪ Association
▪ Aggregation
▪ Composition
Association
• Association indicates a loose relationship between two objects, which may interact
with each other for some time.
• They are not dependent on each other—if one object is destroyed, the other can
continue to exist, and there can be any number of each item in the relationship.
• One object does not belong to another, and they may have numbers that are not
tied to each other.
• An example of an association relationship could be a person and a hotel.
• A person might interact with a hotel but not own one. A hotel may interact with
many people.
20
9/25/2022
Association
• Association is represented in UML diagrams as below:
• The straight line between the two UML objects denote that there is a relationship
between the two UML objects of person and hotel, and that relationship is an
association.
• The “zero dot dot star” (0…*) on the right side of the line shows that a Person
object is associated with zero or more Hotel objects, while the “zero dot dot star”
on the left side of the line shows that a Hotel object is associated with zero or
more Person objects.
Association
• Association can be represented in Java code as well.
• In this code excerpt, a student is passed a sport object to play, but the student
does not possess the sport. It only interacts with it to play.
• The two objects are completely separate, but have a loose relationship.
• Any number of sports can be played by a student and any number of students can
play a sport.
21
9/25/2022
Aggregation
• Aggregation is a “has-a” relationship where a whole has parts that belong to it.
Parts may be shared among wholes in this relationship.
• Aggregation relationships are typically weak, however. This means that although
parts can belong to wholes, they can also exist independently.
• An example of an aggregate relationship is that of an airliner and its crew.
• The airliner would not be able to offer services without the crew. However, the
airliner does not cease to exist if the crew leave. The crew also do not cease to
exist if they are not in the airliner.
• Aggregation can be represented in UML class diagrams with the symbol of an
empty diamond as below:
Aggregation
• In this diagram, a straight line is used again to symbolize a relationship between the
Airliner object, and the Crew Member object.
• In this case, the “zero dot dot star” on the right side of the line indicates that a Airliner
object might have zero or more crew members.
• The “zero dot dot star” on the left side of the line indicates that a Crew Member object
can be had by zero or more
• Airliner objects. The empty diamond indicates which object is considered the whole
and not the part in the relationship.
22
9/25/2022
Aggregation
• Aggregation can be represented in Java code as well.
Composition
• Composition is one of the most dependent of the decomposition relationships.
• This relationship is an exclusive containment of parts, otherwise known as a strong
“has-a” relationship.
• In other words, a whole cannot exist without its parts, and if the whole is
destroyed, then the parts are destroyed too.
• In this relationship, you can typically only access the parts through its whole.
Contained parts are exclusive to the whole.
• An example of a composition relationship is between a house and a room. A house
is made up of multiple rooms, but if you remove the house, the room no longer
exists.
23
9/25/2022
Composition
Composition can be represented with a filled-in diamond using UML class diagrams,
as below:
• The lines between the House object and the Room object indicates a relationship
between the two.
• The filled-in diamond next to the House object means that the house is the whole in
the relationship.
• If the diamond is filled-in, it symbolizes that the “has-a” relationship is strong.
• The two objects would cease to exist without each other.
• The one “dot dot star” indicates that there must be one or more Room objects for
the House object.
Composition
• Composition can be represented using Java code as well.
• In this example, a Room object is created at the same time that the House object
is, by instantiating the Room class.
• This Room object does not need to be created elsewhere, and it does not need to
be passed in when creating the House object.
• The two parts are tightly dependent with one not being able to exist without the
other.
24
9/25/2022
Generalization
• The design principle of generalization takes repeated, common, or shared
characteristics between two or more classes and factors them out into another
class, so that code can be reused, and the characteristics can be inherited by
subclasses.
Generalization
• It is possible to translate UML class diagrams into code.
25
9/25/2022
26
9/25/2022
Coupling
• Coupling focuses on complexity between a module and other modules.
• Coupling can be balanced between two extremes: tight coupling and loose
coupling.
• If a module is too reliant on other modules, then it is “tightly coupled” to others.
This is a bad design.
• If a module finds it easy to connect to other modules through well-defined
interfaces, it is “loosely coupled” to others. This is good design.
• In order to evaluate the coupling of a module, the metrics to consider are: degree,
ease, and flexibility.
• Degree is the number of connections between the module and others. The degree
should be small for coupling.
• For example, a module should connect to others through only a few parameters or
narrow interfaces. This would be a small degree, and coupling would be loose.
Coupling
• Ease is how obvious are the connections between the module and others.
• Connections should be easy to make without needing to understand the
implementations of other modules, for coupling purposes.
• Flexibility indicates how interchangeable the other modules are for this module.
• Other modules should be easily replaceable for something better in the future, for
coupling purposes.
Signs that a system is tightly coupled and has a bad design are:
• a module connects to other modules through a great number of parameters or
interfaces
• corresponding modules to a module are difficult to find
• a module can only be connected to specific other modules and cannot be
interchanged
27
9/25/2022
Cohesion
• Cohesion focuses on complexity within a module, and represents the clarity
of the responsibilities of a module.
• Like complexity, cohesion can work between two extremes: high cohesion
and low cohesion.
• A module that performs one task and nothing else, or that has a clear
purpose, has high cohesion. A good design has high cohesion.
• If a module encapsulates more than one purpose, if an encapsulation has to
be broken to understand a method, or if the module has an unclear purpose,
it has low cohesion. A bad design has low cohesion.
• If a module has more than one responsibility, it is a good idea to split the
module.
28
9/25/2022
Separation of Concerns
• Decomposition divides a whole into different parts.
• To understand why decomposition is necessary in design, the principle of
separation of concerns must be examined.
• Separation of concerns is about keeping the different concerns in your design
separate.
• When software is designed, different concerns should be addressed in different
portions of the software.
Separation of concerns provides many advantages:
▪ They allow you to develop and update sections of the software independently.
▪ you do not need to know how all sections of code work in order to update a section.
▪ allows changes to be made to one component without requiring a change in another.
Separation of Concerns
• When addressing concerns separately, more cohesive classes are created and the
design principles of abstraction, encapsulation, decomposition, and generalization
are enforced:
• Abstraction occurs as each concept in the problem space is separated with its own
relevant attributes and behaviours.
• Encapsulation occurs as the attributes and behaviours are gathered together into
their own section of code called a class.
Access to the class from the rest of the system and its implementation are separated,
so details of implementation can change while the view through an interface can stay
the.
• Decomposition occurs as a whole class can be separated into multiple classes.
• Generalization occurs as commonalities are recognized, and subsequently separated
and generalized into a superclass.
29
9/25/2022
Separation of Concerns
• Using separation of concerns in software design creates a system that is
easier to maintain.
• Because each class is organized so that the class only contains the code that it needs to
do its job.
• Modularity is increased in turn, which allows developers to reuse and build up
individual classes without affecting others.
• It is important to note that the boundaries of each class will not always be obvious
in practice.
• Deciding how to abstract, encapsulate, decompose, and generalize to address the
many concerns for a given problem is at the core of designing modular software.
30
9/25/2022
31
9/25/2022
32
9/25/2022
Conceptual Integrity
• Conceptual integrity is a concept related to creating consistent software.
• Conceptual integrity entails making decisions about the design and
implementation of a software system,
• so even if multiple people work on it, it would seem cohesive and consistent as if only
one mind was guiding the work.
There are multiple ways to achieve conceptual integrity. These include:
❑ communication
❑ code reviews
❑ using certain design principles and programming constructs
❑ having a well-defined design or architecture underlying the software
❑ unifying concepts
❑ having a small core group that accepts each commit to the code base.
• Practicing conceptual integrity helps guide the software development team by
making the design and logic of the software consistent and easy to follow for any
team member.
▪ Effective communication maintains conceptual integrity and allows team members to discuss and agree to use
certain libraries or methods when addressing certain issues. This in turn helps create more consistent code.
▪ Some good practices to foster communication include agile development practices like daily stand-up meetings
and sprint retrospectives.
▪ Code reviews are systematic examinations of written code. Developers go through code line by line and
uncover issues in each other’s code.
▪ This helps identify mistakes in the software, but it also helps create consistency among different developers’
code.
▪ Using certain design principles and programming constructs helps maintain conceptual integrity.
▪ Java interfaces are a construct that can accomplish this. [also, design patterns]
▪ While software design is typically associated with guiding the internal design of software running as a single
process, software architecture describes how software running as multiple processes work together and how
they relate to each other. This helps create consistency.
▪ Unifying concepts involves taking different concepts and finding a commonality, so that each concept can be
seen and treated in similar ways. For example, in the Unix, every resource can be seen and manipulated as if it
were a file.
▪ Having a small core group that accepts each commit to the code base. This is similar to exercising code reviews,
but it restricts the review to only core members of the software team. These members are responsible for
ensuring that any software changes follow the overall architecture and design of the software.
33
9/25/2022
Generalization Principles
• Generalization and inheritance are some of the more difficult topics to master in
object-oriented programming and modelling.
• Inheritance is a powerful design tool that can help create clean, reusable, and
maintainable software systems.
• However, its misuse can lead to poor code. If design principles are used improperly,
they may create more problems than they solve.
Generalization Principles
• For example, an employee is a general type for managers, salespeople, and cashiers,
but each of those subtypes of employee perform specific functions. Inheritance
makes sense in this case.
• However, if you are creating different kinds of pizza, there is no true specialization
between different kinds of pizza, so subclasses are unnecessary.
• Another technique is determining if the Liskov substitution principle is broken.
• The principle states that a subclass can replace a superclass, if and only if, the subclass
does not change the functionality of the superclass.
• This means that if a subclass replaces a superclass, but replaces all the superclass
behaviours with something totally different, then inheritance is being misused.
• For example, if a Whale class which exhibits swimming behaviour is substituted for an
Animal class, then functions such as running and walking will be overridden.
• The Whale no longer behaves in the way we would expect its superclass to behave,
violating the Liskov substitution principle.
34
9/25/2022
35
9/25/2022
36
9/25/2022
37
9/25/2022
38
9/25/2022
Model Checking
• Model checking is a systematic check of your system’s state model in all its possible
states.
• Model checking helps find errors that other tests cannot.
• In model checking, you check all the various states of the software to try and
identify any errors, by simulating different events that would change the states and
variables of the software.
• This will help expose any flaws by notifying you of any violation of the rules that
occur in the behaviour of the state model.
• Typically, model checks are performed by model checking software.
• There are different types of software available for such tests, some of which are free and
available for developers using different languages.
• Model checking is typically performed during testing of the software.
Model Checking
• Imagine software that has a rule not to produce a deadlock.
• Deadlock is a situation where the system cannot continue because two tasks are waiting
for the same resource.
• The model checker would simulate the different states that could occur in your
system, and if a deadlock was possible, it would provide details of this violation.
Let us go through the process for model checking software.
▪ Model checkers begin by generating a state model from your code.
• A state model is an abstract state machine that can be in one of various states.
▪ The model checker then checks that the state model conforms to be certain
behavioural properties.
• For example, the model checker can examine the state model for flaws like race conditions,
exploring all the possible states of your model.
39
9/25/2022
Model Checking
There are three different phases in model checking:
❑The first is the modelling phase.
• During this phase, the model description is entered in the same programming
languages as the system. Any desired properties are also described.
• This phase also performs sanity checks. Sanity checks are quick checks that should be
easy to do, as they come from clear and simple logic.
• It is beneficial to test for these simple errors before using model checkers, so the focus
can be on specifying the more complex properties to check.
• Sanity checks might include something as simple as turning the system on and off.
❑The second phase is the running phase.
• The running phase is when the model checker is run to see how the model conforms to
the desired properties described in the modelling phase.
Model Checking
❑The third and final phase is the analysis phase.
• This phase is when all desired properties are checked to be satisfied, and if there are
any violations. Violations are called counterexamples.
• The model checker should provide descriptions of violations in the system, so you can
analyze how they occurred.
• Information provided by the model checker allows you to revise your software and
fix any problems.
• Once problems are fixed, it is good practice to run the model checker again.
• Repeat this process until you are sure the software is correct with respect to the
desired properties.
• Model checking helps ensure not only that software is well designed, but also that
software meets desired properties and behaviour, and it works as intended.
40
9/25/2022
Software Architecture
41
9/25/2022
42
9/25/2022
43
9/25/2022
44
9/25/2022
Component Diagrams
• UML component diagrams are concerned with the components of a system.
• Components are the independent, encapsulated units within a system.
• Each component provides an interface for other components to interact with it.
• Component diagrams are used to visualize how a system’s pieces interact and what
relationships they have among them.
• Component diagrams are different from most other diagrams, as they show high-level
structure and not details like attributes and methods.
• They are purely focused on components and their interactions with each other.
• Component diagrams are a static view of the software system, and depict the
system design at a specific point in its development and evolution.
• Each component in a diagram has a very specific relationship to the other
components through the interface it provides.
45
9/25/2022
Component Diagrams
• Component diagrams have ball connectors, which represent a provided interface.
• A provided interface shows that a component offers an interface for
others to interact with it.
• The provided interface means that client and consumer components
have a way of communicating with that component.
• Component diagrams also have socket connectors that display a required interface.
• The required interface is essential to the component diagram, to show
that a component expects a certain interface.
• This required interface is to be satisfied or provided by some other
component.
Component Diagrams
❖To build a component diagram:
▪ First, you must identify the main objects used in the system.
▪ Next, the relevant libraries for the system need to be identified.
▪ Finally, the relationship between these components would need to be identified.
▪ When relevant libraries are identified, this extends to third-party implementation
dependencies, which should also be integrated into the diagram where relevant.
▪ Component diagrams are especially useful early in the design process, because of its high-
level emphasis.
▪ They can be drawn at different levels and allows you to focus not only on systems but on
subsystems as well.
46
9/25/2022
Package Diagrams
• Sometimes, classes in object-oriented software are related in some way.
• A package groups together elements of software that are related.
• Elements can be related based on data, classes, or user tasks.
• A package can also define a “namespace” for elements it contains, that is, a package
is named and can organize the named elements of software into a separate scope.
• An element can be uniquely identified in the system by a fully “qualified name” that
is based on its own name and the name of the package that the element is in.
• Package diagrams show packages and the dependencies between them.
• These diagrams can organize a completed system into packages of related
packageable elements, which could include data, classes, or even other packages.
• Package diagrams help provide high-level groupings of a system so that it is easy to
see how a package contains related elements as well as how different packages
depend on each other.
Package Diagrams
• An example of a package diagram for a video game:
❖ Package diagrams can be
created at any stage of
development.
❖ They can also adapt and change
with the latest version of
software being worked on.
❖ Package diagrams are
particularly useful for technical
designers because they allow
them to see the dependencies
and relations between groups of
related elements.
47
9/25/2022
• Notice in the above example that plus (+) and minus (-) signs
have been used to indicate if elements are public or private.
• Public elements can be accessed outside of the package by their
fully qualified names.
• Relationships are denoted through dotted-line arrows.
• A package can import an element from another package, as in the
example below where the Level package is importing Location from
the Player package.
• This brings the name Location into the Level namespace, particularly
for convenient use by elements in Level.
• As the import tag is public, the name is visible for further import
through the Level package.
• If a tag was private, the name would only be visible by elements within
the Level namespace and not further outside.
48
9/25/2022
Deployment Diagram
• UML deployment diagrams are used to visualize the deployment details of a
software system.
• The diagrams include more than just code, but also separate libraries, an installer,
configuration files, and many other pieces.
• In order for software to be ready to run, it is necessary to understand all the files
and executables involved and the environments where they reside.
• The deployment environment, or deployment target, can be very specific and
involve particular hardware devices.
• It can also be very general and involve supported operating systems.
• Details in a deployment diagram change accordingly.
• For example, software developed for Linux, MacOS or Windows may have differences
from one another.
49
9/25/2022
Deployment Diagram
• Deployment diagrams deal with artifacts. Artifacts are a physical result of the
development process.
▪ Artifacts for a video game might include things like an executable to run the game, an
installer to install the game, audio libraries for sound, and multimedia assets.
▪ These are created as outcomes of producing the system and are the final pieces to be
put together.
❑There are two different types of deployment diagrams:
• specification-level diagrams
• instance level diagrams
• A specification-level diagram provides an overview of artifacts and deployment
targets, without referencing specific details like machine names.
• It focuses on a general overview of your deployment rather than the specifics.
Deployment Diagram
• An instance-level diagram is a more specific approach that maps specific artifacts to
specific deployment targets.
• They can identify specific machines and hardware devices.
• This approach is usually used to highlight the differences in deployments among
development, staging, and release builds.
• When creating deployment diagrams, it is important to use the correct notation for
the various elements.
• One of the most important aspects of the deployment diagram is the node.
• Nodes are deployment targets that contain artifacts available for execution.
• In a deployment diagram, they look like 3D boxes.
• Hardware devices are also displayed as 3D boxes, only they have a “device” tag on
them to differentiate them.
• A solid line between two nodes shows a relationship between deployment targets.
The line shows that the two nodes have a communication path between them.
50
9/25/2022
Deployment Diagram
51
9/25/2022
Deployment Diagram
• In a deployment diagram, there is a distinct hierarchy of deployment targets.
▪ You should start from the highest level of your deployment information, from
application name down to device and operating system.
▪ In this example, the application, the device, the operating system, and the execution
environment are all listed.
▪ When you look at each of these nodes, it is clear what environment is necessary to run
the application.
• Deployment diagrams help provide consistency and organization to deployments,
which helps avoid system failures.
• The diagrams also help keep track of the files and executables needed to deploy and
run the software.
• The diagram can be on an instance level specific to the deployment machines you
are using, or it can be general for a range of execution environments.
Activity Diagram
• A UML activity diagram allows the representation of the control flow from activity to
another in a software system.
• It captures the dynamic behaviour of the system and allows the mapping of
branching into alternative flows.
• Activities are actions that further the flow of execution in a system.
• They are actions that when completed cause another action to execute.
• For example, an action can alter or create new objects. These changes or actions can
drive your application forward.
To create an activity diagram, you must:
1. Identify the activities.
2. Identify the respective conditions of the system’s activities.
• Once activities and respective conditions have been determined, the activity
diagram can be created.
52
9/25/2022
• Activity diagrams allow you to see what activities and conditions should
be included in a system.
• As well, from the diagrams you see the order in which features are
encountered while also allowing for alternate flows to be taken into
account for the system.
53
9/25/2022
Architecture Styles
54