SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The Human Touch


The Human Touch

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)SSC Guru (139K reputation)

Group: Administrators
Points: 139185 Visits: 19410
Comments posted to this topic are about the item The Human Touch

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18183 Visits: 12426
I understand what you're saying, Steve. But there is also another side to the equation.

First, on using the script button in SSMS.
Using this button to generate code can be dangerous - especially if you trust the script blindly. I know that older versions of SSMS often created scripts that were buggy. (Worst example I have seen, I think from the SQL2005 version of SSMS, is a script that "changed" a table by creating a new one, copying the rows, then dropping the old table. I noticed that some of the BEGIN TRAN / COMMIT TRAN statements were in the wrong places - a server failure in the worst possible moment could result in losing all data in the table!). Of course, the same risk is present when executing from the SSMS dialogs (since that uses the same script, except without showing it to the user). And I have to add that the scripts have improved, though I have not really inspected them in detail since SQL2008.
So my take would be that the script button is very important - not as a way to easily create reusable scripts, as you indicate in the article, but as a way to double check the script generated by SSMS and correct it if it's wrong, unsafe, or inefficient.

Then, on using scripts and/or PowerShell in general.
You push using this kind of automation as a way to prevent human error, because you eliminate the error-prone process of a human filling out a dialog and pressing buttons. However, humans working with a dialog *know* that they might make errors. They will usually try to prevent this by working carefully and checking what they do. Using a script gives a (sometimes false) sense of security. When people use a script, they expect it to work, period. But what if there is an error in the script? Or if the script fails to handle an unanticipated situation appropriately? If people just fire off the script and expect it to work, it can take a long time, and a lot of executions, before someone finds out. And by then, reparing the damage may be impossible.

I'm not saying that your arguments have no value. They do. But there's another side to it as well. No black, no white, just different shades of grey. (And I guess I'd better resist the temptation to count how many...)


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
paul.knibbs
paul.knibbs
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4062 Visits: 6240
I have to agree with Hugo. Relying on a script is all very well, but a human being was involved at some point in the script's creation (even if it was just entering the details into the SSMS dialogs) and therefore the script itself could be incorrect. Heck, the script could work fine for years, then fail when anyone who knows how it works has left the company, making for a very awkward situation indeed!
patrickmcginnis59 10839
patrickmcginnis59 10839
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4116 Visits: 5886
Hugo Kornelis (8/1/2013)
Then, on using scripts and/or PowerShell in general.
You push using this kind of automation as a way to prevent human error, because you eliminate the error-prone process of a human filling out a dialog and pressing buttons. However, humans working with a dialog *know* that they might make errors. They will usually try to prevent this by working carefully and checking what they do. Using a script gives a (sometimes false) sense of security. When people use a script, they expect it to work, period. But what if there is an error in the script? Or if the script fails to handle an unanticipated situation appropriately? If people just fire off the script and expect it to work, it can take a long time, and a lot of executions, before someone finds out. And by then, reparing the damage may be impossible.

We really need to treat scripting like programming in general. We want to test the script using as wide a net as possible, using a variety of input, even some input that is downright bogus. Yes, this does mean generating or procuring test data and putting effort into evaluating what conditions this script will execute in. This does mean that scripting (or programming in general) will take more effort than running one instance of the steps manually.

The advantage of scripting is that you can invest significantly more time into developing the script than would be involved in doing the steps manually, because once the script is working, you can then recoup the costs of developing the script over the subsequent executions that replace the manual steps. Every run of manual steps might include the possiblity of error, and a properly running script will eliminate this factor.

I think we forget how errors creep into our manual work, because when we repetitively run manual operations, we start to take these operations for granted, sure, like you say we're diligent the first run through the manual steps because we anticipate that we can make errors, but how diligent do we remain after the 50th time running manual steps? The advantage to scripting is that we also should be diligent and watchful for errors during the time developing the script, but once the script is successful, that diligence against errors should be in the script now as tests for erroneous conditions and does not "age" or "decrease" as would repetitive execution of manual steps.

And the advantage of scripting is that you can test that script to whatever extent you like, with the additional benefit that you can introduce edge cases (and downright bogus conditions) into your testing and see if you've covered conditions your script will subsequently encounter, but with manual processes, well I'm not so sure.

to properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
paul.knibbs
paul.knibbs
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4062 Visits: 6240
That's all true, but I come from a programming background, and I know that you will pretty much never, ever anticipate every daft or incorrect input a user is capable of providing. :-)
RichB
RichB
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2900 Visits: 1065
I would also firmly point you towards Sidney Dekkers Field Guide to understanding Human Error.

In my opinion one of the cross disciplinary must reads for any DBA.



patrickmcginnis59 10839
patrickmcginnis59 10839
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4116 Visits: 5886
paul.knibbs (8/1/2013)
That's all true, but I come from a programming background, and I know that you will pretty much never, ever anticipate every daft or incorrect input a user is capable of providing. :-)

In my case, instead of ceasing programming, I instead looked for ways to simulate daft input, and have generalised this further into putting filters on input that required conditions to be "non daft" in nature :-)

Not a perfect situation, I've been surprised before, made errors before, but in my opinion, during the course of scripting a task we can compress all of the analysis and synthesis of error handling into the exercise of scripting, whereas Hugo is stuck repeating all that analysis and synthesis DURING EACH MANUAL RUN OF HIS TASK.

to properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
patrickmcginnis59 10839
patrickmcginnis59 10839
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4116 Visits: 5886
RichB (8/1/2013)
I would also firmly point you towards Sidney Dekkers Field Guide to understanding Human Error.

In my opinion one of the cross disciplinary must reads for any DBA.


Awesome, I'm going to get that one!

I also like reading the "risks" digest http://en.wikipedia.org/wiki/RISKS_Digest

to properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18183 Visits: 12426
patrickmcginnis59 10839 (8/1/2013)
whereas Hugo is stuck repeating all that analysis and synthesis DURING EACH MANUAL RUN OF HIS TASK.

Heh! You must have misunderstood my point. I never said I am opposed to scripts, or that I don't use them. I just pointed out that they, too, are imperfect.

I hate having to repeat tasks manually; as soon as I anticipate that I might have to repeat a task, I almost always invest the time to script it.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
patrickmcginnis59 10839
patrickmcginnis59 10839
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4116 Visits: 5886
Hugo Kornelis (8/1/2013)
patrickmcginnis59 10839 (8/1/2013)
whereas Hugo is stuck repeating all that analysis and synthesis DURING EACH MANUAL RUN OF HIS TASK.

Heh! You must have misunderstood my point. I never said I am opposed to scripts, or that I don't use them. I just pointed out that they, too, are imperfect.

I'm glad I just misunderstood it and that you didn't really mean what you typed!

to properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search