Development Cycle Second Iteration


Development Cycle First Iteration

Armed with an understanding of the project requirements, problem domain, language features, and an implementation approach, you are ready to begin development. To complete the project, apply the development cycle iteratively, meaning apply each of the development cycle phases —plan, code, test, and integrate —to a small, selected piece of the overall problem. When you’ve finished that piece of the project, select another piece and repeat the process. The following sections step through the iterative application of the development cycle to the robot rat project.

Plan (First Iteration)

A good way to start each iteration of the development cycle is to list those pieces of the programming problem you are going to solve this time around. The list should have two columns: one that lists each piece of the program design or feature under consideration and one that notes the design decision made regarding that feature. Again, the purpose of the list is to help you maintain a sense of forward momentum. You may find, after you make the list, that you need more study in a particular language feature before proceeding to the coding step. That’s normal. Even seasoned programmers occasionally need to brush-up on unfamiliar or forgotten language features or application programming interfaces (API). (i.e., the Java platform APIs or third-party APIs)

The list of the first pieces of the robot rat project that should be solved based on the previously discussed implementation approach is shown in table 3-6.

Table 3-6: First Iteration Design Considerations

Check-Off

Design Consideration

Design Decision

 

Program structure

One class will contain all the functionality.

 

Creating the Java application class

The class name will be RobotRat. It will contain a “public static void main(String[] args){ }” method.

 

constructor method

Write a class constructor that will print a short message to the screen when a RobotRat object is created.

This is good for now. Although it doesn’t look like much, creating the RobotRat application class and writing a constructor that prints a short text message to the console are huge steps. You can now take this list and move to the code phase.

Code (First Iteration)

Using your development environment create the RobotRat project. Create a Java source file named image from book RobotRat.java and in it create the RobotRat class definition. To this class add the main() method and the RobotRat constructor method. When complete, your image from book RobotRat.java source file should look similar to example 3.1.

Example 3.1: RobotRat.java (1st Iteration)

image from book
 1    public class RobotRat { 2 3      public RobotRat(){ 4        System.out.println("RobotRat lives!"); 5      } 6 7 8      public static void main(String[] args){ 9       RobotRat rr = new RobotRat(); 10     } 11   }
image from book

After you have created the source file you can move to the test phase.

Test (First Iteration)

The test phase of the first iteration involves compiling the image from book RobotRat.java file and running the image from book RobotRat.class file. If the compilation results in errors you must return to the code phase, edit the file to make the necessary correction, and then attempt to compile and test again, repeating the cycle until your are successful. When you have successfully compiled and tested the first iteration of the RobotRat program you can move on to the next step of the development cycle. Figure 3-6 shows the results of running example 3.1.

image from book
Figure 3-6: Compiling & Testing RobotRat Class - First Iteration

Integrate/Test (First Iteration)

There’s not a whole lot to integrate at this point so you are essentially done with the first development cycle iter-ation. Since this version of the robot rat project is contained in one class named RobotRat, any changes you make directly to the source file are immediately integrated. However, for larger projects, you will want to code and test a piece of functionality, usually at the class granularity, before adding the class to the larger project.

You are now ready to move to the second iteration of the development cycle.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net