Conducting Object-Oriented Analysis and Design for Python Applications (Final)
Conducting Object-Oriented Analysis and Design for Python Applications (Final)
MATERIAL
You are required to go through a series of learning activities to complete each of the
learning outcomes of the module. In each learning outcome there are Information
Sheets, Job Sheets, Operation Sheets, and Activity Sheets. Follow these activities on
your own and answer the Self-Check at the end of each learning activity.
If you have questions, don’t hesitate to ask your facilitator for assistance.
You may already have some of the knowledge and skills covered in this module
because you have:
o been working for some time
o already have completed training in this area.
If you can demonstrate to your teacher that you are competent in a particular skill or
skills, talk to him/her about having them formally recognized so you don’t have to do the
same training again. If you have a qualification or Certificate of Competency from previous
training show it to your teacher. If the skills you acquired are still current and relevant to
this module, they may become part of the evidence you can present for RPL. If you are not
sure about the currency of your skills, discuss it with your teacher.
After completing this module ask your teacher to assess your competency.
The result of your assessment will be recorded in your competency profile. All the learning
activities are designed for you to complete at your own pace.
Inside this module you will find the activities for you to complete followed by
relevant information sheets for each learning outcome. Each learning outcome may have
more than one learning activity.
List of Competencies
No. Unit of Competency Module Title Code
Conducting object-
Conduct object-oriented
oriented analysis and
2. analysis and design for ICT0601914251302
design for Python
Python applications
applications
Craft and refine Python Crafting and refining
applications employing Python applications
3. ICT0601914251303
advanced programming employing advanced
techniques programming techniques
MODULE DESCRIPTOR:
This unit guides learners in applying Object-Oriented Analysis and Design (OOAD)
principles to Python programming. Learners explore Object-Oriented Concepts, delve
into SOLID principles integration in Python for code robustness, and learn to
systematically identify and validate system requirements. The unit also covers the
development of system designs and architectures in Python, providing learners with a
comprehensive skill set for crafting scalable and efficient solutions.
Contents:
Assessment Criteria:
Condition:
Assessment Method:
1. Written Examination
2. Direct Observation
Contents:
Assessment Criteria:
Condition:
1. Written Examination
2. Direct Observation
Contents:
Assessment Criteria:
Condition:
1. Written Examination
2. Direct Observation
Contents:
Assessment Criteria:
Condition:
1. Written Examination
2. Direct Observation
Learning Objectives:
Why OOP?
Improve Code Organization: By structuring code into classes and objects, OOP
helps in organizing complex systems into more manageable, modular
components. This structure makes it easier to understand and maintain the code.
Enhance Reusability: OOP promotes the use of existing code through
inheritance and polymorphism, allowing developers to reuse and extend
functionalities without duplicating code. This reduces redundancy and speeds up
development.
Increase Scalability: OOP supports the design of scalable systems by
encouraging a hierarchical structure. This makes it easier to add new features or
modify existing ones without disrupting the entire system.
Facilitate Maintainability: With OOP, changes to one part of the system are less
likely to affect others, thanks to encapsulation. This separation of concerns makes
it easier to update and fix bugs in the codebase.
Improve Collaboration: The modular nature of OOP makes it easier for teams to
work on different components concurrently. Each team member can focus on
specific classes or objects, enhancing productivity and reducing integration
issues.
Model Real-World Scenarios: OOP allows for the modeling of real-world entities
as classes and objects, making it easier to conceptualize and implement solutions
that reflect real-world relationships and behaviors.
Multiple Choice
Directions: Read and understand the questions and circle the letter of the correct answer.
1. Which of the following principles of OOP involves bundling data and
methods that operate on the data within one unit?
a. Inheritance
b. Polymorphism
c. Encapsulation
d. Abstraction
2. What is the primary advantage of using inheritance in OOP?
a. To hide complex implementation details from the user
b. To allow one class to inherit the properties and methods of another class
b. Polymorphism
c. Inheritance
d. Abstraction
c. To hide complex implementation details and expose only the necessary parts
to the user
c. By structuring code into classes and objects, making complex systems more
manageable
b. It groups related data and methods into one unit and restricts access to some
components.
c. By allowing one class to inherit the properties and methods of another class
8. Which of the following best describes the purpose of OOP in relation to real-
world scenarios?
a. OOP makes it easier to model real-world entities and relationships using
classes and objects.
Multiple Choice
1. c
2. b
3. b
4. c
5. c
6. b
7. b
8. a
9. b
10. c
Learning Objectives:
1. Understand the concept of classes and objects and how they relate to each other
in Python.
2. Define and implement classes in Python.
3. Explain how objects are instances of classes and how they interact with class
attributes and methods.
Class Concepts
A class is a collection of objects. A class contains the blueprints, or prototypes,
from which things are produced. A class combines data (attributes) and methods
(functions) that work with that data into a single, solid unit.
Defining Class:
Classes are created by keyword class
This example shows how to define a simple class in Python. The Car class is defined but
doesn’t have any attributes or methods yet.
Object Concepts
Objects are individual instances of classes, containing specific attributes and
methods.
Creating an Object:
You create an object by calling the class as if it were a function.
This example shows how an object (my_car) interacts with the class attributes (make
and model). The Car class initializes these attributes, and they can be accessed through
the object.
Multiple Choice
Directions: Read and understand the questions and circle the letter of the correct answer.
1. What is a class in Python?
a. A specific instance of an object
b. A blueprint for creating objects
c. A function that performs an action
d. A method that modifies an attribute
10. In the example, what will happen if you try to access an attribute that
doesn’t exist in the my_car object?
a. The attribute will be created automatically.
b. Python will raise an AttributeError.
c. The program will silently fail.
d. The class definition will be modified to include the attribute.
Multiple Choice
1. b
2. c
3. c
4. a
5. d
6. c
7. a
8. b
9. b
10. b
Learning Objectives:
Attributes
Attributes are variables defined within a class, representing the data for each object.
Initializing Attributes:
The __init__() method is a special method that initializes an object’s attributes
when the object is created.
This example defines the Car class with two attributes, make and model. The __init__()
method sets these attributes when a new Car object is created.
Method
Methods are functions defined within a class that manipulate data or perform
operations using the class’s attributes.
Defining Methods:
Using Methods:
The start_engine method is called using the object my_car. The method uses the self
keyword to access the attributes of the object and performs the action of printing a
message.
o B) object
o C) self
o D) method
o B) make, model
o C) speed, fuel
o D) brand, year
1. c
2. b
3. c
4. c
5. b
Learning Objectives:
1. Define and explain the significance of public, protected, and private access
modifiers in Python.
2. Understand how access control protects data integrity.
3. Implement access modifiers in Python to restrict data visibility and
manipulation.
The brand attribute and show_brand method is public, so they can be accessed directly
outside the class without any restrictions.
The brand attribute and show_brand method are protected by convention (using a single
underscore). While they can still be accessed directly, it's generally discouraged.
Private Attributes and Methods:
Private attributes and methods are indicated by a double underscore __ before
their name. These are intended to be inaccessible directly from outside the class.
Private parts are not accessible outside the class unless through specific
methods provided by the class itself.
Short Answer
Directions: Answer each question in one or two sentences. Be clear and concise in your
responses.
A. Explain the difference between protected and private attributes in Python.
Short Answer
B. Access control helps maintain data integrity by restricting how and where
attributes and methods can be accessed or modified. By using protected and
private modifiers, you ensure that the internal state of an object is not altered in
unintended ways. This prevents accidental changes or malicious manipulation,
ensuring that the data remains consistent and reliable.
Learning Objectives:
Inheritance
Inheritance allows a class to inherit attributes and methods from another class.
The class that is inherited from is called the parent or base class, and the class that
inherits is called the child or derived class.
The Dog class inherits the __init__ method from the Animal class, which initializes the
name attribute. The Dog class overrides the speak method to provide a specific
implementation for dogs.
The __name and __salary attributes are private, ensuring they cannot be modified
directly from outside the class. The get_details and set_salary methods provide
controlled access to these attributes.
The Parrot and Sparrow classes both override the sound method from the Bird class.
The make_sound function treats instances of both Parrot and Sparrow as Bird objects,
allowing for flexibility in handling different bird sounds.
True or False
Directions: Read and understand the questions and put T if it is True and F if it is False.
_____1. Inheritance allows a derived class to access the private attributes of the base
class.
_____3. Polymorphism means that different classes must have the same methods with
the exact same implementation.
_____5. Encapsulation involves exposing all attributes and methods of a class to the
outside world.
_____6. The __init__ method in Python classes is used to define static methods.
_____7. A protected attribute in a Python class is indicated by a double underscore.
_____8. In Python, all methods within a class are implicitly public unless otherwise
specified.
_____9. Polymorphism can be implemented using method overloading in Python.
_____10. A class method in Python is a method that operates on class-level data rather
than instance-level data.
True or False
1. F (Private attributes of the base class are not accessible from the derived class.)
3. F (Polymorphism allows different classes to have methods with the same name but
potentially different implementations.)
9. T (Python does not support method overloading directly; it uses method overriding
and default arguments to achieve polymorphism.)
10. T (Class methods, defined with the @classmethod decorator, operate on class-
level data rather than instance-level data.)
Steps/Procedure:
1. Inheritance Implementation
Create a base class Vehicle with attributes make and model. Define a method
display_info() to print these attributes.
Create a derived class Car that inherits from Vehicle and adds an attribute
fuel_type. Override display_info() in the Car class to include the fuel type.
Test the classes by creating an instance of Car and calling display_info().
2. Encapsulation Implementation
Define a class BankAccount with private attributes __account_number and
__balance. Include methods for initializing these attributes, depositing funds,
withdrawing funds, ad checking the balance.
Create an instance of BankAccount, perform a deposit and a withdrawal, and
then check the balance.
3. Polymorphism Implementation
Define a base class Shape with a method area(). Create two derived classes:
Rectangle and Circle, each implementing their own version of area().
Write a function print_area(shape) that accepts any Shape object and prints its
area.
Create instances of Rectangle and Circle, and use print_area() to display their
areas.
Assessment Method:
Demonstration with Oral Questioning
LEARNING EXPERIENCE
Learning Outcome 2
11. Answer Self-Check 2.1-4 Compare answers with the answer key
2.1-4. You are required to get all answers
correct. If not, read the information
sheets again to answer all questions
correctly.
15. Perform Task Sheet 2.1-5 Evaluate your own work using the
Performance Criteria. Present your work
to your trainer for evaluation and recording
Learning Objectives:
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 41 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
After reading this INFORMATION SHEET, you should be able to:
1. Understand the Single Responsibility Principle (SRP) and how it applies to class
design in Python.
2. Design classes and modules with a single, specific responsibility, making them
easy to maintain and extend.
3. Recognize and refactor classes that violate SRP in existing Python code.
What is SOLID?
The Single Responsibility Principle (SRP), the first of the five principles
of SOLID, is a fundamental concept in object-oriented software development. This
principle states that a class should have only one reason to change, meaning it should
be responsible for only one part of the software’s functionality. Martin describes
responsibility as an “axis of change” such that they represent possible rigidity in design.
Designing Classes
When designing classes, it’s crucial to break down larger classes into smaller
ones, each responsible for one specific task. This approach aligns with the Single
1. Identify Responsibilities:
Ensure each class has a clear, specific purpose and manages its own
data and methods related to that purpose.
3. Refactor Code:
Move relevant methods and properties from the larger class to the
newly created classes.
2. Maintainability: Changes are easier to manage when each class handles only
one aspect of the system. This reduces the risk of unintended side effects.
3. Testability: Focused classes are simpler to test. Unit tests can be more precise,
targeting specific functionalities without interference from unrelated code.
4. Reusability: Classes that do one thing well can be reused across different parts
of the application or even in other projects.
The code above will work perfectly but will lead to some challenges. We cannot
make this code reusable for other classes or objects. The class has a whole lot of logic
interconnected that we would have a hard time fixing errors. And as the codebase grows,
so does the logic, making it even harder to understand what is going on.
The examples we used use just showed each class having one method – this is
mainly for simplicity. You can have as many methods as you want but they should be
linked to the responsibility of the class.
Now that we have separated the logic, our code is easier to understand as each
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 44 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
core functionality has its own class. We can test for errors more efficiently.
The code is now reusable. Before, we could only use these functionalities inside
one class but now they can be used in any class.
The code is also easily maintainable and scalable because instead of reading
interconnected lines of code, we have separated concerns so we can focus on the
features we want to work on.
SELF-CHECK 2.1-1
Multiple Choice
9. In the example discussed, what are the three responsibilities that should be
separated into different classes?
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 46 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
a) registering students, sending emails, printing receipts
b) sending emails, processing data, handling errors
c) registering students, calculating results, sending emails
d) printing invoices, handling login, logging data
10. Why does separating responsibilities into multiple classes make code more
maintainable?
a) it makes the code longer
b) each class can be updated independently without affecting others
c) it hides all responsibilities in one place
d) it increases the dependencies between classes
Multiple Choice
1. c
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 47 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
2. b
3. b
4. b
5. c
6. b
7. c
8. c
9. c
10. b
11. b
12. b
13. b
14. b
15. b
Assessment Method:
Demonstration and code review, followed by oral questioning about the refactoring
Date Document No. AB-ICT0601914251302
process and principles of SRP.
Conducting Object-Oriented Developed: Issued by:
Page 49 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
PERFORMANCE CRITERIA CHECKLIST 2.1-1
Did I? Yes No
1. Identify multiple responsibilities in the original class.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 50 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
2. Create new, focused classes for each responsibility.
3. Move methods and properties to the appropriate classes.
4. Adjust interactions between the original class and new classes
5. Test the refactored code for correct functionality
6. Ensure clarity, maintainability, and reusability of the new classes
7. Document the refactored code and class responsibilities
Applying the Single Responsibility Principle (SRP) in Python Class Design
Comments/Suggestions:
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
Learning Objectives:
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 51 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
After reading this INFORMATION SHEET, you should be able to:
The Open-Closed Principle (OCP) is the second of the five SOLID principles and
is essential for building scalable, maintainable software. It states that software entities
such as classes, modules, or functions should be open for extension but closed for
modification. In simple terms, this means that the behavior of a class or function should
be extendable without altering its existing code.
Think of a car’s design. When new features like advanced navigation or autopilot
are added, manufacturers don’t rebuild the entire car. Instead, they create add-ons or
modules that enhance the car’s functionality while keeping the core structure intact. The
existing car remains untouched, but its capabilities grow.
This principle encourages developers to think ahead and create systems that can
evolve gracefully, enabling smooth expansion without disturbing the core structure. This
results in fewer bugs, easier maintenance, and a cleaner codebase, much like how a
well-built car can adapt to new technologies without needing a complete overhaul.
Look for parts of the codebase where behavior may need to be modified
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 52 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
or extended in the future, such as adding new features or supporting
new types of data.
2. Use Inheritance:
3. Apply Composition:
For example, inject different strategy objects into a class to change its
behavior based on context.
4. Utilize Polymorphism:
This allows you to add new behaviors without needing to modify any
part of the code that interacts with the base type.
1. Extensibility: Systems adhering to OCP are easier to extend. New features can
be added by writing new code, not by altering existing, tested code.
In the long run, continually adding formats will bloat the class and make it harder
to maintain. Any changes to one report format might inadvertently affect the others. This
violates the core idea of OCP, which states that software entities (classes, modules, etc.)
should be open for extension but closed for modification.
Refactored Code:
2. Easy to Extend: You can add new report formats by simply creating a new class
3. Maintains Flexibility: Each report format can be tested independently, and any
changes are isolated to their respective classes.
4. Follows OCP: The core principle of being open for extension but closed for
modification is maintained. Our design allows adding new features without risking
bugs in the existing code.
Identification
2. The principle that states software entities should be open for ______ but closed
for ______.
6. A strategy where new features are added without altering the original code is
achieved through ______.
7. The risk minimized by following OCP and avoiding changes to stable classes.
10. OCP ensures the system remains scalable and maintainable by allowing the
introduction of new ______.
11. Refactoring the design by splitting functionality into multiple classes is an example
of applying ______.
12. The concept where future changes are anticipated and planned for in advance,
without modifying existing code.
13. The violation occurs when adding a new feature by modifying an existing class
instead of extending it, which violates ______.
15. OCP promotes designing software in a way that allows extension through new
classes, without changing the ______.
Identification
2. extension, modification
3. inheritance
4. report
5. composition
6. polymorphism
7. introducing bugs
8. polymorphism
9. report interface
10. features
Choose a scenario where you would need to implement a feature that could
require future extensions (e.g., a payment processing system or notification
system).
Define the basic functionality that your core class should have.
Create a Python class or an interface that will represent the core functionality
(e.g., a Payment class with basic payment processing).
Ensure this class is closed for modification but ready for extension by defining
key methods that future features will inherit or override.
Add necessary methods to your base class that provide the foundation for the
core behavior.
Keep this class minimal and focused on the shared functionality that all
extensions will need.
Create at least two new classes that extend the base class’s functionality (e.g.,
CreditCardPayment, PayPalPayment).
Implement or override methods in these new classes to demonstrate how
additional behaviors can be added without modifying the original class.
Think of another feature that could be required later (e.g., BitcoinPayment for
the payment system).
Plan how you would extend the system in the future by adding new classes
while keeping the base class untouched.
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
1. Understand the Liskov Substitution Principle (LSP) and how it ensures the
proper use of inheritance in Python.
2. Learn how to implement inheritance in a way that ensures derived classes can
replace base classes without issues.
The Liskov Substitution Principle (LSP) is the third of the five SOLID principles,
crucial for ensuring robust and maintainable software. It states that objects of a base
class should be replaceable with objects of a derived class without affecting the
correctness of the program. Essentially, derived classes must extend the base class
without changing its intended behavior.
Think of LSP like this: Imagine you have a universal remote that controls various
devices like TVs, DVD players, and streaming boxes. Each device follows the same
basic commands—power on, volume up, channel change. If you replace a device with a
new one that supports additional functions but still follows the basic commands, the
remote should work seamlessly without needing adjustments. The remote’s functionality
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 61 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
doesn’t break, and the new device integrates smoothly.
In software, adhering to LSP means that derived classes should honor the
contracts established by their base classes. This ensures that the software remains
predictable and reliable as new features are added or existing features are extended.
Adhering to LSP involves designing your classes in a way that ensures derived
classes can be used interchangeably with their base classes without altering expected
behavior. Here’s a structured approach to ensure LSP in your Python projects:
Define Clear Contracts: Ensure the base class defines clear, consistent
contracts (methods and behaviors) that derived classes must adhere to.
3. Refactor Violations:
4. Test Substitutability:
2. Reduced Bugs: By ensuring derived classes adhere to the contracts of the base
class, the risk of introducing bugs through incorrect subclass behavior is
minimized.
Problem: The Penguin class violates LSP. Although it inherits from Bird, it cannot fulfill
the fly method as expected. Substituting Penguin for Bird breaks the expected behavior,
violating LSP.
With this design, the code becomes easier to understand as each class now fulfills
its specific role without disrupting the behavior of other classes. Testing becomes more
straightforward since each class adheres to a clear contract, making it easier to identify
and fix errors.
Lastly, the code is more maintainable and scalable. By following LSP, you avoid
entangling logic, ensuring that changes or additions to one class do not inadvertently
affect others. This modularity allows you to focus on expanding functionality or adjusting
specific behaviors without risking unintended consequences across the system.
Multiple Choice
1. a
2. b
3. b
4. c
5. b
6. c
7. d
8. a
9. b
10. b
11. b
12. b
13. c
14. b
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 68 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
15. b
Design a base class that represents a general concept (e.g., a Vehicle class).
Include methods that reflect the core behavior expected from all derived classes
(e.g., start(), stop()).
Implement at least two subclasses that extend the base class (e.g., Car and
Bicycle).
Ensure that each derived class adheres to the base class's methods and
functionality without changing the expected behavior.
Replace instances of the base class with derived class instances and test if the
program continues to work as expected.
Ensure that the substitution of derived classes does not alter the overall
functionality of the program.
Review your design for any violations of LSP, such as derived classes that do
not fully conform to the behavior of the base class.
Refactor the derived classes or adjust the inheritance hierarchy to maintain LSP
compliance.
Write brief documentation explaining how LSP has been applied in your class
hierarchy.
Describe how derived classes can be used interchangeably with the base class.
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 72 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
1. Understand the Interface Segregation Principle (ISP) and how it applies to
designing interfaces in Python.
2. Learn how to split large interfaces into smaller, more focused ones to avoid
client overload.
3. Apply ISP by designing smaller, specific interfaces that cater to client needs.
Imagine a universal remote designed to control multiple devices like TVs, DVD
players, and audio systems. Instead of a single, complex remote with buttons for every
possible function, you have separate remotes for different devices. Each remote is
customized for its device, making it simpler and more user-friendly.
In software, applying ISP means designing interfaces so that clients only interact
with the methods they need. This avoids unnecessary dependencies and makes the
system easier to maintain and extend.
To effectively apply ISP in your Python projects, follow this structured approach:
2. Enhanced Flexibility: Changes to one interface do not affect clients that do not
use it, making the system more adaptable to new requirements.
Problem: A single Device interface contains methods for printing, scanning, and faxing.
A class implementing Device might not use all methods, leading to unused or irrelevant
code in some clients.
Identification
1. The principle that states clients should not be forced to depend on interfaces they
do not use.
2. This design approach breaks large interfaces into smaller, more focused ones to
avoid client overload.
3. In ISP, interfaces are created based on the exact needs of these entities.
4. A large interface that contains methods irrelevant to certain clients violates this
principle.
5. This benefit of ISP ensures that clients only interact with relevant methods,
reducing the code’s complexity.
6. ISP allows for this by making sure changes to one interface do not affect clients
that do not use it.
7. This type of interfaces, created under ISP, can be reused across different
projects or parts of a system.
9. ISP promotes creating smaller interfaces instead of having this type of interface
with many unrelated methods.
10. This term refers to when multiple, smaller interfaces are implemented by the
same class, as recommended by ISP.
Identification
2. Interface Segregation
3. Clients
5. Reduced complexity
6. Enhanced flexibility
7. Reusability
8. Easier maintenance
9. Bloated interface
Assessment Method:
Code review to ensure the refactored classes only implement methods they need, as
per the Interface Segregation Principle. Tests will verify the system’s functionality after
breaking down large interfaces into smaller ones.
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
1. Define Abstractions:
Multiple Choice
Multiple Choice
1. c
2. a
3. c
4. c
5. b
6. b
7. b
8. a
9. b
10. b
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
2. Learn how to use static analysis tools like PyLint, Flake8, and MyPy to enforce
coding standards and identify issues.
On the other hand, static analysis tools, also called linters, automate the detection
of code issues by analyzing the source code without executing it. Linting refers to this
process of using a linter to examine code for potential errors, coding style violations, and
type inconsistencies. These tools, such as PyLint, Flake8, and MyPy in Python, provide
immediate feedback and help enforce coding standards by identifying problems early in
the development process. By integrating static analysis into the development workflow,
developers can address issues before they become more complex, leading to a more
efficient development cycle. Combined, code reviews and static analysis tools ensure
that code quality is consistently maintained, making the software more robust, easier to
maintain, and less prone to defects in the long term.
Code reviews and static analysis play a crucial role in software development, offering
a wide range of benefits:
Improved Code Quality and Security: Detect and fix bugs, vulnerabilities, and
code smells before they reach production, ensuring more secure and reliable
code.
Code reviews and static analysis ensure that the software meets the highest
standards of quality and efficiency.
Key Concepts
Code Quality refers to how well-written, maintainable, and efficient a codebase is.
High-quality code adheres to established coding standards, minimizing errors, bugs, and
security vulnerabilities. It also ensures the code can be easily understood, tested, and
scaled by other developers. Maintaining high code quality results in fewer issues during
production, smoother updates, and overall easier maintenance in the long term. Code
quality often encompasses several factors, such as readability, modularity, efficiency,
and adherence to best practices like the SOLID principles.
Tools Overview
1. PyLint
PyLint is a comprehensive code analysis tool that checks for programming errors,
enforces coding standards, and offers suggestions for code refactoring. It assesses your
Python code based on the PEP 8 style guide, flags bad practices, and identifies issues
like missing docstrings, redundant imports, and variable name inconsistencies.
Additionally, PyLint can help enforce SOLID principles by highlighting violations of
coding principles such as the Single Responsibility Principle (SRP) or the
Open/Closed Principle (OCP). This makes it particularly valuable for ensuring
maintainable and scalable code.
2. Flake8
Flake8 is another popular tool that checks the style guide compliance of Python
code, with a primary focus on the PEP 8 standard. It integrates well with other static
analysis tools, including PyFlakes and McCabe (a tool for checking code complexity).
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 92 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
Flake8 helps ensure that the code is clean, readable, and free of lint errors, while also
helping detect issues that might go unnoticed in larger projects, like overly complex
functions or unused variables.
3. MyPy
While PyLint and Flake8 primarily focus on style and code quality, MyPy
introduces static type checking into Python. Python is a dynamically typed language, but
MyPy allows developers to include optional type annotations in their code. By analyzing
these annotations, MyPy ensures that the types match up correctly and helps prevent
type-related runtime errors. This early error detection improves code reliability and
makes the system easier to scale by reducing bugs caused by incorrect type
assumptions.
Incorporating tools such as PyLint, Flake8, and MyPy into your Python
development workflow is crucial for upholding best practices and maintaining high code
quality. These tools collectively aid in identifying potential issues early, ensuring that your
code adheres to established standards and is both clean and maintainable. By
leveraging these static analysis tools, you will enhance your ability to produce robust and
error-free software, reinforcing essential coding competencies.
SELF-CHECK 2.1-6
Multiple Choice
2. Which of the following best describes the role of static analysis tools?
a) They run code and check for runtime errors
b) They analyze code without executing it to detect potential issues and coding
style violations
3. Which tool focuses on ensuring code adheres to the PEP 8 style guide and
checks for errors like missing docstrings?
a) MyPy
b) PyLint
c) PyFlakes
d) McCabe
9. How do code reviews and static analysis contribute to reduced testing and
maintenance costs?
a) They allow developers to eliminate all manual testing efforts
b) By catching issues early, they minimize the need for rework, debugging, and
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 94 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
troubleshooting
c) By focusing on runtime errors, they reduce the amount of testing needed
d) They completely remove the need for automated testing tools
Multiple Choice
1. b
2. b
3. b
4. b
5. b
6. b
7. c
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 95 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
8. b
9. b
10. c
LEARNING EXPERIENCE
Learning Outcome 3:
Learning Activities Special Instructions
1. Read Information Sheet No. 3.1-1
2. Answer Self-Check 3.1-1 Compare answers with the answer key
3.1-1. You are required to get all answers
correct. If not, read the information sheets
again to answer all questions correctly.
3. Read Information Sheet No. 3.1-2
4. Answer Self-Check 3.1-2 Compare answers with the answer key
3.1-2. You are required to get all answers
correct. If not, read the information sheets
again to answer all questions correctly.
5. Perform Task Sheet No. 3.1-2 Evaluate your own work using
the Performance Criteria.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 96 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
Present your work to your trainer for
evaluation and recording.
3. Read Information Sheet No. 3.1-3
4. Answer Self-Check 3.1-3 Compare answers with the answer key
3.1-3. You are required to get all answers
correct. If not, read the information sheets
again to answer all questions correctly.
After doing all activities of this LO,
you are ready to proceed to the next
LO
1. Understand and apply various techniques for gathering system requirements from
stakeholders.
2. Identify stakeholder needs through interviews, questionnaires, and observations.
3. Learn how to properly document system requirements using tools such as use
cases, user stories, and requirement specifications.
2. Focus Groups
Bringing together a group of stakeholders to discuss their needs, expectations, and
concerns about the system.
When to Use: Effective when you want to gather diverse perspectives and foster
discussion among stakeholders.
Example: Organizing a focus group with end-users from different departments to
identify common system requirements.
4. Observation:
Observing stakeholders as they interact with current systems or processes to identify
pain points and areas for improvement.
When to Use: Best used when you want to understand the actual workflow and
issues faced by users without relying solely on their verbal feedback.
Example: Observing warehouse staff during their daily operations to identify
inefficiencies that could be addressed by a new inventory management system.
Documenting Requirements
Multiple Choice
Directions: Read and understand the questions and circle the letter of the correct answer.
1. Which technique involves conducting one-on-one or group conversations to
gather detailed insights into stakeholder needs?
a. Observation
b. Interviews
c. Focus Groups
d. Surveys
2. What is a key benefit of using focus groups to gather system requirements?
a. It allows for individual stakeholder input.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 100 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
b. It gathers standardized data from a large audience.
c. It fosters diverse perspectives and discussion among stakeholders.
d. It observes stakeholder interactions with the current system.
3. When is it best to use surveys or questionnaires in the requirement
gathering process?
a. When you need detailed one-on-one feedback.
b. When observing stakeholders in their work environment.
c. When gathering data from a large audience in a standardized format.
d. When discussing needs in a group setting.
4. Which technique involves watching stakeholders perform their daily tasks
to identify potential improvements?
a. Interviews
b. Observation
c. Surveys
d. Focus Groups
5. Which of the following is an example of when to use observation?
a. Interviewing department heads about software features.
b. Sending out a survey to employees about their communication preferences.
c. Watching warehouse staff during daily operations to spot inefficiencies.
d. Conducting a group meeting with end-users to gather requirements.
6. Which technique uses visual representations to show interactions between
users and the system?
a. Use Case Diagrams
b. Requirement Specifications
c. User Stories
d. Interviews
7. What is the purpose of requirement specifications?
a. To provide short, simple descriptions of system features.
b. To gather detailed insights from stakeholders.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 101 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
c. To outline all functional and non-functional requirements of the system.
d. To depict interactions between users and the system.
8. In which document would you find a formal agreement on what the system
must achieve between stakeholders and developers?
a. Use Case Diagram
b. Observation Notes
c. Requirement Specification
d. User Stories
9. Which documentation technique helps capture specific user needs in a
simple and easy-to-understand format?
a. Use Case Diagram
b. Requirement Specification
c. User Stories
d. Focus Groups
10. Which of the following is an example of a user story?
a. A diagram showing how customers browse and purchase products.
b. "As a customer, I want to transfer money between accounts so that I can
manage my finances easily."
c. A document outlining system features like contact management and lead
tracking.
d. A list of interview questions for department heads.
11. What does recognizing stakeholder interests involve?
a. Gathering standardized feedback from a large group of stakeholders.
b. Understanding the varying interests, expectations, and concerns of different
stakeholder groups.
c. Identifying inefficiencies in a work environment through observation.
d. Recording all gathered system requirements into one document.
12. Why is it important to record stakeholder requirements?
a. To ensure all stakeholder requirements are accurately captured and
comprehensively documented.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 102 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
b. To interview stakeholders for their in-depth input.
c. To observe the current system in use and identify potential improvements.
d. To create a visual representation of user interactions with the system.
13. Which example best illustrates recognizing stakeholder interests?
a. A focus group session identifying shared concerns across departments.
b. Real-time access to customer data for the sales department and detailed
reporting for the finance department.
c. Sending out a survey to employees for feedback on a communication tool.
d. Observing warehouse staff to identify inefficiencies.
14. What is the best way to document stakeholder needs after gathering
requirements through interviews and surveys?
a. Compile a list of system features based on the feedback gathered.
b. Create a use case diagram to show how users interact with the system.
c. Conduct a focus group session to get diverse perspectives.
d. Observe the stakeholders interacting with their current system.
15. Which technique helps ensure that all users’ needs are captured and
addressed in the final system?
a. Recording Stakeholder Requirements
b. Conducting Surveys
c. Using Use Case Diagrams
d. Holding Focus Groups
Multiple Choice
1. b
2. c
3. c
4. b
5. c
6. a
7. c
9. c
10. b
11. b
12. a
13. b
14. a
15. a
MODELLING TECHNIQUES
Learning Objectives:
Learning Objectives:
1. Understand different modeling techniques used in system design and
development.
2. Utilize modeling techniques such as flowcharts, data flow diagrams (DFDs), and
entity-relationship diagrams (ERDs) to represent system requirements visually.
1. Flowcharts
Flowcharts are diagrams that represent the flow of control in a system using symbols and
arrows to depict processes, decisions, inputs, and outputs.
It represents information
Input/Output which the system reads as
input or output.
Any process is
represented by the symbol.
Processing
For Example, Arithmetic
operation, data movement
This symbol is used to
check any condition or
Decision take decision for which
there are two answers. Yes
(True) or No (False).
Flowcharts are commonly used to map out the logical flow of a program or process,
making them ideal for representing algorithms, system operations, or user workflows.
DFDs depict how data moves through a system, showing the input, processing, and
output of data within different parts of the system.
Levels: DFDs are typically created in multiple levels, starting with a high-level overview
(Level 0) and then drilling down into more detail in subsequent levels.
Symbol Symbol Name Description
This is used to
Process represent start and
end of the flowchart
It represents
information which the
Data Store Document No. AB-ICT0601914251302
Date system reads as input
Conducting Object-Oriented Developed: Issued by: or Page
output.108 of
Analysis and Design for
Developed by: 176
Python Applications
Any process is
Revision #
represented by the
Data Flow symbol. For Example,
Arithmetic operation,
data movement
DFDs are particularly useful in identifying how data is handled, where it is stored, and
how it interacts with various system components
DFDs can be divided into different levels, which provide varying degrees of detail about
the system. The following are the four levels of DFDs:
Level 0 DFD
Level 1 DFD
Level 2 DFD
Level 3 DF
Level 0 is the highest-level Data Flow Diagram (DFD), which provides an overview
of the entire system. It shows the major processes, data flows, and data stores in the
system, without providing any details about the internal workings of these processes.
1-Level provides a more detailed view of the system by breaking down the major
processes identified in the level 0 Data Flow Diagram (DFD) into sub-processes. Each
sub-process is depicted as a separate process on the level 1 Data Flow Diagram (DFD).
The data flows and data stores associated with each sub-process are also shown.
In 1-level Data Flow Diagram (DFD), the context diagram is decomposed into
multiple bubbles/processes. In this level, we highlight the main functions of the system
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 109 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
and breakdown the high-level process of 0-level Data Flow Diagram (DFD) into
subprocesses.
2-Level provides an even more detailed view of the system by breaking down the
sub-processes identified in the level 1 Data Flow Diagram (DFD) into further sub-
processes. Each sub-process is depicted as a separate process on the level 2 DFD. The
data flows and data stores associated with each sub-process are also shown.
2-Level Data Flow Diagram (DFD) goes one step deeper into parts of 1-level DFD.
It can be used to plan or record the specific/necessary detail about the system’s
functioning.
3-Level is the most detailed level of Data Flow Diagram (DFDs), which provides a
detailed view of the processes, data flows, and data stores in the system. This level is
typically used for complex systems, where a high level of detail is required to understand
the system. Each process on the level 3 DFD is depicted with a detailed description of its
input, processing, and output. The data flows and data stores associated with each
process are also shown.
ERDs are used to model the data structures within a system, showing entities (such as
tables in a database), their attributes, and the relationships between them.
Components:
ERDs are essential for database design, helping to ensure that the data is organized efficiently
and that relationships between data elements are well-understood.
Types: Common UML diagrams include Class Diagrams, Sequence Diagrams, and Use
Case Diagrams.
A. Class Diagram
The name of the class is typically written in the top compartment of the class box
and is centered and bold.
Attributes:
Attributes, also known as properties or fields, represent the data members of the
class. They are listed in the second compartment of the class box and often include the
visibility (e.g., public, private) and the data type of each attribute.
Methods:
Visibility Notation:
Visibility notations indicate the access level of attributes and methods. Common
visibility notations include:
Parameter Directionality
Out (Output):
1. Association
3. Aggregation
4. Composition
Inheritance represents an “is-a” relationship between classes, where one class (the
subclass or child) inherits the properties and behaviors of another class (the superclass
or parent).
Realization indicates that a class implements the features of an interface. It is often used
in cases where a class realizes the operations defined by an interface.
A dependency exists between two classes when one class relies on another, but the
relationship is not as strong as association or inheritance. It represents a more loosely
coupled connection between classes.
8. Usage(Dependency) Relationship
A usage dependency relationship in a UML class diagram indicates that one class (the
client) utilizes or depends on another class (the supplier) to perform certain tasks or
access certain functionality. The client class relies on the services provided by the
supplier class but does not own or create instances of it.
B. Sequence Diagram
Actor: An actor in a UML diagram represents a type of role where it interacts with the
system and its objects. It is important to note here that an actor is always outside the
scope of the system we aim to model using the UML diagram.
a. Synchronous messages
A synchronous message waits for a reply before the interaction can move forward.
The sender waits until the receiver has completed the processing of the message.
b. Asynchronous Messages
An asynchronous message does not wait for a reply from the receiver. The
interaction moves forward irrespective of the receiver processing the previous message
or not.
c. Delete Message
d. Self Message
Certain scenarios might arise where the object needs to send a message to itself.
Such messages are called Self Messages and are represented with a U-shaped arrow.
e. Reply Message
Reply messages are used to show the message being sent from the receiver to
the sender. We represent a return/reply message using an open arrowhead with a dotted
line.
g. Lost Message
A Lost message is used to represent a scenario where the recipient is not known
to the system. It is represented using an arrow directed towards an end point from a
lifeline.
h. Guards
To model conditions we use guards in UML. They are used when we need to
restrict the flow of messages on the pretext of a condition being met.
Customer
Web Portal
Database Server of the company
The diagram is a Login Functionality, has the message and replies to messages with
sequence numbering, and the lifeline of each object.
A Use Case Diagram is a type of Unified Modeling Language (UML) diagram that
represents the interaction between actors (users or external systems) and a system
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 122 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
under consideration to accomplish specific goals. It provides a high-level view of the
system’s functionality by illustrating the various ways users can interact with it.
1. Association Relationship
The Include Relationship indicates that a use case includes the functionality of
another use case. It is denoted by a dashed arrow pointing from the including use case
to the included use case. This relationship promotes modular and reusable design.
3. Extend Relationship
The Extend Relationship illustrates that a use case can be extended by another use
case under specific conditions. It is represented by a dashed arrow with the keyword
“extend.” This relationship is useful for handling optional or exceptional behavior.
Implementation Stage
Models like Class Diagrams and Sequence Diagrams in UML are
particularly useful during the implementation stage to guide developers in coding and
ensure consistency with the system design.
Best Practices: Ensure models are kept up to date as the system evolves and
involve stakeholders in reviewing models to confirm that they accurately reflect their
requirements.
_____2. Flowcharts use symbols and arrows to represent processes, decisions, inputs,
and outputs.
_____3. A Data Flow Diagram (DFD) at Level 0 provides detailed information about the
internal workings of processes.
_____4. Entity-Relationship Diagrams (ERDs) are used to model the data structures
within a system, including entities, attributes, and relationships.
_____5. Unified Modeling Language (UML) diagrams are used solely for database
design and do not apply to object-oriented systems.
_____6. In a UML Class Diagram, the visibility notation "+" represents public access.
_____8. The 'Include' relationship in a Use Case Diagram indicates that a use case is
extended by another use case.
_____9. Aggregation in UML represents a “whole-part” relationship where the child class
can exist independently of its parent class.
_____10. DFDs are particularly useful during the implementation stage to guide
developers in coding and ensure consistency with the system design.
True or False
4. T (ERDs are used to represent data structures, showing entities, their attributes,
and the relationships between them.)
5. F (UML diagrams are used for various aspects of object-oriented design, not just
database design.)
6. T (In UML, the "+" symbol denotes public visibility for attributes and methods in a
class diagram.)
8. F (The 'Include' relationship indicates that a use case contains the behavior of
another use case, not that it is extended.)
10. T (DFDs help guide the implementation process by showing how data flows
through the system and how it is processed.)
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 127 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
TASK SHEET 3.1-2
Steps/Procedure:
Task 1: Flowchart
1. Start: Begin the process.
2. User Login: Input step where the user logs into the system.
3. Check Availability: A decision point to verify if the desired time
slot/service is available.
4. If Yes, proceed to the next step.
5. If No, show an error message and allow the user to select a new time
slot/service.
6. Enter Booking Details: Input step where the user provides their
booking details (date, time, service).
7. Payment Process: Processing step to handle the payment (credit card
or other methods).
8. Confirmation: Decision point to check if payment is successful.
9. If Yes, show booking confirmation.
10. If No, show an error message and allow retry.
11. Send Confirmation Email: Output step to send a confirmation email to
the user.
Processes:
Search Book: Allows students to search for available books.
Borrow Book: Records when a student borrows a book.
Return Book: Updates the system when a book is returned.
Manage Books: Librarian adds or removes books from the
system.
Data Stores:
Book Inventory: Stores information on available and borrowed
books.
Student Records: Stores student borrowing history.
Flow Description:
1. User provides credentials to the Login process, which checks the User
Database.
2. Once logged in, User sends a booking request with time and service
details to the Check Availability process, which retrieves data from the
Service Data store.
3. If available, User sends payment details to the Payment Processing
process, which interacts with the Payment Gateway.
4. Upon successful payment, the Booking process records the booking in
the Booking Database and notifies the Service Provider.
5. Finally, the Send Confirmation process sends the booking confirmation
to the User.
Assessment Method:
Demonstration with Oral Questioning
Criteria Yes No
Flowchart
1. Process clearly defined
2. Use of appropriate flowchart symbols
3. Flowchart starts and ends clearly
4. All steps of the process are included
5. Decision points accurately represented
6. Correct use of flow lines
7. Process flow follows a logical sequence
8. Input and output steps clearly identified
9. Error handling steps included
10. Flowchart is labeled clearly
Level 0 DFD
1. External entities are correctly identified
2.
3. Processes are clearly defined and
labeled
4. Data stores are accurately represented
5. Data flow between entities, processes,
and stores is clear
6. Correct symbols are used for entities,
processes, and data stores
7. Logical flow of data is followed
8. Input/output interactions between system
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 130 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
components are clear
9. Error handling is included in the data
flow
10. DFD includes all critical system
interactions
11. Level 0 DFD is properly labeled and
organized
Comments/Suggestions:
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
Learning Objectives:
1. Generalization
In this example, the Animal class represents a generalized entity with common
attributes like name and age. All animals share these basic features, making it a
reusable component.
Advantages of Generalization:
2. Specialization
How it works: A specialized class, often called a child class or subclass, inherits
from the generalized class and overrides or extends its behavior as needed.
Advantages of Specialization:
In system design, the principles of generalization and specialization are essential for
building flexible, maintainable, and scalable solutions. Here’s how these principles can
be applied:
Begin by looking for shared features across different entities in the system. These
characteristics can be attributes (such as name and age) or methods (such as eat() or
sleep()), which will form the basis of your generalized class.
Encapsulate these shared attributes or methods into a generalized class that can
be inherited by other, more specialized components. This abstraction allows for
reusability, as the generalized behavior does not need to be duplicated across different
components.
4. Promote Reusability:
a. Generalization only
b. Specialization only
1. Explain how generalization helps improve code reusability and system efficiency
in object-oriented programming. Provide a specific example if necessary.
Multiple Choice
1. b
2. c
3. b
4. b
5. b
6. b
7. c
8. c
9. b
10. b
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
1. Understand how system requirements and analysis models are converted into
detailed design specifications.
3. Develop system design specifications that align with user and stakeholder
needs, ensuring proper system functionality.
System requirements refer to everything needed for the system to work well in
the real world, such as the necessary hardware, software, and network elements. These
requirements outline how different parts of the system—like computers, programs, and
communication tools—interact to ensure smooth performance. Key examples include
processing power, memory, compatibility with operating systems, network capabilities,
and security measures. System Requirements encompass both functional and non-
functional needs, ensuring that the system operates smoothly and meets user
expectations.
To confirm that these requirements are met, validation is done through reviews
with stakeholders and tests. These tests make sure all system parts work together and
that the system matches the goals set at the start of the project. This includes checking
how the system behaves and performing user acceptance testing to ensure it meets
users' needs.
Functional requirements specify what the system should do. These are the
essential operations and behaviors that the system must perform. They include:
3. Data Handling: How the system processes, stores, and retrieves data.
4. Business Rules: Specific rules and logic the system must adhere to.
Non-Functional Requirements
For example, a non-functional requirement for the same e-commerce website might
be that the system should handle up to 10,000 concurrent users without performance
degradation.
Defining system requirements is crucial for the success of any project. They provide
a clear roadmap for developers, ensuring that the final product meets the needs and
expectations of users.
Analysis Models
When developing a system, it’s crucial to use analysis models like Use Case
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 142 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
Diagrams and Data Flow Diagrams (DFDs) to understand how the system will function
and interact. These models not only capture system requirements but also serve as
foundational inputs for creating detailed design documents. By translating the insights
from these models—such as user interactions, data flows, and system processes—into
technical specifications, developers can define the system's architecture, components,
and interfaces with precision.
Insights gained from Use Case Diagrams and DFDs translate directly into design
specifications, ensuring that both functional and non-functional requirements are met.
Begin by reviewing the Use Case Diagrams (which outline what the system
should do) and Data Flow Diagrams (DFDs) (which show how data moves within
the system).
These diagrams are crucial because they give a clear picture of the
system’s functionality and the interactions between different components.
Break the system down into key components or modules based on the
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 143 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
use cases and DFDs. Each component should handle a specific function within
the system.
o Data Structures: The types of data each component will use and manage.
o Interfaces: How each component interacts with other parts of the system.
Make sure to account for both functional requirements (e.g., login functionality)
and non-functional requirements (e.g., performance and security needs).
Detailed design documents should provide clear and precise instructions for
developers. These documents typically include:
o Class Diagrams: Depict the structure of the system, outlining classes and
their relationships (e.g., User, Product, Order).
o User Interface Design: Details about how users will interact with the
system, including the layout of forms, buttons, and input fields.
3. Class Diagram: The Class Diagram depicts the objects or classes in the
system, including their attributes and methods. For example, a class diagram for
a user authentication system might show classes like User, Admin, and
Session, detailing their interactions and responsibilities.
4. Data Flow Diagram (DFD): The Data Flow Diagram illustrates the flow of data
through the system. For example, a DFD might depict how a user’s payment
information moves from the shopping cart to the payment gateway, showing
how different processes handle and transfer data.
1. Clarity in Design
2. Completeness of Documentation
3. Feasibility Checks
Feasibility checks are crucial to ensure that the design can be implemented
with current technology and resources. This involves conducting validation reviews
with stakeholders to ensure that the design aligns with business goals and is
practical to implement. By performing these checks, potential issues can be
identified and addressed early in the development process.
Validation Techniques
To verify that the design meets both technical and business needs, periodic
design reviews with stakeholders can be conducted. These reviews ensure that the
design specifications consistently reflect the original system requirements. This iterative
validation process helps maintain alignment with stakeholder expectations.
Feedback Loops
Actively incorporating feedback from stakeholders during the design phase helps
refine the design to better suit user needs. Using prototypes or mockups to gather
feedback allows for adjustments and improvements, ensuring the final product not only
aligns with initial expectations but also meets evolving requirements.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 146 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
SELF-CHECK 4.1-1
Multiple Choice:
14. What is the goal of conducting validation reviews with stakeholders during
the design phase?
a) To finalize the budget for the project
b) To ensure the design meets both technical and business needs
c) To gather information on competitor products
d) To check if all coding languages have been used correctly
Multiple Choice :
1. b
2. b
3. c
4. b
5. c
6. c
7. a
8. a
9. c
10. b
11. b
12. c
13. b
14. b
15. b
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
1. Identify Functional Areas: Break the system into distinct functional areas or
features, each corresponding to a module.
2. Define Module Interfaces: Detail the interfaces for each module, specifying
interactions with other modules and external systems, including input and output
data.
With a solid understanding of modularity and its benefits, we can now explore how
design principles like SOLID further enhance modularity and maintainability. These
principles provide guidelines to refine modular design, ensuring that each module is
robust and adaptable.
What It Means: Each module or class in your software should have only one job or task.
Why It’s Important: When a class or module has a single responsibility, it’s easier to
update and less likely to cause issues in other parts of your system.
Example: For instance, a UserService class should solely handle user-related tasks like
registration and login, not payment processing. This separation ensures that changes to
payment handling won’t impact user operations.
What It Means: Your software should be designed so that new features can be added
without altering existing code.
Why It’s Important: This principle helps in maintaining system stability. By extending
existing code instead of modifying it, you avoid introducing bugs to existing
functionalities.
Example: Consider adding new report types to your system. Instead of modifying the
current report classes, you should extend them with new classes that handle the new
report types.
What It Means: Subclasses should be able to replace their parent classes without
affecting the correctness of the program.
Why It’s Important: Ensuring that subclasses can be used interchangeably with their
parent classes maintains consistency and reliability in your system.
Example: If you have a Rectangle class and create a Square class that inherits from it,
the Square should work wherever a Rectangle is expected, without breaking
functionality.
What It Means: Clients should not be forced to use interfaces they don’t need.
Why It’s Important: This principle helps keep your classes focused and prevents them
from being cluttered with unnecessary methods.
Example: A Printable interface should only include methods relevant to printing, not
unrelated methods like those for saving files. This ensures that classes implementing
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 153 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
Printable are not burdened with unnecessary functionality.
What It Means: High-level modules should not depend on low-level modules. Instead,
both should depend on abstractions (interfaces).
Why It’s Important: This principle enhances flexibility and makes the system easier to
modify. By depending on abstractions, you can change low-level implementations
without affecting the high-level modules.
By incorporating these SOLID principles, your software design will become more
modular, maintainable, and adaptable to changes over time.
Design Patterns don’t go directly into our code, they first go into our brain. Once
we have loaded our brain with a good working knowledge of patterns, we can start to
apply them to our new designs and rework our old code when we find it degrading into
an inflexible mess.
Common Patterns
The Singleton pattern ensures a class has only one instance and provides a
global point of access to it. This is useful when exactly one object is needed to
Common Uses:
The abstract factory, factory method, builder, and prototype patterns can use
singletons.
Facade objects are often singletons because only one facade object is required.
They do not pollute the global namespace (or, in languages with nested
namespaces, their containing namespace) with unnecessary variables.
They permit lazy allocation and initialization, whereas global variables in many
languages will always consume resources.
The Factory pattern defines an interface for creating an object, but lets
subclasses decide which class to instantiate. Factory method lets a class defer
instantiation to subclasses.
As with every factory, the Factory Method Pattern gives us a way to encapsulate
the Instantiations of concrete types. Looking at the class diagram above, we can see that
the abstract creator class gives you an interface with a method for creating objects, also
known as the factory method. Any other methods implemented in the abstract creator are
written to operate on products produced by the factory method. Only subclasses actually
implement the factory method and create products.
The Factory Method Pattern lets subclasses decide which class to instantiate.
Because the creator class is written without the knowledge of the actual product that will
be created, we say "decide" not because the pattern allows subclasses themselves to
decide, but rather because the decision actually comes down to which subclass is used
to create the product.
The pattern that keeps our objects in the known when something they care about
happens, is the Observer pattern. It is one of the most commonly used design patterns
and also incredibly useful. The Observer pattern defines a one-to-many dependency
between objects s+o that when one object changes state, all of its dependents are
notified and updated automatically.
Identification:
7. The SOLID principle that states each module or class should have only one
responsibility.
8. The SOLID principle that ensures high-level modules do not depend on low-level
modules but on abstractions like interfaces.
9. The design pattern that ensures only one instance of a class is created and
provides global access to it.
10. The design pattern that defines a one-to-many dependency between objects,
ensuring that all dependent objects are notified when one object changes state.
Identification:
1. Modularity
2. Reusability
3. Scalability
4. Maintainability
6. Integration
9. Singleton Pattern
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
2. Learn how to define system architecture that meets both functional and non-
functional requirements.
System Architecture
In systems architecture, it's crucial to understand the key components that form
the backbone of any efficient and well-structured system. Let's explore ten essential
components that define the landscape of software architecture.
Software Stack: A set of software layers that includes the operating system,
middleware, and application software.
Web User Interface (UI): Web UI is the user-facing part of the system where
users interact with the application.
Monitoring and Logging: Tools and practices to track system performance and
identify issues.
Backup and Recovery: Procedures and tools in place to ensure data backup and
system recovery in case of failures.
Start by identifying the key parts of your system. Each part, or component, plays a
crucial role in the system’s overall functionality. For instance, in an online store:
o User Interface (UI): The front-end where customers browse and shop.
Think of these components like the rooms in a house: each room has a specific
function, like the kitchen for cooking or the living room for relaxing. Each system
component has a distinct role, contributing to the system’s overall operation.
Next, determine how these components will interact with each other through
interfaces. Interfaces are like bridges that allow different parts of the system to
exchange information. For example:
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 163 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
o User Interface to Payment Gateway: The UI sends transaction details to
the payment gateway using an API (Application Programming Interface).
This ensures secure and accurate communication between the two
components.
Imagine this as a kitchen door through which dishes are passed to the dining room.
The door (interface) ensures that the dishes (data) are transferred smoothly and
securely.
Develop a high-level diagram that illustrates how all the components fit together. This
visual representation helps you see the entire system at a glance. For instance:
It’s like a blueprint for a house that shows the layout and connections between rooms,
helping you visualize how everything fits together.
Think of this like preparing your house for a big party. You need enough space
and resources to accommodate all your guests comfortably. Similarly, your system
architecture should be capable of handling expected loads and ensuring security.
1. Scalability ensures that the system can grow to accommodate more users or
data without performance issues. For example, designing a restaurant with the
flexibility to add more tables as customer numbers increase helps in managing
growth seamlessly. Scalability is crucial for keeping the system functional and
responsive as demand rises.
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 164 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
2. Modularity involves breaking the system into separate, manageable
components that can be independently updated or replaced. Imagine a modular
kitchen where appliances can be upgraded without redesigning the entire
space. This approach simplifies maintenance and allows for easier updates, as
changes to one part do not affect the entire system.
3. Performance ensures that the system operates efficiently and quickly. For
instance, designing a car to accelerate smoothly and without lag reflects good
performance. Efficient performance is vital for delivering a smooth user
experience and meeting user expectations.
4. Security protects the system from unauthorized access and potential threats.
Just as you would install locks and alarms to safeguard your home,
implementing robust security measures helps protect the system from cyber
threats. Strong security is essential for maintaining data safety and user trust.
Address both the business needs (what the client envisions) and the technical details
(how the system will operate). Ensure the design aligns with the client's goals and
incorporates necessary technical elements, such as database structure and user
interface layout. This dual focus ensures the architecture supports the intended
functionality and meets user expectations.
Multiple Choice
7. Which of the following ensures that a system can handle increased loads
and traffic?
a) Security Measures
b) Scalability Solutions
c) Data Storage Solutions
Date Document No. AB-ICT0601914251302
Conducting Object-Oriented Developed: Issued by:
Page 166 of
Analysis and Design for
Developed by: 176
Python Applications
Revision #
d) Monitoring and Logging
14. What does the process of translating system specifications into design
involve?
a) Focusing only on technical needs and ignoring business goals
b) Creating a detailed design that balances technical and business
requirements
c) Eliminating the need for architectural design documents
d) Defining the code structure for the project before starting development
1. b
2. b
3. c
4. b
5. b
6. b
7. b
8. b
9. a
10. a
11. b
12. c
13. c
14. b
15. b
Learning Objectives:
After reading this INFORMATION SHEET, you should be able to:
1. Ensure that the system design adheres strictly to the system requirements as
outlined by stakeholders.
2. Develop a system design that is fully aligned with both functional and non-
functional requirements.
3. Learn to verify and validate the system design against system requirements,
ensuring that every component satisfies its intended purpose.
When developing a system design, it's crucial to ensure that every element
aligns with the requirements specified by stakeholders. This process involves translating
the detailed requirements into a practical design that meets their needs. Here’s a step-
by-step approach to achieve this:
2. Translate Requirements into Design: Break down the requirements into design
components. For instance, if a requirement specifies high security for user data,
your design should include robust encryption methods and secure access
controls.
Functional Requirements: These describe what the system should do. They
include specific functionalities or features that the system must have. For
example, if you’re designing a banking application, a functional requirement might
be that the system should process transactions securely.
Process Overview
3. Integrate Requirements into Design: Ensure that both functional and non-
functional requirements are reflected in your design decisions. This means
building features that fulfill functional needs and incorporating mechanisms that
address performance and scalability.
4. Verify and Validate Design: Regularly review your design to ensure it meets both
types of requirements. Testing the system against these criteria helps confirm that
the design works as intended and performs effectively.
o Performance Testing: Assess how the system handles load and scales
under stress. This includes stress testing to observe system performance
under heavy usage.
o Security Testing: Ensure that the system is secure from potential threats.
This involves testing for vulnerabilities such as SQL injection or cross-site
scripting.
4. Refine and Adjust: Based on the review, testing, and feedback, make necessary
adjustments to the design. This could involve tweaking features, enhancing
performance, or addressing any identified issues. For example, if users report that
the login process is slow, optimize the code to improve performance.
Multiple Choice
10. What is the goal of refining and adjusting the system design based on
testing and feedback?
a) To change the project’s original scope
b) To optimize and improve system performance, features, and usability
c) To eliminate functional requirements
d) To speed up the development process
Multiple Choice
1. b
2. a
3. b
4. b
5. b
6. b
7. b
8. b
9. b
10. b