How to Make Your Code Demos Rock!
Do you have to explain your code at team meetings? Do you present at user groups, or conferences (if not now perhaps something to work towards)? There are a number of little things you can do to make your code demonstrations more effective. Whether you are working with SQL Server Management Studio, Visual Studio, or the Command Window, it is worth taking a little time to learn a few best practices. That’s why I co-presented a session entitled “Creating Captivating Code” with developer MCT, Christopher Harrison (@geektrainer) at the ``MCT Third Thursday`` April 21st. If you are an MCT, you can visit the MCT Summit site and see the recorded session. For those of you who are not MCTs, maybe you want to become one (but that’s a blog for another day,) meanwhile, I’ll share a few tips and tricks here.
The first step is to take some time to learn how to make the most of the tools themselves. For example, if you are doing a demonstration in Visual Studio, choose Tools | Options from the menu and explore! You can add or remove line numbers, change the font size, or even the tab settings. Learning how to use the tool features to make your code appear more clearly will make your demonstrations more effective and can even make you look smarter ! Don’t believe me? Next time you are showing someone your code in Visual Studio, put your cursor in the code window and try <ALT><SHIFT><ENTER>. I promise you, your co-worker will look at you impressed and say “Hey, that’s cool! How did you do that?” (by the way to exit this mode use <ALT><U> ) Like that trick? There is a great session from TechDays called Visual Studio Tips 2010 and Tricks you can watch to learn more. In SQL Server Management Studio, go to the menu and choose Tools | Options | Environment | Fonts and Colors, choose Selected Text Item and set Background to yellow, and Foreground to black. Now when you highlight part of a SQL command or stored procedure it will jump out at you (no 3D glasses required.) Working in the Command Window? Right click at the top of the Command Window and choose Properties | Font | Size to change the size of the font (I like 12X16.)
How you write your code affects code demonstrations too. Formatting counts! Indent your If statements and loops, use meaningful variable names, make keywords uppercase in your SQL commands. This makes your code easier to read and consequently easier to understand. Keep your methods short, I don’t need to see the code that declares the connection string when you are trying to show me a LINQ query. If you want to write the code from beginning to end so you can show all the steps required, consider refactoring. For example, if you start your demonstration by creating and opening a connection, refactor that code into a method called OpenConnection and call the method, then go on to write your query. This way when you are explaining the query all eyes are on the query, exactly where you want them!
My 5
5 Tricks to improve demonstrations in different tools
- For all your demonstrations – Install and use ZoomIt or something equivalent. With Zoomit, you can zoom in when the text or image is too small to see. In particular, Zoomit is great for property windows, Explorer windows and execution plans.
- SQL Server Management Studio – Change the Font Size for the Text Editor, Grid Results, and Text Results (Tools Options | Environment | Fonts and Colors)
- Visual Studio – Change the Font Size for the code editor window (Tools Options | Environment | Fonts and Colors)
- Command Window – Change the Screen Background to White and the Screen Text to Black (Properties | Colors)
- Windows Phone 7 – Clean your fingernails. It sounds nitpicky but seeing an enlarged view of dirty fingernails on the projector is actually distracting me from the cool stuff you are trying to show me!
One of the great debates (aside from VB vs C# but that is a discussion for another day) is whether code demos should be kept simple to just illustrate the concept, or more complicated so they better reflect the real world. I would be curious to know what you think both from a presenter and audience perspective. Should code demonstrations be Simple or Real World?