Testable Code: Rockstar Edition
Saying "yes" is my default response when a friend asks for my support. But when my friend Carola Köhntopp asked me a while ago to participate in a presentation about presenting (meta alert!) at this year's PHP @ FrOSCon I committed myself to help without knowing what I would be getting myself into.
The title of Carola's presentation, "PHPopstars", was a play of words on the reality television franchise Popstars. The idea was that there were five "finalists" (Kore Nordmann, Tobias Schlitt, Judith Andresen, Kristian Köhntopp, and myself) in a competition of "PHP Speakers". Carola had asked the five of us to each prepare a 4-minute-long presentation that we were to present as part of the PHPopstars event.
My presentation was titled "Testable Code: Rockstar Edition" and here are the slides:
I am not a pop star. I do not listen to pop music. According to Lorna Jane I am a rock star. I would not describe myself as such but two years ago I came very close to feeling like a rock star when I toured the United States together with Arne and Stefan. Over the course of 14 days we presented workshops at conferences in 7 cities.
About the time when Carola had asked me about participating in PHPopstars the soundtrack for Portal 2 was released. It is titled "Songs to Test By".
This title started a chain of associations that I just had to follow. And down the rabbit hole I went.
You know where you are? You're in the jungle, baby.
You're gonna die!
Just an urchin livin' under the street
I'm a hard case that's tough to beat
I'm your charity case, so buy me something to eat
I'll pay you at another time, take it to the end of the line
Take me down to the paradise city
Where the tests are green
And the code is pretty
Take me home
Such a chain of associations is not always expedient. The one I just described is only useful when your goal is to fill a 4-minute sub-presentation in someone else's presentation.
Eleven years ago, when I presented for the first time at a conference (and at the world's first PHP conference, no less), my presentation style was drastically different from the way I present today.
Nowadays I try to find a pictorial language to reach the audience not only on the technical level (using the spoken word and with code on the slides) but also on the emotional level.
Take the above picture of a green field as an example. It resonates well with developers as they (generally) prefer development without the restrictions that legacy code impose.
The books by Nancy Duarte, "slide:ology" and "resonate", are excellent resources that help with getting a fresh perspective on presenting. However, as a technical presenter that mostly talks about code, these books are not as useful as I hope "Presentation Patterns" will be.
Avoid the hell that is global state!
Do not depend on global variables!
Do not use singletons!
Follow the Separation of Concerns design principle!
Use loosely coupled objects!
Design Patterns can help!
A good architecture leads to clean code that is easy to test as well as cheap to maintain.