##TDD
TDD
A TDD strategy starts with the tests, and I don't see much evidence that the tests came first, in your code (not saying that it didn't come first, but that the evidence is absent).
A good TDD strategy will identify the anticipated issues early, and I don't see these cases:
@Test
public void testMAX() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MAX_VALUE));
}
@Test
public void testMIN() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MIN_VALUE));
}
@Test
public void testNeg1() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(-1));
}
@Test
public void testZero() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(0));
}
@Test
public void testOne() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(1));
}
@Test
public void testLarge() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(2147447412));
}
There, there are some tests, that should all pass..., now you go, and code it to work to fit the tests.
##Review
Review
Other reviews have covered a bunch of things already.
I will only say that there are about 1000 palindrome numbers that are possible.... the largest 3-digit product would be 999 * 999 giving 998001, and the smallest is 100 * 100 giving 10000, I would consider an algorithm which counts down from 999 making the mirrored palindrome sequence 999999 998899 997799, etc, and then finding the first one that has two 3-digit factor pairs....
##TDD
A TDD strategy starts with the tests, and I don't see much evidence that the tests came first, in your code (not saying that it didn't come first, but that the evidence is absent).
A good TDD strategy will identify the anticipated issues early, and I don't see these cases:
@Test
public void testMAX() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MAX_VALUE));
}
@Test
public void testMIN() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MIN_VALUE));
}
@Test
public void testNeg1() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(-1));
}
@Test
public void testZero() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(0));
}
@Test
public void testOne() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(1));
}
@Test
public void testLarge() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(2147447412));
}
There, there are some tests, that should all pass..., now you go, and code it to work to fit the tests.
##Review
Other reviews have covered a bunch of things already.
I will only say that there are about 1000 palindrome numbers that are possible.... the largest 3-digit product would be 999 * 999 giving 998001, and the smallest is 100 * 100 giving 10000, I would consider an algorithm which counts down from 999 making the mirrored palindrome sequence 999999 998899 997799, etc, and then finding the first one that has two 3-digit factor pairs....
TDD
A TDD strategy starts with the tests, and I don't see much evidence that the tests came first, in your code (not saying that it didn't come first, but that the evidence is absent).
A good TDD strategy will identify the anticipated issues early, and I don't see these cases:
@Test
public void testMAX() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MAX_VALUE));
}
@Test
public void testMIN() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MIN_VALUE));
}
@Test
public void testNeg1() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(-1));
}
@Test
public void testZero() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(0));
}
@Test
public void testOne() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(1));
}
@Test
public void testLarge() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(2147447412));
}
There, there are some tests, that should all pass..., now you go, and code it to work to fit the tests.
Review
Other reviews have covered a bunch of things already.
I will only say that there are about 1000 palindrome numbers that are possible.... the largest 3-digit product would be 999 * 999 giving 998001, and the smallest is 100 * 100 giving 10000, I would consider an algorithm which counts down from 999 making the mirrored palindrome sequence 999999 998899 997799, etc, and then finding the first one that has two 3-digit factor pairs....
##TDD
A TDD strategy starts with the tests, and I don't see much evidence that the tests came first, in your code (not saying that it didn't come first, but that the evidence is absent).
A good TDD strategy will identify the anticipated issues early, and I don't see these cases:
@Test
public void testMAX() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MAX_VALUE));
}
@Test
public void testMIN() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(Integer.MIN_VALUE));
}
@Test
public void testNeg1() {
PalindromeChecker checker = new PalindromeChecker();
assertFalse(checker.isPalindrome(-1));
}
@Test
public void testZero() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(0));
}
@Test
public void testOne() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(1));
}
@Test
public void testLarge() {
PalindromeChecker checker = new PalindromeChecker();
assertTrue(checker.isPalindrome(2147447412));
}
There, there are some tests, that should all pass..., now you go, and code it to work to fit the tests.
##Review
Other reviews have covered a bunch of things already.
I will only say that there are about 1000 palindrome numbers that are possible.... the largest 3-digit product would be 999 * 999 giving 998001, and the smallest is 100 * 100 giving 10000, I would consider an algorithm which counts down from 999 making the mirrored palindrome sequence 999999 998899 997799, etc, and then finding the first one that has two 3-digit factor pairs....