2081 12

BIT302 ยท 2081 ยท 5 marks

Write short notes on: a) open-source development b) Test driven development

Write short notes on: a) open-source development b) Test driven development [5]

Software EngineeringChapter 6: Software TestingTest-driven development approach

Quick answer

Open-source development is a software development model where the source code is made publicly available for anyone to view, use, modify, and distribute. It follows a collaborative, community-driven approach.

Short Notes

a) Open-Source Development

Key Characteristics:

  • Public Repository: Source code is hosted on platforms like GitHub, GitLab, or SourceForge, accessible to everyone.
  • Community Collaboration: Developers worldwide contribute bug fixes, new features, and improvements through pull requests and patches.
  • Transparency: All changes, discussions, and decisions are visible to the public.
  • Licensing: Governed by licenses such as GNU GPL, MIT, or Apache, which define terms of use and redistribution.
  • Peer Review: Code is reviewed by multiple contributors, improving quality and security.

Examples:

Linux, Apache, Mozilla Firefox, Python.

Advantages:

  • Reduces development cost
  • Faster bug detection and fixing
  • Encourages innovation and reuse

Disadvantages:

  • Lack of formal support
  • Inconsistent documentation
  • Security risks if code is misused

b) Test-Driven Development (TDD)

Test-Driven Development (TDD) is a software development practice where tests are written before the actual code. It follows a short, repetitive development cycle.

The TDD Cycle (Red-Green-Refactor):

StepDescription
RedWrite a test that fails (since code does not exist yet)
GreenWrite the minimum code necessary to pass the test
RefactorClean and improve the code without changing its behavior

Key Principles:

  • No production code is written unless there is a failing test to justify it.
  • Tests act as living documentation of the system.
  • Encourages simple, modular, and loosely coupled design.

Process Flow:

Write Failing Test --> Write Code to Pass Test --> Refactor --> Repeat

Advantages:

  • Early detection of defects
  • Improved code quality and design
  • Provides a safety net for future changes (regression testing)
  • Better requirement understanding before coding

Disadvantages:

  • Requires discipline and practice
  • Initial development may be slower
  • Difficult to apply for complex UI or legacy systems

Example:

Before writing a function add(a, b), a developer first writes:

assert add(2, 3) == 5   # Test written first

Then implements the function to make the test pass.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.