ASM1 Docx
ASM1 Docx
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 M1 P3 P4 M2 D1
1
❒ Summative Feedback: ❒ Resubmission Feedback:
2
TABLE OF CONTENT
TABLE OF CONTENT........................................................................................................................................3
INTRODUCTION...........................................................................................................................................8
1.1 Investigate the characteristics of the object- orientated paradigm, including class relationships and
SOLID principles.(P1)....................................................................................................................................9
1.1.1Object-oriented model:...........................................................................................................................9
1.1.2 There are principles guiding the construction and organization of the program:..................................9
1.2 Explain how clean coding techniques can impact on the use of data structures and operations when
writing algorithms.(P2).................................................................................................................................20
2.1 Design a large data set processing application, utilising SOLID principles, clean coding techniques and
a design pattern.(P3).....................................................................................................................................24
3
2.1.4 A class diagram....................................................................................................................................30
2.2 Design a suitable testing regime for the application, including provision for automated testing.(P4)...35
CONCLUSION.............................................................................................................................................46
REFERENCES..............................................................................................................................................47
4
LIST OF TABLES AND FIGURES
Figure 1 - 1. OOP..........................................................................................................................................................9
Figure 1 - 2 Encapsulation..........................................................................................................................................10
Figure 1 - 5 Inheritance..............................................................................................................................................11
Figure 1 - 8. UML........................................................................................................................................................13
Figure 1 - 9 Inheritance..............................................................................................................................................13
Figure 1 - 10 Composition..........................................................................................................................................14
5
Figure 1 -24 Consistency in using data structures......................................................................................................24
Figure 2 - 7 OCP.........................................................................................................................................................34
Figure 2 - 8 LSP...........................................................................................................................................................34
Figure 2 - 10 DIP.........................................................................................................................................................36
Figure 2 - 5 xUnit........................................................................................................................................................38
Figure 2 - 6 Fact..........................................................................................................................................................39
Figure 2 - 8 ClassData.................................................................................................................................................40
Figure 2 - 9 MemberData...........................................................................................................................................40
Figure 2 - 10 Test case 1 - Add student to the system when email is invalid.............................................................41
Figure 2 - 12 Test case 3 Add student with email containing special characters........................................................42
Figure 2 - 15 Test case 6 Add student with email missing ‘@’ symbol.......................................................................43
Figure 2 - 16 Test case 7 Add student with email having invalid top- level domain...................................................44
Figure 2 - 17 Test Case 8 Add student with email exceeding length limit..................................................................44
6
Figure 2 - 18 Test Case 9: Add student with email having multiple '@' symbols.......................................................45
Figure 2 - 19 Test Case 10 Add student with email containing uppercase letters......................................................45
7
LIST OF THE ACRONYM
OOP Object-Oriented Programming
E2E End-to-End
8
INTRODUCTION
The university sought to modernize its student information system to improve efficiency and
maintainability. To achieve this goal, students will collaborate in teams to design and implement a robust
Student Information Management System (SIMS) that adheres to object-oriented principles, SOLID
principles, coding practices Clear and combines many designs.
My team has been selected to deploy this system. As a first step, your team will conduct a basic
analysis of user requirements and system design. This foundational work will ensure the development of
SIMS meets the needs of the university and sets the standard for future improvements.
9
CHAPTER 1 INVESTIGATE THE IMPACT OF SOLID DEVELOPMENT PRINCIPLES ON THE
OOP PARADIGM(LO1)
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.
10
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:
11
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
12
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.
13
1.1.3 Class Relationships
a) Definition of UML:
- 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
14
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
15
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]
16
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.
17
- Meaning: Allows system functionality to be expanded without changing existing source code, helping to
minimize errors and increase stability.
- 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.
18
I - Interface Segregation Principle
- 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.
19
Figure 1 - 20 D - Dependency Inversion Principle
c) Benefits of SOLID
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)
20
→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.
Meaningful variable names: Use descriptive variable, function, class, and other identifiers that are
clear and unambiguous. Avoid using abbreviations unless they are widely understood.
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.
21
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
22
b) Impact on Data Structure and Operations
- 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.
23
Figure 1 - 23 Annotations for complex data structures:
- 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.
24
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.
25
- 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.
26
Figure 2 -1 A use case diagram
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.
27
- 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.
- 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
28
- 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.
29
Figure 2 - 2 A package diagram
Account Package:
30
- account: A class implementing the IAccount interface.
Person Package:
Student Package:
Education Package:
- View Account In Course: Possibly a class for viewing account details within a course context.
31
Figure 2 - 4 A package diagram
- 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
32
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.
- A package diagram shows how classes are grouped into logical packages. ‘UserManagement’ handles
classes related to user management such as Users, Roles, and Administrators. ‘AcademicManagement’
handles academic-related functions including Teachers, Classes, Students, and Grades. This organization
promotes modularity and encapsulation, allowing for easier maintenance and extension of SIMS
applications.
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.
33
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
34
Interface Segregation Principle (ISP):
Interfaces (not shown explicitly in the diagram for brevity) are used to define specific contracts. For
example, interfaces can separate functionality required by different user roles, ensuring classes
implement only what they need.
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.
35
Figure 2 - 10 DIP
2.2 Design a suitable testing regime for the application, including provision for
automated testing.(P4)
36
Benefits of automated testing in the application development process:
Run tests faster, allowing for frequent testing and quick feedback.
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.
37
- Detect integration errors. - Complicated and difficult to
maintain.
- Guaranteed user experience.
- Poor fault tolerance.
User Interface (UI) - Make sure the user interface works properly. - Long testing period.
Testing
- User interaction testing. - Difficult to maintain.
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
38
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
39
- 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
40
2.2.3 Experimental design
In designing the test mode for this student information management application, I will use xUnit
- Description: Check the behavior of adding students with invalid email addresses and that student will
not be added to the system
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.
41
- 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.
42
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.
43
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.
44
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
45
Figure 2 - 20 Test results
=> So I have completed designing a suitable test mode for several functions of the student information
management application.
46
CONCLUSION
- The Student Information Management System (SIMS) project provides a key opportunity for the
university to improve operational efficiency and maintainability through modernization. By applying
object-oriented principles, SOLID principles, clean coding practices, and combining different design
patterns, our team aims to provide a robust and adaptable solution , meeting global demand. The
foundation of SIMS will be rooted in a thorough analysis of user requirements, ensuring that every
feature and functionality is closely aligned with the needs of administrators, teachers, students and
parents. . This user-centric approach not only enhances usability but also ensures that the system
remains intuitive and energy efficient.
47
REFERENCES
Trần, V. (2024) OOP là gì? Chi tiết về lập trình hướng đối tượng, 200Lab Blog. 200Lab Blog.
Available at: https://200lab.io/blog/oop-la-gi/ (Accessed: 17 June 2024).
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).
48