0% found this document useful (0 votes)
8 views

Lecture 2

Uploaded by

ladimuhammadsabo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lecture 2

Uploaded by

ladimuhammadsabo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Sule Lamido University Kafin Hausa

Faculty of Computing & Information


Technology
Department Of Computer
Science
CSC: 433
Software Engineering
Session
2024/2025 Lecture 2
Design Patterns
Design pattern in software engineering is a general
repeatable solution to a commonly occurring problem in
software design. A design pattern isn't a finished design that
can be transformed directly into code. It is a description or
template for how to solve a problem that can be used in many
different situations.

Using these patterns is considered good practice, as the


design of the solution is quite tried and tested, resulting in
higher readability of the final code. Design patterns are quite
often created for and used by OOP Languages, like Java, in
which most of the examples from here on will be written.

1. Creational Design Patterns. 3. Behavioral Design


Patterns.
Uses of Design Patterns
Design patterns can speed up the development
process by providing tested, proven development
paradigms. Effective software design requires considering
issues that may not become visible until later in the
implementation. Reusing design patterns helps to prevent
subtle issues that can cause major problems and improves
code readability for coders and architects familiar with the
patterns.

In addition, patterns allow developers to communicate


using well-known, well understood names for software
interactions. Common design patterns can be improved over
time, making them more robust than ad-hoc designs.
Creational Design
Pattern
These design patterns are all about class instantiation. This
pattern can be further divided into class-creation patterns and
object-creational patterns. While class-creation patterns use
inheritance effectively in the instantiation process, object-
creation patterns use delegation effectively to get the job done.
o Abstract Factory: Creates an instance of several families of
classes.
o Builder: Separates object construction from its representation.
o Factory Method: Creates an instance of several derived
classes
o Object Pool: Avoid expensive acquisition and release of
resources by recycling objects that are no longer in use
Structural Design Patterns

These design patterns are all about Class and Object composition.
Structural class-creation patterns use inheritance to compose interfaces.
Structural object-patterns define ways to compose objects to obtain new
functionality.
o Adapter: Match interfaces of different classes
o Bridge: Separates an object’s interface from its implementation
o Composite: A tree structure of simple and composite objects
o Decorator: Add responsibilities to objects dynamically
o Façade: A single class that represents an entire subsystem
o Flyweight: A fine-grained instance used for efficient sharing
o Private Class Data: Restricts accessor/mutator access
o Proxy: An object representing another object
Behavioral Design Patterns
These design patterns are all about Class's objects communication.
Behavioral patterns are those patterns that are most specifically
concerned with communication between objects.

o Chain of responsibility: A way of passing a request


between a chain of objects
o Command: Encapsulate a command request as an object
o Interpreter: A way to include language elements in a
program
o Iterator: Sequentially access the elements of a collection
o Mediator: Defines simplified communication between
classes
Object-Oriented Analysis and
Design (OOAD)
OOAD is based on the concepts of object-oriented
programming (OOP) and is an organized and systematic approach
to designing and developing software systems. It is a software
engineering paradigm that integrates two distinct but closely
related processes: Object-Oriented Analysis (OOA) and Object-
Oriented Design (OOD).

Object-Oriented Analysis and Design (OOAD) is a way to


design software by thinking of everything as objects similar to real-
life things. In OOAD, we first understand what the system needs to
do, then identify key objects, and finally decide how these objects
will work together. This approach helps make software easier to
manage, reuse, and grow.
Important Aspects of Object Oriented
Analysis and Design

o Object-Oriented Programming: In this the real-world items are


represented/mapped as software objects with attributes and
methods that relate to their actions.
o Design Patterns: Design patterns are used by OOAD to help
developers in building software systems that are more efficient and
maintainable.
o UML Diagrams: UML diagrams are used in OOAD to represent the
different components and interactions of a software system.
o Use Cases: OOAD uses use cases to help developers understand
the requirements of a system and to design software systems that
Object-Oriented Analysis
Object-Oriented Analysis (OOA) is the process of
understanding and analyzing the system requirements by
looking at the problem scenario in terms of objects.

o These objects represent real-world entities or concepts that


are relevant to the system being developed.
o During OOA, the goal is to identify the objects, their
attributes, behaviors, and relationships, without focusing on
how the system will be implemented.
Object-Oriented Design
In the object-oriented software development process, the analysis
model, which is initially formed through object-oriented analysis
(OOA), undergoes a transformation during object-oriented design
(OOD) i.e. implementation of the conceptual model developed in
OOA. This evolution is crucial because it shapes the analysis model
into a detailed design model.
• Data Organization of Attributes:
o OOD involves specifying how data attributes are organized within
the objects.
o This includes determining the types of data each object will hold
and how they relate to one another.
• Procedural Description of Operations:
o OOD requires a procedural description for each operation that an
object can perform.
o This involves detailing the steps or processes involved in carrying
Object-Oriented Design Pyramid

Fig 1: Object-oriented design pyramid


Layers of Object-Oriented
Design Pyramid
1. The Subsystem Layer: It represents the subsystem that enables
software to achieve user requirements and implement technical
frameworks that meet user needs.
2. The Class and Object Layer: It represents the class hierarchies
that enable the system to develop using generalization and
specialization. This layer also represents each object.
3. The Message Layer: This layer deals with how objects interact
with each other. It includes messages sent between objects,
method calls, and the flow of control within the system.
4. The Responsibilities Layer: It focuses on the responsibilities of
individual objects. This includes defining the behavior of each
class, specifying what each object is responsible for, and how it
responds to messages.
Benefits Object-Oriented
Analysis & Design
1. It increases the modularity and maintainability of software by
encouraging the creation of tiny, reusable parts that can be
combined to create more complex systems.
2. It provides a high-level, abstract representation of a software
system, making understanding and maintenance easier.
3. It promotes object-oriented design principles and the reuse of
objects, which lowers the amount of code that must be produced
and raises the quality of the program.
4. Software engineers can use the same language and method that
OOAD provides to communicate and work together more
successfully in groups.
5. It can assist developers in creating scalable software systems that
Real World Applications of Object-Oriented
Analysis and Design(OOAD)
Some examples of OOAD’s practical uses are listed below:

Banking Software: In banking systems, OOAD is frequently used to


simulate complex financial transactions, structures, and customer
interactions. Designing adaptable and reliable financial apps is made
easier by OOAD’s modular and scalable architecture.

Electronic Health Record (EHR) Systems: Patient data, medical


records, and healthcare workflows are all modeled using OOAD.
Modular and flexible healthcare apps that may change to meet
emerging requirements can be made through object-oriented
principles.

Flight Control Systems: OOAD is crucial in designing flight control


Telecom Billing Systems: In the telecom sector, OOAD is used to
model and build billing systems. It enables the modular and scalable
modeling of complex subscription plans, invoicing rules, and client data.

Online Shopping Platforms: E-commerce system development


frequently makes use of OOAD. Product catalogs, user profiles, shopping
carts, and payment procedures are all modeled, which facilitates
platform maintenance and functionality expansion.
Design for Re-use
Design Reuse is the building of software from reusable
components. In most engineering disciplines, systems are
designed by composing existing components that have been
used in other systems. Designing software for reusability is a
fundamental principle in software development. Reusable
software components save time, reduce redundancy, and
improve code quality.
In software engineering reuse can be categorized as the
following:
o Application system reuse
o Component reuse
o Function reuse
Application System Re-use: The whole of an
application system may be reused either
by incorporating it without change into
other systems (COTS reuse) or by Function Reuse: Software
developing application families. Widely components that
practiced as software systems are implement a single
implemented as application families and well-defined function
Commercial Off-The-Shelf systems (COTS) may be reused.
reuse is becoming increasingly common Function reuse is
Component Reuse: Components of an common in some
application from sub-systems to single application domains
objects may be reused. Component reuse (e.g. engineering)
is seen as the key to effective and where domain-specific
widespread reuse through component libraries of reusable
based software engineering. Component functions have been
reuse must allow easy access and retrieval established.
to the components, the component size
BENEFITS OF REUSE
o Increased reliability - Components exercised in working
systems are tried and tested under real conditions.
o Reduced process risk -Less uncertainty in development
costs.
o Effective use of specialists – The components are reused
instead of application experts develop components instead
of repeating the same on multiple projects.
o Standards compliance - Embed standards in reusable
components (e.g. menu format).
o Accelerated development - Avoid original development and
hence speed-up production which may reduce testing time
REQUIREMENTS FOR DESIGN
WITH REUSE
o It must be possible to find appropriate reusable
components
o The re-user of the component must be confident that
the components will be reliable and will behave as
specified.
o The components must be documented so that they
can be understood and, where appropriate, modified.
REUSE PROBLEMS
The challenges encountered during reusing of components are as
follows:
o Increased maintenance costs - If source code of components is
not available, then other parts for modification must be
engineered around the components which are inflexible
o Not-invented-here syndrome - Some developers resist reuse due
to matter of trust, and question of creativity
o Lack of tool support
o Maintaining a component library as an effective library for reuse
can be difficult and expensive
o Finding and adapting reusable components

You might also like