# Thursday, April 21, 2011

I do a lot of technical presentations and those presentations often contain code demos. As a general rule, I favor creating my code demos in advance over typing them in during my presentation. If a demo involves more than a few seconds typing, no one wants to sit and watch the presenter type (or, worse, debug code that he mistyped).

Often I'll have a number of related demos in the same project or the same class. Each demo will be a little more complex or show off a slightly different feature than the prior demo.

In the past, I've added code and commented it out, then commented / uncommented during  the presentation. Here is a sample of this technique.

Unfortunately, this method is error-prone. It’s too easy to accidentally uncomment or comment the wrong line or too many lines, causing errors that you will need to debug quickly and with the pressure of an audience staring at you.

But I've found a different simple technique that works very well for Console application demos. I prompt the user to enter a number - then capture the user's input and run the method corresponding with that number. The Console.ReadLine method allows me to capture the user's input and a switch statement allows me to easily translate a number entered into the appropriate method call. A few Console.WriteLine statements clarify what the numbers mean. Below is an example.

This technique allows you to prepare all of your demos in advance, so you don’t need to change anything during your presentation. I like the fact that the technique does not excessively complicate the code you are presenting. Simply focus on the code in one individual case statement at a time.

Sunday, May 1, 2011 5:11:01 AM (GMT Daylight Time, UTC+01:00)
Hi Dave. Just checking your blog after you share your business card with me today. One comment here is: I actually use library assembly not console project. The trick is that i add unit test framework and I share all the code to a some basic framework where I can execute each individual test at the time of each slide. I use tool called testdriven and i just right click on the code and say run test.the results are showing in the output window. You can customize the output window to look exactly like the exe window a console app will produce. In fact they are the same. You can also drag the window to a separate location(not to be at the bottom of the IDE). Objectives: you manage few things together: build demo framework over time, separation of behavior. easy execution.save on Precompile time(after you compile one time all tests) each test will execute immediately.
ivan assenov
Wednesday, May 4, 2011 12:12:56 PM (GMT Daylight Time, UTC+01:00)
Thanks Ivan. I like your idea. I may try to refactor my console app into a series of unit tests for a future presentation. The goals are the same:
1) Have the code ready to go so the audience doesn't have to watch me type and debug.
2) Keep everything simple
Monday, December 19, 2011 6:49:16 PM (GMT Standard Time, UTC+00:00)
What's it take to become a sluimbe expounder of prose like yourself?
Wednesday, December 21, 2011 9:38:16 AM (GMT Standard Time, UTC+00:00)
qU2dS1 , [url=http://rvbcsloqakyg.com/]rvbcsloqakyg[/url], [link=http://hnxrnzasqvao.com/]hnxrnzasqvao[/link], http://tgyzupghfapk.com/
Wednesday, January 9, 2013 9:14:56 AM (GMT Standard Time, UTC+00:00)
good to come across a blog every once in a while that isn't the same unwanted rehashed information.
Wednesday, January 9, 2013 9:16:03 AM (GMT Standard Time, UTC+00:00)
I thought that was extremeley exciting. Many thanks for your unusual details. I'll maintain using this.
Comments are closed.