Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

The Human Touch Expand / Collapse
Author
Message
Posted Wednesday, July 31, 2013 9:54 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 12:57 PM
Points: 33,206, Visits: 15,361
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
Post #1479779
Posted Thursday, August 1, 2013 1:53 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:50 PM
Points: 5,984, Visits: 8,240
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
Post #1479821
Posted Thursday, August 1, 2013 4:44 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:42 AM
Points: 1,635, Visits: 5,592
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!
Post #1479871
Posted Thursday, August 1, 2013 7:46 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:04 PM
Points: 411, Visits: 2,413
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.
Post #1479948
Posted Thursday, August 1, 2013 7:52 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:42 AM
Points: 1,635, Visits: 5,592
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.
Post #1479954
Posted Thursday, August 1, 2013 7:53 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 1,070, Visits: 901
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.



Post #1479956
Posted Thursday, August 1, 2013 8:06 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:04 PM
Points: 411, Visits: 2,413
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.
Post #1479958
Posted Thursday, August 1, 2013 8:10 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:04 PM
Points: 411, Visits: 2,413
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
Post #1479960
Posted Thursday, August 1, 2013 8:18 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:50 PM
Points: 5,984, Visits: 8,240
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
Post #1479963
Posted Thursday, August 1, 2013 8:41 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:04 PM
Points: 411, Visits: 2,413
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!
Post #1479977
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse