You are on page 1of 8

Anum Zia

BSE-201057

ASSIGNMENT

SOFTWARE ARCHITECTURE AND


DESIGN
Question:
Write Down the definition, Diagram and Practical Example (Software
Related) of the following styles
Generalization, Decomposition, Layered, Aspects & Uses Styles

Generalization:
Generalization is a concept in software development and object-oriented
programming where commonalities among multiple objects or classes are
identified and abstracted into a more general, higher-level construct. It allows
developers to create reusable code structures and design patterns to represent
shared characteristics, reducing redundancy and promoting code maintainability.

Practical Example:
Consider a software application for drawing shapes. You may have various shapes
like circles, squares, and triangles. Generalization can be applied by creating a base
class called "Shape" that defines common properties and methods, such as position
and area calculation. Subclasses like "Circle," "Square," and "Triangle" then inherit
from the "Shape" class, inheriting the shared attributes and methods. This allows
you to generalize the concept of a shape, promoting code reusability and making it
easier to extend the application with new shapes in the future.

Diagram:
Decomposition:
Decomposition, in the context of software development, is a problem-solving and
design technique that involves breaking down a complex problem or system into
smaller, more manageable parts or modules. Each module or component focuses
on a specific, well-defined task, making it easier to understand, develop, and
maintain the software.

Practical Example:
Consider the development of a web-based e-commerce platform. Decomposition in
this context might involve breaking down the system into various modules such as:

1. User Authentication: A module responsible for handling user logins,


registration, and authentication.
2.Product Catalog: A module to manage and display the list of products, their
descriptions, and prices.
3.Shopping Cart: A module that allows users to add and manage items in their
shopping cart.
4.Payment Processing: A module for securely handling payment transactions.
5.Order Management: A module to manage user orders, order history, and
shipping details.

By decomposing the system into these modules, each can be developed and tested
independently, making it easier to maintain and enhance the e-commerce platform
as a whole. This approach also enables multiple developers to work on different
modules concurrently, improving the efficiency of the development process.

Diagram:

Layered:
Layered, in the context of software design and architecture, refers to a structured
approach where different components or modules of a system are organized into
distinct layers. Each layer has a specific role and interacts with adjacent layers
through well-defined interfaces, promoting modularity, maintainability, and
separation of concerns.

Practical Example
A common example of layered architecture is the Model-View-Controller (MVC)
design pattern in web development:
1. Model Layer: This layer represents the data and business logic of the
application. It handles data manipulation and storage. For instance, in a
webbased to-do list application, the model layer could manage tasks and their
properties.

2. View Layer: The view layer is responsible for presenting data to the user. In
the same to-do list app, the view layer would handle the user interface,
displaying tasks, and interacting with user input.

3. Controller Layer: The controller layer acts as an intermediary between the


model and view layers. It manages user input, processes requests, and updates
the model accordingly. In the to-do list app, it would handle actions like adding
or deleting tasks.

The layered architecture separates these concerns, making it easier to update or


extend individual components without affecting the others, promoting code
reusability and maintainability.
Diagram:

Aspects:
In software engineering, "aspects" refer to cross-cutting concerns or functionalities
that affect multiple parts of a software system but cannot be modularized using
traditional, linear programming techniques. Aspects are often related to features
like logging, security, error handling, and performance, which may need to be
applied consistently across various modules or components of a software
application.

Practical Example:
Consider a web application that needs to log user actions and errors. Instead of
scattering logging code throughout the application codebase, aspects can be
employed using aspect-oriented programming (AOP) to separate the logging
concerns. This allows developers to define logging rules in a central aspect, which
can then be applied automatically to various parts of the application.
Diagram:

Uses Style:
Styles in software development refer to predefined sets of visual or formatting
properties that can be applied to user interfaces, documents, or elements within an
application. They enable consistent and efficient design by encapsulating attributes
like fonts, colors, spacing, and layout.

Practical Example:
Consider a mobile app development scenario. Styles are used to maintain a
consistent look and feel throughout the app. For instance, a developer can define a
"button style" that specifies the font, color, size, and padding for buttons. Then,
whenever a button is needed in the app, the developer can simply apply the "button
style" to ensure that all buttons share the same visual characteristics. This not only
Diagram:

simplifies development but also allows for easy global changes if the style needs to
be updated, ensuring a cohesive and professional appearance for the app.

You might also like