public class TestGame extends TestCase {
public void testOneThrow() {
Game g = new Game();
g.addThrow(5);
assertEquals(5, g.getScore());
}
}
public class Game {
public void addThrow(int pins) {
}
public int getScore() {
return 0;
}
}
public class Game {
public void addThrow(int pins) {
}
public int getScore() {
return 5;
}
}
Game
class will always say that the score of the game is 5.public class TestGame extends TestCase {
public void testOneThrow() {
Game g = new Game();
g.addThrow(5);
assertEquals(5, g.getScore());
}
public void testTwoThrows() {
Game g = new Game();
g.addThrow(5);
g.addThrow(4);
assertEquals(9, g.getScore());
}
}
public class Game {
private int score = 0;
public void addThrow(int pins) {
score = score + pins;
}
public int getScore() {
return score;
}
}
public class TestGame extends TestCase {
public void testOneThrow() {
Game g = new Game();
g.addThrow(5);
assertEquals(5, g.getScore());
}
public void testTwoThrows() {
Game g = new Game();
g.addThrow(5);
g.addThrow(4);
assertEquals(9, g.getScore());
}
public void testSpare() {
Game g = new Game();
g.addThrow(5);
g.addThrow(5);
g.addThrow(3);
g.addThrow(1);
assertEquals(17, g.getScore()); // note: current implementation will produce 14, not 17
}
}
There is no single development, in either technology or management technique, which by itself promises even one order-of- magnitude improvement within a decade in productivity, in reliability, in simplicity.
— Fred Brooks, 1986
i.e. There is no magical cure for the “software crisis”
Problems resulting from complexity | ||
---|---|---|
difficult team communication | product flaws | cost overruns |
schedule delays | personnel turnover (loss of knowledge) |
unenumerated states (lots of them) |
lack of extensibility (complexity of structure) |
unanticipated states (security loopholes) |
project overview is difficult (impedes conceptual integrity) |
make a markon the company and changes the business process
High-level languages | Time-Sharing | Programming Environments |
OO Analysis, Design, Programming | AI and expert systems | “automatic” programming |
He argued that several techniques in tandem could achieve that goal but that requires industry-wide enforcement and discipline
Brooks states:
We will surely make substantial progress over the next 40 years; an order of magnitude over 40 years is hardly magical…