Cir206 Group 4
Cir206 Group 4
Cir206 Group 4
Code inspection is a type of Static testing that aims to review the software code and
examine for errors. It helps reduce the ratio of defect multiplication and avoids
later-stage error detection by simplifying all the initial error detection processes. This
code inspection comes under the review process of any application.
● Moderator, Reader, Recorder, and Author are the key members of an Inspection
team.
● Related documents are provided to the inspection team, which then plans the
inspection meeting and coordinates with inspection team members.
● If the inspection team is unaware of the project, the author provides an overview
and code to inspection team members.
● Then, each inspection team performs code inspection by following some
inspection checklists.
● After completion of the code inspection, a meeting will be conducted with all
team members to analyze the reviewed code.
Different modules specified in the design document are coded in the Coding phase
according to the module specification. The main goal of the coding phase is to code
from the design document prepared after the design phase through a high-level
language and then to unit test this code.
4. Indentation:
Proper indentation is very important to increase the readability of the code. To
make the code readable, programmers should use White spaces properly. Some
of the spacing conventions are given below:
○ There must be a space after giving a comma between two function
arguments.
○ Each nested block should be indented appropriately and spaced.
○ Proper indentation should be present at the beginning and the end of each
block in the program.
○ All braces should start from a new line, and the code following the end of
braces also starts from a new line.
5. Error return values and exception handling conventions:
All functions that encounter an error condition should either return a 0 or 1 for
simplifying the debugging.
On the other hand, Coding guidelines give some general suggestions regarding the
coding style to be followed for the betterment of the understandability and readability of
the code. Some of the coding guidelines are given below:
● Coding guidelines increase the efficiency of the software and reduce the
development time.
● Coding guidelines help detect errors in the early phases, so it helps to reduce the
extra cost incurred by the software project.
● If coding guidelines are maintained properly, then the software code increases
readability and understandability thus, it reduces the complexity of the code.
● It reduces the hidden cost of developing the software.
C)Incremental Code Development
1. Requirement analysis: In the first phase of the incremental model, the product
analysis expertise identifies the requirements. The requirement analysis team
understands the system's functional requirements. This phase plays a crucial role in
developing the software under the incremental model.
2. Design & Development: In this phase of the Incremental model of SDLC, the design of
the system functionality and the development method are finished with success. When
software develops new practicality, the incremental model uses style and development
phase.
3. Testing: In the incremental model, the testing phase checks the performance of each
existing function and additional functionality. In the testing phase, various methods are
used to test the behaviour of each task.
i) Iterative Approach
It deals with Breaking down the development process into smaller iterations or
increments.
ii) Continuous Feedback
It deals with gathering feedback from users and stakeholders throughout the
development lifecycle.
v) Risk Management
Here, the risks are mitigated by addressing high-priority and high-risk features early in
the development process.
User Stories or Features: Break down requirements into manageable user stories or
features that can be implemented incrementally.
Iterations or Sprints: Organizes development into time-boxed iterations or sprints,
typically ranging from one to four weeks.
Continuous Integration and Deployment: Automates the process of integrating and
deploying code changes frequently to ensure stability and reliability.
Feedback Loops: Establish mechanisms for gathering feedback from users and
stakeholders at each increment to inform subsequent iterations.
Incremental Testing Conduct testing activities continuously throughout the
development process to identify and address defects early.
Version Control Systems: Facilitate collaboration and manage code changes across
iterations; they include tools such as git.
Issue Tracking Systems: Track and prioritize user stories, tasks, and defects across
iterations.
Continuous Integration/Deployment Tools: Automate the build, test, and deployment
processes.
Collaboration Platforms: Facilitate communication and collaboration among team
members.
• Use a Unit Test Framework: Employ automated testing frameworks like jest to
streamline the unit testing process and ensure project consistency.
• Assert Once: Each unit test should have only one true or false outcome. Make
sure that there is only one assert statement within your test.
• Implement Unit Testing from the Start: Make unit testing a standard practice
from the beginning of your projects. Even if time constraints initially lead to
skipping unit tests, establishing this practice early on makes it easier to follow
consistently in future projects.
• Automate Unit Testing: Integrate unit testing into your development workflow by
automating tests to run before pushing changes or deploying updates. This
ensures thorough testing throughout the development lifecycle.
• Early Bug Detection: Unit testing helps detect bugs and issues in the codebase
at an early stage of development, reducing the cost and effort required to fix
them later.
•Documentation: Unit tests document how each code unit is expected to behave.
They provide real-world examples of how to use units, making it easier for
developers to understand their functionality.
•Enhanced Collaboration: Unit tests facilitate collaboration among developers by
providing a common understanding of code behaviour and expectations. They
also streamline code reviews and promote communication within the
development team.
• Time-saving: Despite the initial investment in writing unit tests, they ultimately
save time by reducing the time spent on manual testing, debugging, and fixing
defects during later stages of development.
•UI/UX applications: When the main system is concerned with look and feel rather
than logic, there may not be many unit tests to run. In these cases, other types of
testing, such as manual testing, are a better strategy than unit testing.
• Legacy codebases: Writing tests to wrap around existing legacy code can prove
to be near impossible, depending on the style of the written code. Because unit
tests require dummy data, writing unit tests for highly interconnected systems
with much data parsing can also be too time-consuming.
• Rapidly evolving requirements: Depending on the project, the software can grow,
change directions, or have whole parts scrapped altogether in any given work
sprint. If requirements are likely to change often, there's not much reason to write
unit tests each time a block of code is developed.
What's the difference between unit testing and other types of testing?
• Integration testing checks that different parts of the software system designed
to interact do so correctly.
• Functional testing checks whether the software system passes the software
requirements outlined before building.
• Security testing checks the software against known vulnerabilities and threats.
This includes analysis of the threat surface, including third-party entry points to
the software.
Coding metrics
Coding metrics are quantitative measures that aim to assess the quality, complexity,
performance, and other attributes of software code. These metrics provide insights that
can help developers and teams to improve code quality, maintainability, and efficiency.
Several key coding metrics commonly used include:
1). Lines of Code (LOC): Measures a software program's total number of lines. While
easy to calculate, it doesn’t always correlate well with code complexity or quality.
3). Halstead Complexity Measures: These involve several metrics (like Halstead Length,
Volume, Difficulty, and Effort) calculated based on the number of operators and
operands in the code. They aim to measure the potential difficulty in understanding and
maintaining the code.
4). Code Churn: Measures the amount of code changes over time, indicating the
stability and maturity of the codebase. Frequent changes can suggest instability or
continuous improvement.
5) Technical Debt: Technical Debt is not a direct metric but an important concept,
indicating the cost of rework caused by choosing an easy (quick and dirty) solution now
instead of using a better approach that would take longer.
6). Test Coverage: Measures the percentage of code executed by automated tests,
indicating the extent to which the codebase is tested. High test coverage can suggest a
lower likelihood of undetected bugs.
7). Maintainability Index: A composite measure that combines lines of code, cyclomatic
complexity, and Halstead volume to assess how easy it is to maintain the code. Higher
scores indicate easier maintenance.
By tracking these and other relevant metrics, development teams can gain valuable
insights into their codebase, enabling them to make informed decisions about
improvements, optimizations, and refactorings necessary to ensure the delivery of
high-quality software.