Category Archives: Presentations

Code Snippets are for Sissies

Ok, the title is a bit harsh… ;-)… If you use code snippets in your presentation, it’s OK. This post is about some cons (and pros) for code snippets, or cut and paste prepared code in the middle of a presentation. I want to explain why I don’t use them in any of my talks.

Sometimes, you should explain something complex. In software programming, ideas and code are kind. I usually show a simple diagram to communicate the architecture or key points of a pattern, implementation, technology, etc. If the diagram is too complicate, I recommend to split them. You are in the middle of a presentation and your audience have no time to digest a complex diagram.

If the topic involves programming (i.e., explain ASP.NET MVC 3 or the use of Spring Framework in Java), I employ two complementary approaches:

– Have a demo application, to run at the start of the talk (to capture audience interest, set expectations about what we explore, etc…), dissect each topic with simple examples (one for authentication, one for REST service, etc…),  then show the initial complete application code, that it should be more clear at the end of the talk.

– Write code in the middle of the example, avoiding code snippets/cut and paste

Why the second point? Why not cut and paste? You must write code in order to MAKE A CONNECTION WITH YOUR AUDIENCE.

When you write code, each developer in the audience plays with you: he/she can feel the tensions (error typo, a missing semicolon), can feel the type dot and anticipates the “Intellisense” of your IDE, or feel the ESC sequence in Vim. They can enjoy at short distance, sharing your efforts to write something in the middle of the talk.

Coding in the middle of the presentation, is like playing jazz: your audience participates of the music, “play” at the same time with you, trying to guess your next note (code), having satisfaction if their guess is right, or enjoying the unanticipated jump. That’s the key of jam sessions: no random notes (the audience can’t play with you), but something is new. Another example: a Bach fugue. And that’s the key of simple coding: all are coders with you.

Ok, it sounds a bit exaggerated compare code with music 😉 But I use the analogy to make my point: feel free to code in the middle of the talk. Cut and paste is ice.

What are the pros of cut and paste/code snippets? Sure, they are facilitators for the presenter. That’s the (only?) pro. If the code is too large, then the cut and paste only facilitates the presenter job, but it won’t enlighten the audience. Then, I usually switch to prepared examples, after some short coding for simpler ones. If you are lost in the middle of the coding, you can laugh, sharing the experience with the audience, and revert to the prepared example 😉

This next video is an example of “no cut and paste, here” presentation. Ryan Dahl,  NodeJs  ninja, explaining his baby to a PHP audience:

Today, I will give a talk about the same topic, I have only few minutes dedicated to NodeJs. But I will try to share with the audience the “look ma… I’m coding” experience 😉

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez