Category: Blog

  • Making Better Presentations–Practice

    This is part of a series of tips for speakers on how to make your presentations better.

    There’s one thing that makes a big difference for many speakers.

    Practice

    Practice makes perfect, but more importantly, practice develops familiarity. Everyone gets a little nervous on stage, everyone struggled to memorize their entire talk. The best presenters learn to minimize the amount of thinking they need to do on stage, and build a smooth flow of topics.

    It’s important for you to practice your talks so that you become comfortable with the flow and ordering of your slides. I have typically done the following when I build a new presentation

    • Practice sections as I create them – Actually run through the words in my head.
    • Practice the entire talk of slides out loud – I may do this a few times in my office.
    • Record myself giving the talk and watch for the flow – I rarely do this anymore, but I have done it quite a few times when I was beginning speaking. Even now I’ll see recordings of myself at times and see things I want to improve or remove in my style.
    • Run through the talk the night before, often in my head, quickly, but covering each slide and demo.

    Above all, practice with your demos and code. Learn to move around the system easily and smoothly. Being able to select icons, hit shortcuts, select code, etc. makes your presentations smoother, but it’s also handy in your work. Having these tools quickly move in and out of your way make you a more efficient worker.

    The big things I’d tell people to understand is how to switch to and from Powerpoint. Note that you don’t need to stop the presentation to switch. ALT+Tab to your other application and ALT+TAB back to Powerpoint. The presentation itself will be an app separate from Powerpoint. It will take you 30 seconds to figure it out, but practice.

    Practice, practice, practice.

    Remember, amateurs practice until they get it right. Professionals practice until they don’t get it wrong.

  • Testing your API

    I think learning to better test our software, including the database objects, is one of the ways in which we’ll build better software applications in the future. Testing is a complex subject, but this is part of a series that looks at ways in which you can use tSQLt.

    Checking Table Metadata

    One of the easy tests you can write is to compare the meta data of an object to a known quantity. The easy way to do that in tSQLt is to use the AssertResultSetsHaveSameMetaData function. This function compares the structure of two result sets, covering names, ordering, and data types, to determine if they are the same.

    Here’s a quick example of how that’s done.

    Let’s assume I have this table:

     create table Articles  (
        [ArticlesID] [int] identity(1,1) not null,
        [AuthorID] [int] null,
        [Title] [char](142) null,
        [Description] [varchar](max) null,
        [Article] [varchar](max) null,
        [PublishDate] [datetime] null,
        [ModifiedDate] [datetime] null,
        [URL] [char](200) null,
        [Comments] [int] null
      );

    If I wanted to write a test in tSQLt to check this table for changes or alterations, here’s what I’d do in code:

    create procedure Articles.[test Articles_Check_metadata]

    as

    begin

      –Assemble

    create table Articles.Expected

      (

        [ArticlesID] [int] identity(1,1) not null,

        [AuthorID] [int] null,

        [Title] [char](142) null,

        [Description] [varchar](max) null,

        [Article] [varchar](max) null,

        [PublishDate] [datetime] null,

        [ModifiedDate] [datetime] null,

        [URL] [char](200) null,

        [Comments] [int] null

      );

     
      –Act

     
      –Assert

    exec tsqlt.AssertResultSetsHaveSameMetaData

      @expectedCommand = N’select * from Articles.Expected’,

      @actualCommand = N’select * from articles’

      ;

    end

    ;

    go

    Note that I don’t have an ACT section in this test.

    The Assemble section is easy. I record the size and shape of my table. This will be what I compare the actual table to in the database.

    The Assert section is a call to AssertResultSetsHaveSameMetaData, with a SELECT * from the real table being compared to the same SELECT from the expected result table I created. If these match, I pass the test. If they don’t, the test fails.

    Why?

    This seems silly, I know. What does it matter if the table changes, and it certainly will need to change. I definitely questioned the value of a test like this when I first saw the example. However when I thought about it, and thought about the places in which I’ve developed databases, this makes some sense.

    Imagine that I have 3 or 4 (or more) developers. As we get new requirements, we’ll change the schema over time. Imagine that I actually have views built on this table, and other procedures and functions, all of which have some tests on them. If I change this schema, and run a test suite, I could see multiple failures. If I did that, one would hope I realized that the addition of a column here (or a rename) would cause those issues. However if I changed a couple things before running a test, which is something I might do at times, having this test fail tells me quickly that the schema was altered. If someone else changed the schema, I also quickly see that this change was to the schema.

    It’s not a big change, but it does allow me to determine that I need to refactor all the objects (potentially) that depend on this table. I can go do that work now, or add it to the list of tasks for this particular development task, and also fix the tests, which should go quickly.

    If the work doesn’t go quickly because I have a lot of objects, then I’m really glad that I learned now this is an issue.

    This becomes even more valuable with views and procedures returning result sets. If I add a column, then I may or may not want views to change, but certainly a check of view meta data will tell me if they do.

  • A Mini Break

    I’m feeling pressure. As I get this post ready, I feel a bit of a buzz from the stress of prepping a number of different presentations for the next month. Quite a few are new, and that always has me worried.

    I know that’s not good, and I’ve over committed myself a bit. Actually, my employer and I together have over committed me. There’s a lesson in here for next year, and I’ve already spoken to my boss on things we need to watch out for next year.

    However I also need to fit in a few breaks here for my own sanity, and today is one of them. So everyone enjoy have a good day, and remember to take your vacation. That’s a lesson I’m trying to work on today.

  • SQL in the City This Fall

    We’ve got a couple of large SQL in the City events coming this fall.  I’m speaking at both, which I think means my boss is happy with my work for Red Gate Software. At least, that’s what I’ll tell myself.
     
    In a little over a week I’ll be in both London and Seattle, delivering a variety of sessions on DBA and development topics. I start the day off with a session for the DBAs with Avoiding a DBA’s worst days with monitoring. This is based on The DBA Team’s 5 Worst Days in a DBA’s Life where we look at some of the situations you can avoid by keeping an eye on your environment. I then cover Version control and CI Fundamentals for databases, looking at how you can get your database code in a VCS and build a Continuous Integration (CI) process. I’ll also cover testing, using the free tSQLt framework to write some tests against your databases.
     
    It’s a quick set of sessions for me, but I’ll be around all day to talk to you about your database delivery, deployment, development, or administration issues. Or just shake your hand if you’d like.
     
    I fly to London for our event on Fri, Oct 24 and then will be in Seattle on Nov 3 for the second stop on the tour. A lot of travel for me, but I’m sure it’s an easier commute for most of you.  I hope you’ll join us and come learn a bit more about SQL Server than you might know today.