Group Project ThayMan 2
Group Project ThayMan 2
Mentor:
Name Signature Date
Mr Nguyen Duc Man
1
PROJECT INFORMATION
Tel: 0904235945
2
TOPIC 5 DOCUMENT
Author(s)
URL
DOCUMENT HISTORY
Version Person Date Description
Mai Hoang Lan
Ngo Hong Ky
1.0 24 March, 2025 Draft
Truong Cong Thanh
Le Hoa Hiep
3
Contents
1. Introduction................................................................................................................5
1.1. Context..................................................................................................................5
1.2. Objectives..............................................................................................................5
1.3. Scope......................................................................................................................5
2. Theoretical Basis........................................................................................................5
2.1. Error Detection Techniques in the Student Management System..................5
2.2. Code Quality Measurement Techniques............................................................6
3. Method of implementation........................................................................................7
3.1. Implementation process.......................................................................................7
3.2. Data Collection...................................................................................................10
3.2.1. Data source:..............................................................................................10
3.2.2. Data size:...................................................................................................10
4. Experimental results................................................................................................15
4.1. Input data............................................................................................................15
4.2. Measured / Predicted Results............................................................................19
4.3. Compare with traditional model (if any).........................................................19
5. Review and analysis.................................................................................................19
5.1. Advantages of the implemented method..........................................................19
5.2. Limitations of the study.....................................................................................19
6. Conclusion and recommendations.........................................................................20
6.1. Conclude..............................................................................................................20
6.2. Suggested improvements...................................................................................20
7. References.................................................................................................................21
4
1. Introduction
1.1. Context
In software development, evaluating source code quality is a crucial factor in
ensuring maintainability, readability, and performance optimization. A student
management system is a software application designed to store, manage, and
process student-related data such as enrollment, grades, and attendance. Ensuring
high-quality source code for such a system is essential for long-term scalability
and stability.
1.2. Objectives
- Develop an automated tool for collecting and analyzing code quality metrics.
- Provide a visual representation of the evaluation results.
- Offer optimization suggestions to improve code quality.
1.3. Scope
- Supports analyzing Python and Java source code.
- Utilizes key software quality metrics: Lines of Code (LOC), Cyclomatic
Complexity, Code Duplication, Cohesion & Coupling.
- Displays results through a web-based interface.
2. Theoretical Basis
2.1. Error Detection Techniques in the Student Management System
During the development of a student management system, detecting and fixing
errors is crucial to ensuring software quality. Common techniques for error
detection include:
Static Analysis:
Uses tools like pylint, ESLint, SonarQube to detect syntax errors, logical
errors, and coding style violations.
Checks for issues such as memory leaks and uninitialized variables.
5
Unit Testing:
Writing test cases to verify the functionality of individual components.
Popular tools: JUnit (Java), Jest (JavaScript), PyTest (Python).
Integration Testing:
Ensures that different modules of the system work correctly when
integrated.
Supporting tools: Postman, Selenium, Cypress.
Black Box Testing:
Tests the system without requiring knowledge of the source code, focusing
on inputs and expected outputs.
Typically performed by QA teams or test users.
White Box Testing:
Analyzes the source code to verify logical paths and data flow.
Tools: JUnit, Mocha, PyUnit.
Error Monitoring in Production:
Uses logging systems such as ELK Stack (Elasticsearch, Logstash, Kibana)
or Sentry to track errors occurring in real-time environments.
2.2. Code Quality Measurement Techniques
- To ensure high-quality code in the student management system, the following
measurement techniques are applied:
Lines of Code (LOC):
Measures the total number of lines in the system.
A high LOC count may indicate complex and hard-to-maintain code.
Measurement tools: cloc, radon.
Cyclomatic Complexity:
Evaluates the complexity of control flow based on the number of decision
branches in the source code.
6
High values may indicate code that is difficult to understand and error-
prone.
7
5. Propose Testing Strategies
Develop and propose suitable testing strategies to improve accuracy, including
automated testing, manual testing, security testing, and performance testing.
6. Apply & Evaluate Effectiveness
Implement the proposed testing strategies, collect results, and assess their
effectiveness. Adjust methods if necessary to optimize the testing process.
7. End
The project concludes once the testing strategies have been applied and their
effectiveness has been validated. A final report may be created, along with
recommendations for future improvements.
8
Flow chart
9
3.2. Data Collection
10
3.2.1. Data source:
https://github.com/LanHoang30062004/measurement.git
3.2.2. Data size:
Number of samples
Number of Functions analyzed: 26
- StaffService.java:
- Number of functions: 9
findAll()
findById(Long id)
findByName(String name)
findByClassEntityId(Long id)
findAllByClassEntityIdIsNull()
save(StaffDTO staffDTO)
findByStaffId(Long id)
findBySubjectEntitiesIsEmpty()
deleteById(Long id)
- StudentService.java:
- Number of functions: 5
findById(Long id)
findAll()
save(StudentDTO student)
findByStudentId(Long id)
deleteById(Long id)
- SubjectService.java:
- Number of functions: 4
findById(Long id)
findAll()
save(SubjectDTO, subjectDTO)
11
deleteById(Long id)
- TranscriptService.java:
- Number of functions: 5
save(TranscriptDTO transcriptDTO)
findAll()
findByStudentID(Long id)
findById(Long id)
deleteById(Long id)
- UserService.java:
- Number of functions: 3
loadUserByUsername(String username)
authorities(List<RoleEntity> roles)
addNewUser(UserEntity user)
Number of measured variables
- StaffService.java
LOC: 41
Cyclomatic Complexity ( CC=E−N+2P ):
Nodes (N): 2
Edges (E): 2
Components (P): 1
CC=E−N+2P=2−2+2(1)=2
Code Duplication: 10%
- StudentService.java
LOC: 37
12
Cyclomatic Complexity ( CC=E−N+2P ):
Nodes (N): 3
Edges (E): 3
Components (P): 1
CC=E−N+2P= 3−3+2(1)=2
Code Duplication: 8%
- SubjectService.java
LOC: 37
Cyclomatic Complexity ( CC=E−N+2P ):
Nodes (N): 3
Edges (E): 3
Components (P): 1
CC=E−N+2P= 3−3+2(1)=2
Code Duplication: 7%
- TranscriptService.java
LOC: 42
Cyclomatic Complexity ( CC=E−N+2P ):
Nodes (N): 4
Edges (E): 5
Components (P):
CC=E−N+2P= 5−4+2(1)=3
Code Duplication: 12%
- UserService.java
LOC: 29
13
Cyclomatic Complexity ( CC=E−N+2P ):
Nodes (N): 3
Edges (E): 3
Components (P): 1
CC=E−N+2P= 3−3+2(1)=2
Code Duplication: 9%
Function Point
- StaffService.java
EI: 2 (weight 4)
EO: 3(weight 5)
EQ: 3 (weight 4)
ILF : 2 (weight 7)
EIF: 1 (weight 5)
FP=(2×4)+(3×5)+(3×4)+(2×7)+(1×5)=54
- StudentService.java
EI: 2 (weight 4)
EO: 2(weight 5)
EQ: 2 (weight 4)
ILF : 2 (weight 7)
EIF: 1 (weight 5)
FP=(2×4)+(2×5)+(2×4)+(2×7)+(1×5)=45
- SubjectService.java
EI: 1 (weight 4)
EO: 2(weight 5)
EQ: 1 (weight 4)
ILF : 1 (weight 7)
EIF: 1 (weight 5)
FP=(1×4)+(2×5)+(1×4)+(1×7)+(1×5)=30
- TranscriptService.java
EI: 3 (weight 4)
14
EO: 3(weight 5)
EQ: 2 (weight 4)
ILF : 2 (weight 7)
EIF: 1 (weight 5)
FP=(3×4)+(3×5)+(2×4)+(2×7)+(1×5)=62
- UserService.java
EI: 2 (weight 4)
EO: 2(weight 5)
EQ: 2 (weight 4)
ILF : 1 (weight 7)
EIF: 1 (weight 5)
FP=(2×4)+(2×5)+(2×4)+(1×7)+(1×5)=42
3.3. Tools used
4. Experimental results
4.1. Input data
15
ID Service Function Type Time Period
16
NullPointerException nếu Khi xóa sinh
deleteById
7 findById(id) trả về null, sau đó gọi Runtime viên không tồn
(Long id)
các phương thức trên studentEntity tại
17
NullPointerException nếu Khi xóa môn
reportCardEntities hoặc học không có
14 deleteById(Long id) transcriptSubjectEntities là null, Runtime bảng điểm
rồi gọi vòng lặp for trên danh sách hoặc transcript
này
Khi lưu
NullPointerException nếu
trancript với
save(TranscriptDTO transcriptEntity
18 Runtime danh sách môn
transcriptDTO) .getTrancriptSubjectEntities()
học chưa khởi
là nul trước khi gọi add()
tạo
18
NullPointerException nếu Khi xóa
transcriptEntity transcript
21 deleteById(Long id) Runtime
.getTranscriptSubjectEntities() là null không có môn
trước khi duyệt danh sách học liên kết
Khi tìm
findByStudentID Không kiểm tra nếu findByID(id)
22 Runtime transcript với
(Long id) trả về null
id
Khi gọi
loadUser
Không kiểm tra roles có phải null
Authorities(List ByUserName
25 trước khi gọi stream(), có thể gây Runtime
<RoleEntity>roles) nhưng user
NullPointerException
không có vai
trò nào
19
lệ
20
- Impact of project structure: Certain factors like coding style and framework usage
may affect the measurement results but have not yet been considered.
21
7. References
https://ieeexplore.ieee.org/
https://dl.acm.org/
https://pylint.pycqa.org/
https://radon.readthedocs.io/
https://www.sonarqube.org/
https://www.ifpug.org/publications/counting-practices-manual/
https://iso25000.com/index.php/en/iso-25000-standards/iso-25010
https://cleancoder.com/
22
23