Incremental Coding - PowerPoint PPT Presentation

About This Presentation
Title:

Incremental Coding

Description:

Helps testing tremendously! So what is it? It is a methodology for writing your program ... The top down approach begins with the general and works towards the ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 25
Provided by: mccl8
Category:

less

Transcript and Presenter's Notes

Title: Incremental Coding


1
Incremental Coding
  • Incremental coding is good!
  • Uses divide and conquer to minimize problem scope
  • Helps testing tremendously!
  • So what is it?
  • It is a methodology for writing your program
  • Two types
  • Top down
  • Bottom up

2
Incremental Coding Top Down
  • The top down approach begins with the general and
    works towards the specifics
  • Start with a skeleton class
  • Add small details a little at a time
  • Test after each addition!

3
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
4
Incremental Coding
  • /
  • Title Example.java
  • Files Example.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example

//end of Example class
5
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2

//end of Example
class
6
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • // code will go here

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) //
code will go here // this is the main
method public static void main(String
args) // code will go here //end
of Example class
7
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • // code will go here

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) //
code will go here // this is the main
method public static void main(String
args) // code will go here //end
of Example class
8
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) //
code will go here // this is the main
method public static void main(String
args) // code will go here //end
of Example class
9
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) // code
will go here //end of Example
class
10
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
11
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
12
Incremental Coding Bottom up
  • The Bottom up approach begins with specific
    details slowly combines them into the program
  • Start with a skeleton class
  • Code individual functional parts of the program
  • Slowly combine functional parts
  • Test after each combination!

13
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example

//end of Example
class
14
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) //end of Example
class
15
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) //end of Example
class
16
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) //end of Example
class
17
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) int x e1.getData1()
//end of Example class
18
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) int x e1.getData1()
//end of Example class
19
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 //end of Example class
20
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1()
//end of Example class
21
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is the main method public static
void main(String args) Example e1 new
Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
22
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
23
Incremental Coding
  • /
  • Title Card.java
  • Files Card.java
  • Author Peter McClone
  • CS Login mc-clone

  • /
  • // no import statements
  • public class Example
  • // these are instance variables
  • private int data1
  • public int data2
  • // this is the constructor
  • public Example(int first, int second)
  • data1 first
  • data2 second

// this is another instance method // this
method computes a fraction of data1 public
double getDataFraction(double fraction) double
result result fraction data1 return
result // this is the main method public
static void main(String args) Example e1
new Example(1,2) Example e2 new
Example(3,4) int x e1.getData1() int y
e2.data2 int z e1.data2 e2.getData1() d
ouble f e2.getDataFraction(0.4) //end
of Example class
24
Incremental Coding
  • Questions????
Write a Comment
User Comments (0)
About PowerShow.com