Uploaded by addo negn

SETP INDV ASSIGNMENT

advertisement
1
JIMMA UNIVERSITY
JIMMA INSTITUTE OF TECHNOLOGY
FACULTY OF COMPUTING AND INFORMATICS
Software engineering tools and practice
Individual Assignment for
Software engineering ||| year student
Name
adane desta
Id …………RU1825/14
Section 01
Sub_date.
Dec. 29-2023
SUBT.TO MR.
1
2
#1. Explain the concept of "Design Patterns" in software development.
Choose one design pattern (e.g., Observer, Factory) and describe its
purpose, structure, and common use cases
Answer and explanation
 BASIC CONCEPTS OF DESIGN PATTERNS
 Design patterns
are reusable solutions to common software
development problems. They provide a template for solving a problem
that can be adapted to different contexts. One of the most commonly
used design patterns is the Observer pattern.
 Observer pattern software development

The Observer pattern is a design pattern that provides a way to
notify multiple objects about any state changes in another object.

It is a behavioral pattern that defines a one-to-many dependency
between objects. When one object changes state, all its dependents
are notified and updated automatically.
 purpose of the Observer pattern
2

The purpose of the Observer pattern is to provide a template for
solving a problem that can be adapted to different contexts.

It is useful when there are many objects that need to be notified of
changes in a single object.
3

It also helps to reduce coupling between objects, making it easier to
modify and maintain the code.

This pattern is useful when there are many objects that need to be
notified of changes in a single object.
 structure of the Observer pattern

The observer pattern consists of two main components:
1) The Subject and
2) The Observer

The Subject maintains a list of its dependents, called Observers,
and notifies them automatically of any state changes.

The Observer defines an interface for receiving notifications
from the Subject.
 COMMON USE CASE OF OBSERVER PATTERN

A common use case for the Observer pattern is in user interfaces.

For example, when a user interacts with a graphical user
interface (GUI), the GUI components need to be updated
automatically to reflect any changes in the underlying data.
 The Observer pattern can be used to implement this behavior.
3
4
#2. Elaborate on the importance of user-centered design in software
development. Provide examples of design principles (e.g., feedback,
affordance) and explain how they contribute to a positive user
experience.
Answer and explanation
BASIC CONCEPTS OF USE-CENTERED DESIGN IN SOFTWARE
DEVELOPMENT
 User-centered design (UCD) is a philosophy and approach that
places the needs, goals, and preferences of users at the forefront of
software development.
 It is a design process that involves designing and developing software
with a deep understanding of the end-users.
 UCD emphasizes the importance of involving users throughout the
entire software development lifecycle, from research and ideation to
testing and implementation. The goal is to create intuitive, efficient, and
enjoyable software experiences that align with user expectations and
requirements.
 There are several design principles that underlie user-centered design.
Here are some examples:
1) Feedback: Feedback is an essential design principle that provides
users with information about their actions and the system’s response. It
helps users understand what is happening and how to proceed.

4
For example, when a user clicks a button, the system should
provide feedback that the button has been clicked, such as a
change in color or animation.
5
2) Affordance: Affordance is the relationship between an object and
the actions a person can take with that object. It is a design principle
that helps users understand what actions are possible.

For example, a button affords pressing, a door handle affords
pulling or turning, and a smartphone screen affords all types of
interactions like swiping, tapping, pinching, and scrolling.
3) Consistency: Consistency is a design principle that ensures that the
same elements and interactions are used throughout the software. It
helps users understand how to use the software and reduces the
learning curve.

For example, if a button is used to submit a form on one page,
it should be used for the same purpose on all other pages.
4) Visibility: Visibility is a design principle that ensures that the most
important information and actions are visible to the user. It helps users
understand what is happening and how to proceed.

For example, if a user needs to fill out a form, the form fields
should be clearly visible and labeled.
5) Simplicity: Simplicity is a design principle that ensures that the
software is easy to use and understand. It helps users accomplish their
tasks quickly and efficiently.

For example, if a user needs to perform a simple task, the
software should provide a simple and straightforward way to
accomplish it.
 By following these design principles, software developers can create
software that is tailored to the needs and preferences of the end-user.
This can help to improve the user experience, reduce development time
and costs, increase customer satisfaction and loyalty, and identify new
opportunities for innovation and growth.
5
6
#3. Describe the role of software design patterns in the context of
object-oriented programming. Provide examples of how design patterns
can be applied to solve recurring design problems.
Answer and explanation
ROLES OF SOFTWARE DESIGN PATTERNS IN
CONTEXT OF OOP.
 Software Design patterns play a crucial role in object-oriented
programming (OOP). OOP is a popular way to build complex software,
but it can be tricky when you face the same design problems repeatedly.
That’s where design patterns come in. They provide a template for
solving a problem that can be adapted to different contexts. Design
patterns help to reduce coupling between objects, making it easier to
modify and maintain the code.
 Software design patterns are reusable solutions to common software
development problems. They provide a way to organize and structure
code, making it more maintainable and reusable. Design patterns are like
well-known recipes for common problems in software development.
They’re not step-by-step instructions, but more like guidelines to help
you solve these problems in a flexible and efficient way. These patterns
gather the wisdom of the software development community, making it
easier for developers to work together and create software that’s easy to
maintain, adapt, and reuse.
 Here are some examples of how design patterns can be applied to
solve recurring design problems:
1) Singleton pattern: The Singleton pattern is a creational pattern
that ensures a class has only one instance and provides a global point of
access to that instance. This pattern is useful when you need to ensure
that there is only one instance of a class in the system. For example, a
6
7
database connection pool can be implemented using the Singleton
pattern.
2) Factory method pattern: The Factory method pattern is a
creational pattern that provides an interface for creating objects but lets
subclasses decide which classes to instantiate. This pattern is useful
when you need to create objects that share common functionality but
have different implementations. For example, a document editor can use
the Factory method pattern to create different types of documents such
as PDF, Word, or HTML.
3) Observer pattern: The Observer pattern is a behavioral pattern
that defines a one-to-many dependency between objects. When one
object changes state, all its dependents are notified and updated
automatically. This pattern is useful when you need to notify multiple
objects about any state changes in another object. For example, a stock
market application can use the Observer pattern to notify users about
changes in stock prices.
4) Decorator pattern: The Decorator pattern is a structural pattern
that allows behavior to be added to an individual object, either statically
or dynamically, without affecting the behavior of other objects from the
same class. This pattern is useful when you need to add functionality to
an object without changing its interface. For example, a text editor can
use the Decorator pattern to add new formatting options to text.
5) Adapter pattern: The Adapter pattern is a structural pattern that
allows incompatible interfaces to work together. This pattern is useful
when you need to integrate existing code with new code that has a
different interface. For example, a legacy system can use the Adapter
pattern to work with a new system that has a different interface.
 Generally, By using design patterns, developers can create software that
is tailored to the needs and preferences of the end-user. This can help to
improve the user experience, reduce development time and costs,
increase customer satisfaction and loyalty, and identify new
opportunities for innovation and growth.
7
8
#4. Elaborate on the principles of "Don't Repeat Yourself" (DRY) and
"You Aren't Gonna Need It" (YAGNI) in software design. Discuss how
these principles contribute to writing efficient and maintainable code.
Answer and explanation
Don’t Repeat Yourself (DRY) and You Aren’t Gonna Need It (YAGNI) are
two important principles in software design that contribute to
writing efficient and maintainable code.
 The DRY principle states that every piece of knowledge should have a
single, unambiguous, authoritative representation within a system.
 This means that code should not be duplicated, but instead, it should be
abstracted into reusable modules.
 By following the DRY principle, developers can reduce the amount of
code they need to write, which makes the code easier to maintain and
less prone to errors.

For example, if a piece of code is used in multiple places, it
should be abstracted into a function or class that can be
reused.
 The YAGNI principle states that a programmer should not add
functionality until it is necessary.
 This means that developers should avoid writing code that they think
they might need in the future but don’t currently need.
8
9
 By following the YAGNI principle, developers can avoid wasting time and
resources on features that may never be used.
 This principle also helps to keep the codebase simple and easy to
understand.

For example, if a feature is not required for the current version
of the software, it should not be implemented until it is
needed.
 Both principles contribute to writing efficient and maintainable code by
reducing code complexity, improving code readability, and minimizing
the risk of errors.
 By following these principles, developers can create software that is
easier to maintain, modify, and extend over time.
 They also help to reduce development time and costs, increase customer
satisfaction and loyalty, and identify new opportunities for innovation
and growth.
 Generally, the DRY principle helps to reduce code duplication and
improve code reuse, while the YAGNI principle helps to avoid
unnecessary code and keep the codebase simple and easy to
understand.
 By following these principles, developers can create software that is
efficient, maintainable, and adaptable to changing requirements.
9
10
#5. Describe the key considerations and challenges in designing
software for concurrent and parallel processing. Discuss synchronization
mechanisms and strategies to avoid race conditions in concurrent
systems.
Answer and explanation
Concurrent and parallel processing is the ability of a computer
system to execute multiple tasks simultaneously. It is an essential feature
of modern software systems that can improve performance, scalability,
and responsiveness. However, designing software for concurrent and
parallel processing can be challenging due to several factors.
 One of the key considerations in designing concurrent and parallel
software is synchronization. Synchronization is the process of
coordinating the execution of multiple threads or processes to ensure
that they do not interfere with each other.
 Synchronization mechanisms such as locks, semaphores, and monitors
can be used to prevent race conditions, deadlocks, and other
concurrency issues.
 Race conditions occur when two or more threads or processes access
shared data simultaneously, resulting in unpredictable behavior. To
avoid race conditions, developers can use synchronization mechanisms
such as locks, semaphores, and monitors.

Locks are the most basic synchronization mechanism and can be used
to ensure that only one thread or process can access a shared resource
at a time.
 Semaphores are similar to locks but can be used to control access to a
shared resource by multiple threads or processes.
10
11
 Monitors are a higher-level synchronization mechanism that provides a
way to synchronize access to a shared resource and also allows threads
or processes to wait for a condition to be true.
Another key consideration in designing concurrent and parallel software
is scalability. Scalability is the ability of a system to handle increasing
workloads without sacrificing performance.
To achieve scalability, developers can use techniques such as load
balancing, partitioning, and caching. Load balancing involves distributing
workloads across multiple threads or processes to ensure that they are
evenly distributed.
Partitioning involves dividing a large dataset into smaller subsets that
can be processed independently. Caching involves storing frequently
accessed data in memory to reduce the number of disk reads.
Generally, designing software for concurrent and parallel processing
requires careful consideration of synchronization, scalability, and other
factors. Synchronization mechanisms such as locks, semaphores, and
monitors can be used to prevent race conditions and other concurrency
issues.
Techniques such as load balancing, partitioning, and caching can be
used to achieve scalability and improve performance. By following these
best practices, developers can create software that is efficient, reliable,
and scalable.
11
Download