When I encounter overly long methods, I first identify chunks that are independent of one another and extract them into an own method. Eclipse offers automated support for that, but we still need to think about what we do in order for the result to be what we aspire. ► […]

[LR] Refactoring MovieRental #4 – Extract Methods | Let’s Develop


This is the most code I’ve written for a single CodeHunt task so far. Since there is no way to dynamically change the size of arrays and we cannot use the collections from the standard library, we’ve got to come up with our own version of arrayCopy. Still: full skill […]

[LD] Code Hunt #35 – Search Sort – 12.05 [blind] ...


Counting occurrences and computing the index of elements in arrays. Rather simple tasks to get started with the Search Sort sector. ► All CodeHunt Episodes: http://goo.gl/WtTJ3L ► Let’s Develop! http://letsdeveloper.com ► Don’t Miss an Episode: http://goo.gl/whzDi1 «CodeHunt» An educational coding game from Microsoft Research. https://codehunt.com «Other Series» ► Let’s Develop […]

[LD] Code Hunt #34 – Search Sort – 12.01 to ...



To refactor safely, we want to get test coverage up. Our ideal is always 100%, but remember that this doesn’t guarantee a good test suite. Use the coverage as a guide to missing test cases, but don’t forget to think about cases that might not be revealed by coverage! ► […]

[LR] Refactoring MovieRental #3 – A Covering Test Suite 2 ...


This is a tough one. Took me a while to wrap my head around the concept. Stumbled across the solution more by chance than by systematic search, but I got it right, in the end 😉 ► All CodeHunt Episodes: http://goo.gl/WtTJ3L ► Let’s Develop! http://letsdeveloper.com ► Don’t Miss an Episode: […]

[LD] Code Hunt #37 – Search Sort – 12.08 [blind] ...


Implementing value-replacement and some i’m-not-sure-what-purpose computation on arrays. The biggest challenge remains the allocation of arrays with previously unknown size, but we know the pattern from before. Again, the solution are quite long for CodeHunt. ► All CodeHunt Episodes: http://goo.gl/WtTJ3L ► Let’s Develop! http://letsdeveloper.com ► Don’t Miss an Episode: http://goo.gl/whzDi1 […]

[LD] Code Hunt #36 – Search Sort – 12.06 to ...



A good test suite is essential for safe refactoring. It is the only way to ensure that your modifications don’t break your code. Therefore, I start my refactoring by writing a test suite for Martin Fowler’s example program. I use EclEmma to check the coverage of the tests and to […]

[LR] Refactoring MovieRental #2 – A Covering Test Suite 1 ...


Refactoring is nothing to be afraid of. Know your tools and be rigorous about it and you will succeed. I chose the first example of Martin Fowler’s book “Refactoring” to demonstrate refactoring techniques in general and the respective tools available in Eclipse. In this episode, I discuss the target program […]

[LR] Refactoring MovieRental #1 – Problem Statement | Let’s Develop


How to check deep equality of arrays in Java? Got me confused, this one. But it helps to focus on the most simple tools we have available: Checking array length and concrete indexes. Finally got me through this one *sight*. ► All CodeHunt Episodes: http://goo.gl/WtTJ3L ► Let’s Develop! http://letsdeveloper.com ► […]

[LD] Code Hunt #31 – Arrays 2 – 11.03 [blind] ...