Cir206 Group 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

A)Code inspection

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.

How code inspection works

● 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.

Advantages of code inspection

● Improves overall product quality.


● Discovers the bugs/defects in software code.
● Marks any process enhancement in any case.
● Finds and removes defective efficiently and quickly.
● Helps to learn from previous defeats.

Disadvantages of Code Inspection

● Requires extra time and planning


● The process is a little bit slower
B)Coding Standards and Guidelines

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.

Good software development organizations want their programmers to maintain to some


well-defined and standard style of coding called coding standards. They usually make
their own coding standards and guidelines depending on what suits their organization
best and based on the types of software they develop. It is very important for the
programmers to maintain the coding standards. Otherwise, the code will be rejected
during code review.

Purpose of Having Coding Standards:

● A coding standard gives a uniform appearance to the codes written by different


engineers.
● It improves the readability and maintainability of the code and reduces
complexity.
● It helps with code reuse and detects errors easily.
● It promotes sound programming practices and increases the efficiency of the
programmers.

Some of the coding standards are given below:

1. Limited use of globals:


These rules tell which types of data can be declared global and which data can’t
be.
2. Standard headers for different modules:
For better understanding and maintenance of the code, the header of different
modules should follow some standard format and information. The header
format must contain the things that is being used in various companies:
○ Name of the module
○ Date of module creation
○ Author of the module
○ Modification History
○ Synopsis of the module about what the module does
○ Different functions supported in the module, along with their input-output
parameters
○ Global variables accessed or modified by the module

3. Naming conventions for local variables, global variables, constants and


functions:
Some of the naming conventions are given below:
○ Meaningful and understandable variables help anyone understand the
reason for using them.
○ Local variables should be named using camel case lettering starting with
a small letter (e.g. local data), whereas Global variables names should
start with a capital letter (e.g. GlobalData). Constant names should be
formed using capital letters only (e.g. CONSDATA).
○ It is better to avoid the use of digits in variable names.
○ The names of the functions should be written in camel case, starting with
small letters.
○ The name of the function must describe the reason for using the function
clearly and briefly.

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:

6. Avoid using a coding style that is too difficult to understand:


The code should be easily understandable. The complex code makes
maintenance and debugging difficult and expensive.
7. Avoid using an identifier for multiple purposes:
Each variable should be given a descriptive and meaningful name indicating the
reason behind using it. This is not possible if an identifier is used for multiple
purposes, and thus, it can lead to confusion to the reader. Moreover, it leads to
more difficulty during future enhancements.
8. Code should be well documented:
The code should be properly commented on for easy understanding easily.
Comments regarding the statements increase the understandability of the code.
9. The length of functions should not be very large:
Lengthy functions are very difficult to understand. That’s why functions should
be small enough to carry out small work, and lengthy functions should be broken
into small ones for completing small tasks.
10. Try not to use the GOTO statement:
The GOTO statement makes the program unstructured. Thus, it reduces the
program's understandability, and debugging becomes difficult.

Advantages of Coding Guidelines:

● 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

Incremental code development is a software development approach that emphasizes


building and improving software systems gradually over time through iterative cycles of
planning, development, testing, and deployment. This methodology stands in contrast to
traditional "big bang" development approaches, where entire systems are developed and
deployed at once.

Various phases in 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.

4. Implementation: The implementation phase enables the coding phase of the


development system. It involves the final coding that is designed in the designing and
development phase and tests the functionality in the testing phase. After completion of
this phase, the number of products working is enhanced and upgraded to the final
system product.

1. Principles of Incremental Code Development

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.

iii) Evolutionary Design


This is where the software Design and implementation is done incrementally, allowing
for flexibility and adaptation to changing requirements.

iv) Early and Regular Delivery:


Aim to deliver usable increments of functionality early and frequently to stakeholders.

v) Risk Management
Here, the risks are mitigated by addressing high-priority and high-risk features early in
the development process.

2. Benefits of Incremental Code Development

a) Faster Time to Market - Delivering usable functionality in smaller increments


allows for quicker deployment and feedback gathering.
b) Adaptability - Flexibility to accommodate changing requirements and priorities
throughout the development process.
c) Reduced Risk - Early detection and mitigation of defects and issues through
continuous testing and validation.
d) Improved Stakeholder Satisfaction - Regular delivery of functional increments
fosters stakeholder engagement and satisfaction.
e) Enhanced Quality - Incremental development encourages continuous
improvement and refinement of code and design.

3. Key Components of Incremental Code Development:

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.

4. Challenges in Incremental Code Development

a) Scope Creep - Difficulty in managing evolving requirements and scope changes


over multiple iterations.
b) Integration Complexity - Ensuring seamless integration of new increments with
existing codebase and dependencies.
c) Dependency Management- There is a challenge in Coordinating dependencies
between different increments and teams.
d) Technical Debt - Risk of accumulating technical debt if proper refactoring and
maintenance practices are not followed.
e) Resource Allocation - Balancing resources and priorities across multiple
increments and projects is usually difficult..

5. Best Practices for Incremental Code Development:

a) Prioritize Features - Focus on implementing high-priority and high-value features


early in development.
b) Modular Design: Design software systems with modularity in mind to facilitate
incremental development and maintainability.
c) Automated Testing: Invest in automated testing frameworks to ensure the quality
and stability of incremental releases.
d) Continuous Integration/Deployment: Implement CI/CD pipelines to automate
code changes' integration, testing, and deployment.
e) Collaboration and Communication: Foster collaboration and communication
among team members and stakeholders to ensure alignment and transparency.

6. Tools and Technologies for Incremental Code Development

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.

7. Continuous Improvement and Evolution

Retrospectives: Conduct regular retrospectives at the end of each iteration to reflect on


what went well, what didn't, and areas for improvement.
Feedback Analysis: Analyze user and stakeholder feedback to identify enhancements
and refinements opportunities.
Refactoring and Technical Debt Management: This involves Allocating time for
refactoring and addressing technical debt to maintain code quality and scalability.
Knowledge Sharing: Encourages knowledge sharing and learning within the team to
improve development practices and skills continuously.

In conclusion, Incremental code development offers a pragmatic and flexible approach


to software development, allowing teams to deliver value incrementally while managing
risks and uncertainties effectively. By embracing the principles, best practices, and tools
associated with incremental development, organizations can adapt to changing
requirements, deliver high-quality software, and maintain a competitive edge in today's
dynamic market landscape.

Management of code evolution.


Managing code evolution involves tracking changes to source code, maintaining a clear
history of modifications, and effectively handling the merging of code from different
sources. This process is essential for ensuring software projects' stability, scalability,
and maintainability over time.it is a crucial aspect of software development to ensure
that the codebase remains maintainable, scalable, and efficient over time. Here are
some key practices and strategies for effectively managing code evolution.
1. Version Control System (VCS):
a. Use a version control system such as Git to track changes to your codebase.
b. Create branches for new features or bug fixes to isolate changes and prevent
interference with the main codebase.
c. Regularly commit changes with descriptive commit messages to maintain a clear
history of modifications.
2. Code Reviews:
a. Implement code review processes where team members review each other's
code before merging it into the main branch.
b. Conduct thorough reviews to ensure code quality, adhere to coding standards,
and identify potential issues.
3. Automated Testing:
a. Develop and maintain a comprehensive suite of automated tests, including unit,
integration, and end-to-end tests.
b. Run automated tests regularly, especially before merging code changes, to catch
bugs and regressions early.
4. Continuous Integration/Continuous Deployment (CI/CD):
a. Set up CI/CD pipelines to automate build, test, and deployment processes.
b. Use tools like Jenkins, GitLab CI/CD, or GitHub Actions to streamline
development workflows and ensure consistent code delivery.
5. Refactoring and Code Cleanup:
a. Regularly refactor code to improve its structure, readability, and maintainability.
b. Remove obsolete code, fix code smells, and apply best practices to keep the
codebase clean and efficient.
6. Documentation:
a. Maintain comprehensive documentation for your codebase, including API
documentation, architecture diagrams, and coding guidelines.
b. Document code changes, dependencies, and configuration settings to facilitate
understanding and collaboration.
7. Versioning and Release Management:
a. Follow semantic versioning principles to assign meaningful version numbers to
releases based on the significance of changes (e.g., major, minor, patch).
b. Planned and coordinated releases to ensure smooth deployment and minimized
disruptions for users.
8. Monitoring and Feedback:
a. Monitor application performance, error logs, and user feedback to identify areas
for improvement and prioritize future development efforts.
b. Use metrics and analytics to assess the impact of code changes and make
data-driven decisions.
Unit Testing

• Unit testing is a software testing method where individual units or components


of a software application are tested in isolation to ensure they function correctly.

• A unit is typically the smallest testable part of an application, such as a


function, method, or class.

What are unit testing best practices?

• 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.

What are the benefits of Unit Testing?

• 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.

• Code Quality Improvement: By writing unit tests, developers are encouraged to


write cleaner, modular, and more maintainable code, resulting in higher overall
code quality.

•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.

When is Unit Testing less beneficial?

•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.

• Performance testing checks whether the software meets expected


performance requirements like speed and memory size.

• Acceptance testing is when stakeholders or user groups test the software


manually to check whether it works as they anticipate.

• 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.

2). Cyclomatic Complexity: Measures the complexity of a program by calculating the


number of linearly independent paths through a program's source code. It helps identify
overly complex methods that may need simplification or refactoring.

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.

8). Dependency Measures: Assess the degree of interdependence between modules or


components. High dependency can make the code more complex and harder to
maintain.
9). Code Duplication: Measures the amount of code duplicated across the codebase.
Reducing duplication can improve maintainability and reduce the likelihood of bugs.

10). Function Points: A measure of the functionality provided by the software,


independent of the language used to implement it. It’s useful for comparing productivity
and efficiency across different projects or languages.

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.

You might also like