Advanced Programming I Lecture Notes

13 April 2006 • Assignment 5 Code Review


Outline

Assignment 4 Review.

Assignment 4 Review..

The Problem

The Solution

Design Steps

Exploratory Design

The Complete Graph

The Concept Graph

Data Collection

Finding Neighbors

An Observation

An Improvement

Another Observation

Test Cases

Test Results

Coding Notes

Duplicate Code

~MyLinkedList( )
Node* temp
while head != NULL
  temp = head
  head = head->next
  delete temp
make_empty()
Node* temp
while head != NULL
  temp = head
  head = head->next
  delete temp
position = 0
size = 0

Procedural Abstraction

~MyLinkedList( )
  free_nodes()

make_empty( )
  free_nodes()
  position = 0
  size = 0
free_nodes()
  Node* temp
  while head != NULL
    temp = head
    head = head->next
    delete temp

Duplicate Code

Use Templates

Program Defensively

The STL

Don't Bet With Your Grade

The Rule of Three

Sadly, No

Verify Assumptions


This page last modified on 24 April 2006.

This work is covered by a
Creative Commons License.