Frontsheet Asm Final Report (Ind+Group)
Frontsheet Asm Final Report (Ind+Group)
Unit number and title Unit 20: Applied Programming and Design Principles
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration
is a form of malpractice.
Grading grid
P1 P2 P3 P4 M1 M2 D1
ASSIGNMENT GROUP WORK
Qualification Pearson BTEC Level 5 Higher National Diploma in Computing
Unit number and title Unit 20: Applied Programming and Design Principles
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of
malpractice.
P5 P6 P7 M3 M4 D2
OBSERVATION RECORD
Student
Student
Date:
signature:
Assessor
Date:
signature:
Assessor
name:
r Summative Feedback: r Resubmission Feedback:
TABLE OF CONTENT........................................................................................................................................5
INTRODUCTION.........................................................................................................................................11
1.1 Investigate the characteristics of the object- orientated paradigm, including class relationships and
SOLID principles.(P1)..................................................................................................................................12
1.1.1Object-oriented model:.........................................................................................................................12
1.1.2 There are principles guiding the construction and organization of the program:................................12
1.2 Explain how clean coding techniques can impact on the use of data structures and operations when
writing algorithms.(P2).................................................................................................................................22
2.1 Design a large data set processing application, utilising SOLID principles, clean coding techniques and
a design pattern.(P3).....................................................................................................................................27
CONCLUSION.............................................................................................................................................57
REFERENCES..............................................................................................................................................58
LIST OF TABLES AND FIGURES
Figure 1 - 1. OOP........................................................................................................................................................12
Figure 1 - 2 Encapsulation..........................................................................................................................................13
Figure 1 - 5 Inheritance..............................................................................................................................................14
Figure 1 - 8. UML........................................................................................................................................................16
Figure 1 - 9 Inheritance..............................................................................................................................................16
Figure 1 - 10 Composition..........................................................................................................................................17
Figure 2 - 7 OCP.........................................................................................................................................................36
Figure 2 - 8 LSP...........................................................................................................................................................36
Figure 2 - 10 DIP.........................................................................................................................................................38
Figure 2 - 5 xUnit........................................................................................................................................................40
Figure 2 - 6 Fact..........................................................................................................................................................41
Figure 2 - 8 ClassData.................................................................................................................................................42
Figure 2 - 9 MemberData...........................................................................................................................................42
Figure 2 - 10 Test case 1 - Add student to the system when email is invalid.............................................................43
Figure 2 - 12 Test case 3 Add student with email containing special characters........................................................44
Figure 2 - 15 Test case 6 Add student with email missing ‘@’ symbol.......................................................................45
Figure 2 - 16 Test case 7 Add student with email having invalid top- level domain...................................................46
Figure 2 - 17 Test Case 8 Add student with email exceeding length limit..................................................................46
Figure 2 - 18 Test Case 9: Add student with email having multiple '@' symbols.......................................................47
Figure 2 - 19 Test Case 10 Add student with email containing uppercase letters......................................................47
E2E End-to-End
MVC Model-View-Controller
INTRODUCTION
From the report in asm1 we continue in asm2
In the field of computing, cognitive skills include a deep understanding of essential facts, concepts,
principles and theories. These skills enable individuals to model and design computer-based systems,
facilitating understanding, communication, prediction and evaluation of trade-offs. The ability to
recognize and analyze specific criteria and specifications of a problem, along with planning effective
strategies, is important. Furthermore, evaluating the performance and future development of computer-
based systems, along with deploying appropriate theories, practices and tools, is an integral part of their
design, implementation and evaluation.
Practical computing skills include evaluating systems based on quality attributes and potential trade-
offs, managing projects within given constraints and recognizing risks and safety aspects. Proficiency in
the use of tools for building and documenting computer applications, along with critical evaluation and
analysis of complex problems, is essential. These skills are essential in delivering solutions within budget.
(P1) Investigate the characteristics of the object- orientated paradigm, including class relationships
and SOLID principles.
(P2) Explain how clean coding techniques can impact on the use of data structures and operations
when writing algorithms.
CHAPTER 2. DESIGN A LARGE DATASET PROCESSING APPLICATION USING SOLID PRINCIPLES AND CLEAN
CODING TECHNIQUES
(P3) Design a large data set processing application, utilising SOLID principles, clean coding techniques
and a design pattern.
(P4) Design a suitable testing regime for the application, including provision for automated testing.
P5: Build a large dataset processing application based on the design produced
P6: Examine the different methods of implementing automatic testing as designed in the test plan.
1.1 Investigate the characteristics of the object- orientated paradigm, including class
relationships and SOLID principles.(P1)
1.1.1Object-oriented model:
Definition of OOP:
- Object-oriented programming (OOP) is a programming model based on the concept of "objects", which
can contain data in the form of fields (usually called properties or attributes) and code in the form of
procedures (usually called as methods). General structures in OOP include classes, objects, properties,
constructors, and methods.
Figure 1 - 1. OOP
1.1.2 There are principles guiding the construction and organization of the program:
Encapsulation: Encapsulation is the concept of wrapping data and the methods that operate on the
data within a single unit or class. This helps protect the data from outside interference and misuse.
Figure 1 - 2 Encapsulation
Abstraction: Abstraction is the process of hiding the complex implementation details and showing
only the essential features of the object. This can be achieved using abstract classes and interfaces.
- Abstract Class:
- Interface:
Figure 1 - 4 Abstraction- Interface
Inheritance: Inheritance is a mechanism where a new class inherits the properties and behaviors of
an existing class.
Figure 1 - 5 Inheritance
Polymorphism: Polymorphism allows objects to be treated as instances of their parent class rather
than their actual class. The most common use of polymorphism is when a parent class reference is
used to refer to a child class object.
- Method Overloading (Compile-time Polymorphism):
- Unified Modeling Language (UML) is a standardized modeling language that provides a general-
purpose, developmental, modeling framework for specifying, visualizing, constructing, and documenting
the artifacts of software systems. A class diagram is a type of static structure diagram that describes the
structure of a system by showing its classes, their attributes, operations (or methods), and the
relationships among the objects.[2]
Figure 1 - 8. UML
Inheritance:Inheritance is used to describe the relationship between the base class and derived
class. In an inheritance relationship, the child class will inherit all the properties and methods of the
parent class. At the same time, the child class can add different information than the parent class
Figure 1 - 9 Inheritance
Composition: Is the relationship between the whole and a part of the class. When the overall object
does not exist, the parts will not exist.
Figure 1 - 10 Composition
Aggregation: Represents the relationship between the whole and part of the class, in which parts
can exist independently of the overall object.
Figure 1- 11 Aggregation
Realization/ Implementation: Used to define the relationship between interface and implementing
classes, a class implementing an interface must implement all the methods that the interface has
declared
Dependencies: Is a relationship where changes in one layer can affect the other layer. A change in
one layer can affect other tests in another layer
Figure 1 -13 Dependencies
Association: A class property contains references to instances of other classes. There is a connection
between this object and another object. Composition and Aggregation also belong to association
relationships
- There are four types of links: two-way links, one-way links, character links, and multiple number links
- SOLID is a set of software design principles intended to make source code easy to maintain, extend, and
reuse. These principles were introduced by Robert C. Martin (aka Uncle Bob) and are the foundation of
object-oriented programming (OOP) and good software design.[3]
Figure 1 - 15. SOLID
Purpose: The goal of the SOLID principles is to improve the flexibility, scalability, and maintainability
of software by creating systems that are easy to understand, change, and extend.
b) SOLID types
S - Single-responsibility Principle
- Definition: A class should only have one reason to change, meaning it should have only one
responsibility.
- Meaning: Makes code clearer and easier to understand, reduces dependencies between parts of the
system, and makes maintenance and extension easier.
O - Open-closed Principle
- Definition: Software entities (classes, modules, functions, etc.) should be open for extension but closed
for modification.
- Meaning: Allows system functionality to be expanded without changing existing source code, helping to
minimize errors and increase stability.
Figure 1 - 17 O - Open-closed Principle
- Definition: Objects of a derived class must be able to substitute for objects of the base class without
changing the correctness of the program.
- Meaning: Ensures that subclasses can be used in place of the superclass without damaging the
correctness of the application.
- Definition: Classes should not be forced to depend on interfaces they do not use. Instead, specific
interfaces should be created with a clear purpose.
- Meaning: Reduce dependencies and increase flexibility by creating smaller, more specific interfaces
instead of large, generic interfaces.
- Definition: High-level modules should not depend on low-level modules. Both should depend on
abstract interfaces. Abstract interfaces should not depend on details. The details should depend on the
abstract interfaces.
- Meaning: Reduce dependencies between modules, increase extensibility and source code reuse.
Ease of Maintenance: SOLID principles help create code that is easy to read, understand, and
maintain. This helps minimize the time and effort required to fix errors and make changes.
Source Code Reuse: Classes and modules designed according to SOLID principles are highly
reusable, helping to reduce the effort of redeveloping source code for different projects.
Increased Flexibility and Scalability: Systems that follow SOLID principles are easily extended and
adapted to meet new requirements without having to change existing code.
Minimize Risk and Errors: By separating responsibilities and reducing dependencies between
modules, SOLID principles help minimize risk and errors when making changes or adding new
features.
Improves Development Process: SOLID principles encourage good development practices and
help create a more structured and organized software development process.
1.2 Explain how clean coding techniques can impact on the use of data structures
and operations when writing algorithms.(P2)
→Example: Instead of naming a variable ‘a’, use ‘age’ if it stores the age of a person.
Modularity: Break down the code into small, self-contained modules or functions, each responsible
for a single piece of functionality. This makes the code easier to understand, test, and maintain.
→Example: Instead of having a large function that performs multiple tasks, split it into smaller functions,
each performing a single task.
Consistency: Follow a consistent coding style and conventions throughout the codebase. This
includes consistent naming conventions, indentation, and use of braces.
→Example: If you follow camelCase for variable names, use it consistently for all variable names.
Comments: Use comments to explain the purpose and logic of the code, especially in complex
sections. Avoid redundant comments that merely restate what the code does.
Modularity: Dividing source code into small, independent modules or functions, each responsible for
a specific function. This makes the code easy to understand, test, and maintain.
Comments: Use comments to explain the purpose and logic of the code, especially in complex
sections. Avoid redundant comments that simply reiterate what the code already does.
Consistency: Adhere to consistent coding style and conventions throughout the source code. This
includes naming, indentation, and use of brackets.
Maintainability: When code is clean, making changes, adding features, or fixing bugs becomes much
simpler.
Extensibility: It ensures that components can be reused and extended without extensive rewriting.
Debugging and testing: Clear and concise code paths make it simpler to trace the source of the
problem.
Adaptability: Refactoring is easier than clean code making refactoring less risky and more
manageable.
Single Responsibility A class or function should have one and only one
reason to change.
KISS (Keep It Simple, Stupid) Keep your code simple and avoid unnecessary
complexity.
YAGNI (You Aren't Gonna Need It) Don't add functionality until it is necessary
- Impact: Meaningful variable names make the purpose of the 'studentAges' and 'courseIds' lists clear,
making them easier for readers to understand and reducing the possibility of errors.
- Impact: Modular functions improve readability and reuse. Each function only performs a single task,
making the code easier to test and maintain.
- Impact: Annotations clarify the structure and purpose of the graph, making it easier for new
programmers to understand how the graph is represented.
- Impact: Consistent use of a dictionary to store user information makes code more readable and reduces
the cognitive burden on the programmer, making data management and processing easier.
CHAPTER 2. DESIGN A LARGE DATASET PROCESSING APPLICATION USING SOLID
PRINCIPLES AND CLEAN CODING TECHNIQUES
2.1 Design a large data set processing application, utilising SOLID principles, clean
coding techniques and a design pattern.(P3)
Currently, the school is looking for ways to systematize the student information system to improve
efficiency and maintainability. Our team will work to design and implement a robust SIMS that follows
object-oriented, SOLID principles, clean code, and multiple design partners.
Require function:
Course management:
- Implement role-based access control to restrict system functions based on user roles.
Require function:
- Collect and store necessary student information, including personal information and academic records.
Unreasonable requests:
- Scalability: The system must be scalable to accommodate increasing numbers of students and courses
over time.
- Efficiency: Ensures the system meets user requirements within acceptable timeframes, even during
peak usage periods.
- Accessibility: Ensure systems are accessible to users with disabilities, adhering to accessibility
standards.
- Reliability: The system must be reliable, with minimal downtime for maintenance or unexpected
failures.
- Security: Implement strong security measures to protect sensitive student information and ensure data
integrity.
- Usability: User-friendly interface design, suitable for users with different levels of technical expertise.
Manage Classes
- Actor: Teacher
- Description: The teacher can create, update, and delete classes. This includes assigning students to
classes and managing class schedules.
- Actor: Teacher
- Description: The teacher can input, modify, and remove student scores for various assignments, exams,
and overall grades.
- Description: Both teachers and administrators can access detailed information about students,
including personal data, academic records, and enrollment status.
Log In/Out
- Description: All users (students, teachers, and administrators) can log into and out of the system
securely using their credentials.
View Student Points
- Description: Students can view their own grades and points. Teachers can also view the grades and
points of the students they are responsible for.
View Course
- Actor: Student
- Description: Students can browse and view details of the courses they are enrolled in or interested in
enrolling.
- Actor: Student
- Description: Students can access their personal accounts to manage their course enrollments and view
their academic progress.
Manage Users
- Actor: Admin
- Description: Administrators can manage user accounts, including creating, updating, and deleting
accounts for students, teachers, and other administrators.
Generate Reports
- Actor: Admin
- Description: Administrators can generate various reports related to student performance, course
enrollments, and overall system usage.
System Settings
- Actor: Admin
- Description: Administrators can configure and manage system settings, including security settings,
system parameters, and other administrative functions.
Associations:
- Actors such as Students, Teachers, and Admins interact with the system to perform the described use
cases.
- Use cases like "Log In/Out" are fundamental and are associated with all actors for accessing the system.
- Actions such as managing classes, scores, and users are more specific to roles like Teachers and Admins.
Include:
- The "Log In/Out" use case is included in all scenarios where a user needs to access the system.
- "View Student Information" and "View Student Points" are included in the functionalities for both
Teachers and Students.
Extend:
- "System Settings" can be extended to include more detailed administrative functions as needed.
Account Package:
Person Package:
Student Package:
Education Package:
- View Account In Course: Possibly a class for viewing account details within a course context.
- Use case diagrams outline how different actors interact with SIMS. Administrators can manage users,
generate reports, and configure system settings. Teachers can manage classes, enter grades, and view
student profiles. Students have the ability to view grades, class schedules, and update their personal
information. Parents can view their child's grades and class schedule. This diagram helps visualize the
different functions provided by the system from the user's perspective.
- The class diagram illustrates the structure of the SIMS system. Users are represented by common
attributes such as ID, name, email, and password. Roles determine access levels in the system. Students
have their grades and class schedules, while teachers manage their classes and assign students to them.
Classes contain students and grades are associated with students. Administrators have specific actions
related to managing users, generating reports, and configuring settings. This structured approach ensures
clarity in system design and helps understand the relationships between different entities.
Each class and package is designed to have a single responsibility. For example, ‘UserManagement’
package only handles user-related activities while ‘AcademicManagement’ focuses on academic
functions. This ensures classes have clarity about their roles.
Classes are designed to be open to extension but closed to modification. For example, new roles or user
types can be added by extending existing classes (like User) without changing their core implementation.
Figure 2 - 7 OCP
Derived classes (e.g. Student, Teacher, Administrator) can replace their base class (User) without
affecting the correctness of the application. This principle ensures compatibility and flexibility within the
class hierarchy.
Figure 2 - 8 LSP
Figure 2 - 9 ISP
High level modules (like Admin, Teacher, Student) depend on abstraction (interface) rather than concrete
implementation. This allows for easier decoupling and management of dependencies, facilitates easier
unit testing, and more flexibility in changing implementations.
Figure 2 - 10 DIP
2.2 Design a suitable testing regime for the application, including provision for
automated testing.(P4)
Eliminate human error, ensuring steps are performed correctly every time.
Integrates well with modern development methods such as Agile and DevOps.
- Definition: Tests individual units or components of the software to ensure they work as intended.
- Definition: Tests the complete workflow of the application from start to finish.
- Purpose: Ensures the entire application flow works correctly from the user’s perspective.
- Quick testing.
Testing application
▪ NUnit: A widely used testing framework, with a rich feature set and extensive plugin ecosystem.
▪ MSTest: Default framework provided by the Microsoft Visual Studio toolkit, providing tight
xUnit
Figure 2 - 5 xUnit
Fact: Use [Fact] attribute to check. It's simple and modern, with a focus on scalability.
Figure 2 - 6 Fact
Theory: is the way of creating test cases based on data. It includes the following 3 data attributes:
- InlineDataTest: Constant values or small sets of data are defined directly within the test method.
Figure 2 - 7 InlineData
- ClassData: A separate class implementing IEnumerable<object[]> is used to provide the test data.
Figure 2 - 8 ClassData
- MemberData: The test data is defined in a static property or method of the same class.
Figure 2 - 9 MemberData
Figure 2 - 10 Test case 1 - Add student to the system when email is invalid
Test case 2 - Add student to the system when phone number is invalid
- Description: This test case ensures that a student with a valid email format is successfully added to the
system.
- Description: This test case checks if a student with an email containing special characters ('.' in this
case) is added correctly to the system.
Figure 2 - 12 Test case 3 Add student with email containing special characters
- Description: This test case tests the scenario where the email is missing the domain part after '@',
ensuring the student is not added.
- Description: This test case verifies that a student with an email containing spaces is not added to the
system, as spaces in emails are invalid.
Figure 2 - 14 Test case 5 Add student with containing spaces
- Description: This test case ensures that a student with an email missing the '@' symbol is not added to
the system.
Figure 2 - 15 Test case 6 Add student with email missing ‘@’ symbol
Test Case 7: Add student with email having invalid top-level domain
- Description: This test case checks if a student with an email having an invalid top-level domain (e.g.,
'.comm' instead of '.com') is not added to the system.
Figure 2 - 16 Test case 7 Add student with email having invalid top- level domain
- Description: This test case verifies that a student with an email exceeding the typical length limit is not
added to the system.
Figure 2 - 17 Test Case 8 Add student with email exceeding length limit
Test Case 9: Add student with email having multiple '@' symbols
- Description: This test case ensures that a student with an email containing multiple '@' symbols is not
added to the system.
Figure 2 - 18 Test Case 9: Add student with email having multiple '@' symbols
Test Case 10: Add student with email containing uppercase letters
- Description: This test case checks if a student with an email containing uppercase letters is successfully
added to the system.
Figure 2 - 19 Test Case 10 Add student with email containing uppercase letters
=> So I have completed designing a suitable test mode for several functions of the student information
management application.
CHAPTER 3 BUILD A DATA PROCESSING APPLICATION BASED ON A DEVELOPED
DESIGN(LO3)
Our team has been chosen to implement the new SISM for the university. We understand the
importance of thoroughly analyzing user requirements and system design before proceeding to the
development phase.
❖ Functional requirements:
▪ Student registration
- Records and stores student information including personal information and academic records
▪ Course management
❖ Non-functional requirements:
▪ Scalability: The system must be scalable to accommodate increasing numbers of students and courses
over time.
▪ Performance: Ensures the system responds to user requests in a timely manner, even during peak
usage periods.
▪ Security: Implement strong security measures to protect sensitive student information and secure all
data.
▪ Ease of use: Design a user-friendly interface that is suitable for users with different technical skills.
▪ Reliable: The system must be reliable, with minimal downtime for maintenance or unexpected issues.
After evaluating the situation and identifying the functional and non-functional requirements of the
student system, we crafted a use case diagram. This diagram aims to thoroughly depict the interactions
between the system's components and its users, showcasing the various functions and features the
system offers to address the needs of all involved parties.
Figure
c) Class diagram:
Based on an in-depth analysis of the system requirements and specifications, we move on to the design
phase by creating a class diagram for the student information management system. This important step
provides a detailed representation of the system’s architecture, introducing the various components,
their properties, and the relationships between them. The class diagram acts as a blueprint, clarifying the
complex interactions between the system’s components and its users.
Figure
a) Login:
b) Home page:
g) Account management:
3.1.3. How the application helps in handling large data sets
- The student information management application provides significant advantages for handling large
datasets in schools:
Efficient Database Integration: It utilizes a robust database capable of efficiently storing and
retrieving extensive amounts of student and other relevant information.
Query Optimization: Queries are carefully optimized to minimize response times, ensuring quick
access to large datasets.
Data Partitioning: Data is segmented into smaller parts to accelerate processing and retrieval.
Effective Memory Management: The system is designed to optimize memory usage, maintaining
stable and smooth operation.
→ As a result, the SISM application is an invaluable tool for schools, facilitating the efficient handling of
large data sets. It serves not just as a management tool, but as a versatile system that enhances overall
management efficiency.
CHAPTER 4 PERFORM AUTOMATIC TESTING ON A DATA PROCESSING APPLICATION(LO4)
Figure
a) Unit Testing
- Unit testing is a fundamental practice that involves testing individual units of source code, such as
functions or methods. These tests are designed to be executed rapidly and should not depend on
external infrastructure. During the development phase, testers act as the initial users of the source code,
which helps in identifying design flaws and enhancing overall quality.
Application of Unit Testing: Unit testing allows us to test specific functions of an application to
ensure they work correctly.
b) Integration Testing
- Integration testing involves testing the interactions between different components, such as a database
query component. This type of testing necessitates the existence of infrastructure to facilitate these
interactions, which can make the process slower.
Application of Integration Testing: Integration testing allows us to combine and test components
that interact with each other to ensure they function together as intended.
- End-to-end testing focuses on the complete behavior of the application from the user’s perspective.
This involves testing the entire application workflow on actual infrastructure to simulate real-world
scenarios.
Application of E2E Testing: E2E testing is used to create test scenarios that mimic real user behavior,
such as testing the entire process from logging in to performing final actions, like adding a student.
Figure
Unit Testing Fast Execution: Unit tests run quickly, Limited Scope: Does not test how
providing immediate feedback. components interact with each
other.
Isolation: Tests individual pieces of code,
making it easier to identify and fix issues. Frequent Updates: Test cases may
need frequent updates due to
Early Bug Detection: Helps catch bugs
changes in code.
early in the development process.
No Integration Testing: Cannot catch
issues that arise from component
integration.
Data Flow: Detects problems in data flow Complexity: More complex to write
and exchange between modules. and maintain compared to unit
tests.
End-to-End Comprehensive Testing: Tests the entire Time-Consuming: Takes a long time
(E2E) application flow from the user’s to execute and develop.
Testing perspective.
Setup Complexity: Requires a
Real User Scenarios: Mimics real user comprehensive and realistic test
interactions to ensure the application environment.
works as expected.
Maintenance: Test scripts can be
High Confidence: Provides high confidence brittle and require regular
in the overall system integrity. maintenance.
Table
Herrera, M. (2023) As Easy as APIE: This Simple Disaster-Response Model Is Highly Effective, MHA
Consulting. Available at: https://www.mha-it.com/2022/07/28/apie/#:~:text=APIE%20is%20a%20simple
%20but,response%2C%20and%20Evaluate%20your%20response. (Accessed: 24 June 2024).
Oloruntoba, S. (2024) SOLID: The First 5 Principles of Object Oriented Design, DigitalOcean. DigitalOcean.
Available at: https://www.digitalocean.com/community/conceptual-articles/s-o-l-i-d-the-first-five-
principles-of-object-oriented-design (Accessed: 24 June 2024).