Incremental development

Code stubs

  • Sometimes good programming is like in drawing: leave specific details to the end!

  • You can mark what should be done later with code stubs:

As comments

def divide_numbers(a, b):
    # FIXME: Handle division by zero
    return a / b

# Example usage
result = divide_numbers(10, 0)
print(result)
  • Later, you can search for the word “FIXME” in your code and start to “polish” these parts.

As output messages

def steps_to_calories(steps):
    print('FIXME: finish steps_to_calories')
    return -1

With the “pass” keyword

class Person():
  pass
  # FIXME implement constructor later
  
def ride_bike():
  pass

With exceptions

def get_points(num_points):
    """Get num_points from the user. Return a list of (x,y) tuples."""
    raise NotImplementedError