Codemotion Rome 2016 is really close!
Mobile and testing are two common topics at conferences, but it’s very rare to find them in the same presentation. We are happy to have Matteo Vaccari to present “TDD and mobile development: some forgotten techniques, illustrated with Android” at Codemotion Rome. Matteo is a well know italian speaker and professional, he started his career in academia in formal methods, then he worked as a developer and gradually morphed into an agile coach. He practices and teaches Extreme Programming and other agile methods, he is particularly keen on the more technical side of XP, such as TDD.
Hi Matteo, could you give us a quick introduction about your talk?
I once was asked by a customer to train in TDD their Android developers. I said “but I don’t know anything about Android!” However, the customer insisted and so I realized that there are some basic, fundamental things about TDD and software design that those Android developers were not aware of. These things are not specific to Android; they apply to all GUI-heavy programming. I later started studying some Android, and I learned more about how to do TDD specifically on Android. So this talk is about both: fundamental things about GUI programming delivered through concrete Android examples.
In the last decade TDD is an evergreen topic at conferences, what’s your opinion about nowadays TDD adoption?
I think there’s a disconnect between what is talked about at conferences and actual practice. It’s really rare to see TDD actually practiced at work. There are some substitutes for TDD that really aren’t, such as writing the tests after the fact, or doing all the tests through the UI. Whenever there is a problem, I see developers reaching for the debugger. I rarely see them start solving the problem by writing a test. I see TDD being used in practice by only a tiny minority of programmers.
Nowadays it seems that writing tests has become a common practice on the backend side but not on the client-side/mobile, what are the reasons behind that?
I think it’s mainly because testing the UI is difficult to do well. I also would like to point out that just because you are “writing tests” it does not necessarily mean you are doing TDD.
What about having your application covered by tests, but without a full TDD approach?
I’ve seen that. If it works for you, then great! Actually, I suspect that it does /not/ work too well: when I write the test /after/ writing the production code, it means I wrote my production code without the benefit of the feedback from the tests. I wrote down the design I had in your head at the beginning. TDD is more like working with an open mind and letting the code be what it wants to be. When I do TDD, I often find a bit of surprise at the actual result. It usually is simpler than what I imagined at the beginning.
On the other hand, there times when TDD is not the appropriate tool. When you are developing a UI screen, it pays to be able to tweak the code, reload the screen and immediately see the change in action. You replace the feedback from the test with a visual feedback. It generally works well, as long as you are very disciplined in making sure that all the logic is outside the UI. Spikes also work well without tests.
Are there any big differences/difficulties practicing TDD in mobile development?
Watch out whenever you feel TDD is difficult because the framework/tools/libraries do not support you well. It is usually a sign that you are coupling your code too tightly to non-functional details.
Any particular book you would suggest related to TDD?
I suggest you read the original book by Kent Beck, and then watch the video courses by J.B. Rainsberger and/or James Shore. There are a lot of nuances in TDD that you don’t get out of a book. I think it’s important to study software design too.
Who is/are your tech heroes?
Linus Torvalds wrote the second-most-important program in the world. Richard Stallman wrote the most important program in the world: gcc, without which Linux would not exist. Kent Beck goes without saying, for all the learning and inspiration. Edsger Dijkstra, for structured programming and the mathematics of programming. Tom Gilb is not really a programmer, but he is definitely a master of true engineering.
Totally random: What’s your favorite OST?
[googles quickly, then comes back to the interview with a puzzled look] Perhaps you mean Original Sound Track? Or maybe Original Star Trek? Today I heard of the sad news about Keith Emerson. He’s been one of my music heroes for decades. The sound track of 14-years-old me was the second album by ELP: Tarkus! That’s classical music, man.
Ehehe, good catch, I meant Original Sound Track Thanks a lot for the interview Matteo, see you on stage this Friday!
Back to news list