Long functions in even longer classes can often be found in mature code bases. Even though every programmer knows it's wrong to keep such a beast in production, every one of us has been feeding one of those for at least some time.
In this lecture, we will show the process of building large functions from scratch. We will then turn attention to one such function, which has about 1000 lines of code. You will see why we need to break such monstrous functions into smaller chunks and then we will embark on a voyage to refactor and redesign it into smaller chunks of code.
If you have passion for Sudoku, then the example we present will surely amuse you. The program we will be dealing with is setting up Sudoku problems and then it solves each problem, verbalizing all decisions and explaining the solution in common English sentences. But, the way in which this interesting program does its task is, at the same time, the greatest impediment to its further development. That is the point at which this lecture begins.
Before attending this talk, you may wish to try fixing the same code on your own. Please download the initial solution from GitHub repository: https://github.com/zoran-horvat/sudoku-kata