Do you present at user groups, or conferences? Maybe you have to walk through your code at team meetings. Regardless, 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!
5 Tricks to improve demonstrations in different tools
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?
I think the question of whether code demonstrations should be simple or real world cannot be answered in a cut and dried 'this is how it should always be' way.
The answer depends on your audience, the subject at hand, the time you have to make your point and the perspective of your target audience.
In many cases, such as at TechDays, where you have a short time to get several points across, simplicity can be your friend, whereas, in a classroom / hackfest / user group meeting where you have a longer time to focus on a single or a couple of points, you can easily delve a little deeper.
Mind you, even in these situations it can be good to start the demonstration off with a simple example and then delve deeper if it looks like your audience is indeed interested and wants a more "real-world" point of view on the subject.
Clean your fingernails! That is the best tip ever...
Some really good formatting tips, but what about real code/date Knowing a bit about how you teach, what's your feeling on bringing real world data/code into class? I'm strongly looking at bringing Azure Datamarket data into SQL/SSAS/PowerPivot classes...
Atley - agreed real world vs simple cannot be a straight yes no answer. It is important that your demos be simple enough for people to follow. If they are keeping up then it cna be beneficial to delve deeper into real world scenarios
Jeff - :)
Glen - Forgive the slow reply, you bring up an interesting issue and I wanted to do a bit of research before I answered. I am hesitant to use real world data in my demonstrations becaues of the risk of exposing confidential or private information. You can certainly use publicly available information in your demos. But anything you purchase is not considered public so that would imply you shouldn't be using the Azure marketplace data. As alternatives check out the Contoso BI Demo data set in the microsoft download center, or the Mondial dataset at sqlskills.com, or check out Statistics Canada, you can download lots of interesting data sets from their site. Australias government site has some fun data as well "Frogs of South Australia" anyone?