Software Development (CSC 321 2016S) : Outlines

Outline 13: Test-Driven Development


Held: ,

Back to Outline 12 - Pause for Breath. On to Outline 14 - Codes of Ethics.

Summary

We consider issues in writing correct code, particularly test-driven development and ways to identify code that is likely to have errors.

Related Pages

Overview

Administrivia

Upcoming Work

Good Things to Do

Academic

Peer

Refresher: Incorrect code

What does this program try to do?

class TimeSetter
  def self.convert(d)
    y = 1980
    while (d > 365) do
      if ((y % 400 == 0) || (y % 4 == 0) && (y % 100 != 0))
        if (d > 366)
          d -= 366
          y += 1
        end
      else
        d -= 365
        y += 1
      end
    end
  end
end

What is wrong with this program?

How would we find it?

How would we fix it?

Loop invariants

Code smells

Unit testing

Code Coverage