Implementing by using Stubs

Software engineers typically implement their projects by using stubs.

In the context of the software development process that we are using, that means:

  • You are ready to implement a stage of your iterative enhancement plan

  • You have a UML class diagram for that stage

  • You implement the:
    • Class definition clauses (extends, implements)
    • Public members (fields, constructors, and methods)
    • Javadoc specifications

    required by your class diagram for the given stage of your iterative enhancement plan,

    BUT:

    • You use empty bodies for the constructors and void methods
    • You use trivial bodies for the non-void methods
      • For example, return 99 for a method that returns an int
      • For example, return null for a method that returns an object

Using stubs has several advantages:

  1. It lets you focus on what methods you need, not how to implement them
  2. It lets you focus on what those methods should accomplish, not how to implement them
    • You accomplish this by writing the Javadoc as part of the stub
  3. It lets you get a substage that compiles successfully before turning to implementation
  4. It helps enforce specification (design) before implementation (coding)