Forgotten art of using what you know

One thing that can be very hard to learn early in your career is the art of ignoring the latest and greatest methods to get a task done in a short amount of time.  Now, before I continue, we as technology professionals always need to embrace changes in computing.  In no way should this article portray a meaning that your skills should become stagnant and ambition and motive not be used to learn new ways of performing tasks.  This involves both subsystem enhancements as well as development enhancements.  PowerShell for one has been an accepted tool for administrative tasks and is extremely effective at getting a job done quickly and efficiently.  However, when thinking of the concept of a task and the overall formula that goes into that given task and the life of it, old and new methods should not be ignored.

Formula of a task

Result = Time Estimation – ((Technology * Time in Hours) + (Implementation * Time in Hours) )

The formula that goes into completing a task may be something so trivial to most; it isn’t even a thought process that you go through.  With earlier career building and becoming more efficient in your profession, the formula you utilize in completing tasks can be critical to how efficient you are now and later in your career.  One part in the formula is the technology to be consumed by the task.  This can be critical to a successful result for the task that you’ve been handed.

 

Take the following example

The task is to export a complete list of view definitions from INFORMATION_SCHEMA, remove the CREATE VIEW [name_of_view] AS and retain only the actual portion of the view that is used in the view definition so it can be executed for tuning.  This task can be completed with a wide array of methods and languages.  PowerShell, VBScript, RMO, C# or even T-SQL alone could complete this.  Looking at the formula, the technology we choose will directly impact the overall result.  We have to choose carefully due to the formula to ensure the task is a success.  If we chose PowerShell and it will be the first time utilizing it as a tool, and we were allowed only 2 hours to complete the task, we expose a risk factor in the formula.  5 hours may be spent on learning PowerShell, installing the required tools to develop the script as well as an implementation method that is unknown at that time.  Even if 1 hour was allocated to implementation, our formula would have shown we fell into the negative area for the overall tasks completion.

If a technology like VBScript was used and the level of skills in writing VBScript were extremely high, the task would have a better overall success rate.  You might be able to write the following in an hour.

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Function ReplaceMethod(ByRef StringToExtract, ByVal MatchPattern,ByVal ReplacementText)
    Dim regEx, CurrentMatch, CurrentMatches
 
    Set regEx = New RegExp
    regEx.Pattern = MatchPattern
    regEx.IgnoreCase = True
    regEx.MultiLine = True
    StringToExtract = regEx.Replace(StringToExtract, ReplacementText)
    Set regEx = Nothing
    ReplaceMethod = StringToExtract
End Function
 
Set fso = CreateObject("Scripting.FileSystemObject")
Set listFile = fso.OpenTextFile("c:viewlist.txt")
Set listFileNew = fso.OpenTextFile("c:viewlistnew.txt", 8, True)
 
do while not listFile.AtEndOfStream 
    fName =  listFile.ReadLine()
    newLine = ReplaceAllByExpression(fName,"(create view dbo.[[a-zA-Z_]{0,}]sasss{0,1})","")
    listFileNew.WriteLine(newLine)
loop
Function ReplaceMethod(ByRef StringToExtract, ByVal MatchPattern,ByVal ReplacementText)
	Dim regEx, CurrentMatch, CurrentMatches

	Set regEx = New RegExp
	regEx.Pattern = MatchPattern
	regEx.IgnoreCase = True
	regEx.MultiLine = True
	StringToExtract = regEx.Replace(StringToExtract, ReplacementText)
	Set regEx = Nothing
	ReplaceMethod = StringToExtract
End Function
 
Set fso = CreateObject("Scripting.FileSystemObject")
Set listFile = fso.OpenTextFile("c:viewlist.txt")
Set listFileNew = fso.OpenTextFile("c:viewlistnew.txt", 8, True)

do while not listFile.AtEndOfStream 
    fName =  listFile.ReadLine()
    newLine = ReplaceAllByExpression(fName,"(create view dbo.[[a-zA-Z_]{0,}]sasss{0,1})","")
    listFileNew.WriteLine(newLine)
loop

Put this script together with the export capabilities of SQL Server Management Studio and ability to save the export as an SSIS package, you time has now been cut down significantly.

What happened here was the utilization of high-level skills already existing to accomplish a task with a success rate.

How strict should you be with this?

Creating a situation where you run your day based on formulas that you abide by without misdirection can create a more efficient process overall.  However, taking risk factors on certain tasks that have a lower level impact is also as important.  Utilizing PowerShell, mentioned in our example above, may be the right option to allow you the ability to learn the newer scripting abilities.  It may prove to be a future replacement for what was selected as a technology to utilize.  This can be seen in efficiency and effectiveness in overall time to develop the scripts (or programs, statements, etc…) The impact level should be considered, always.

Following this task formula can be extremely effective when risk and impact to the requirements of the task area also taken into account.  Remember, learning new technologies has its place and is an absolute critical aspect to a computing profession.  Putting aside efficiency and success rates in your career should not be done however to utilize those technologies simply because they exist.

(As ugly as the VBScript above may be, it accomplished the task with an 80% success rate against the Time Estimation allowed – Success!)

Happy Computing!