Monday, April 30, 2012

If It Ain't Broke...

Something that has always bothered me about a lot of folks who work in the "IT" field is this:  They insist that "newer is better" as knee-jerk perspective, while many of them drive old cars... by choice.  For example, when I had a discussion with a colleague who was adamant that VBScript and BAT are "dead" and PowerShell is the "future".  I countered that they are not dead, but that PowerShell is simply another guest at the party.  Then he countered with the "newer is better" mantra.  Then I asked why he still drives a 1968 Chevy Camaro SS.  He started to answer and then stumbled.  I followed with the following rationale...
  • Surely the "new" Camaro is engineered better (more efficient, safer, etc.)
  • The "new" Camaro has newer technology features
  • The "new" Camaro is built with more modern materials
So, why then does he not dump his '68 model for the 2013 model?

A-ha!

To be fair, it's not even about PowerShell.  It's not about any ONE language or technology.  It's about the whole mindset that one thing MUST replace another, rather than be enjoined to the community of potential tools to solve problems.  Medicine is a great example of this.  Even with the newest modern advances in medical technology and medical procedures, many of the most commonly used procedures date back decades, even centuries.  While the tools become more advanced, a drill is still a drill and a saw is still a saw.  Hopefully, you get where I'm going with this.

One tiny, little, itsy-bitsy example is this all-too-common approach to dealing with the Registry.  Someone says "hey!  I need you to delete a few Registry keys with a script... fast!"

You pull out the tool you know best, maybe it's VBScript, and you do something like this...

Dim WshShell, Value1, Value2

Value1= "HKEY_LOCAL_MACHINE\SOFTWARE\Fubar 2013\StupidKey1"
Value2="HKEY_CURRENT_USER\Software\Fubar 2013\StupidKey1"

Set WshShell = WScript.CreateObject("WScript.Shell")

On Error Resume Next
WshShell.RegDelete Value1
WshShell.RegDelete Value2

There's obviously nothing wrong with that approach.  But why not just do it with TWO lines of code using REG.exe and a CMD shell script?  Command Line tools are often very powerful and often more compact with regards to syntax.  Some that come to mind are DISM, APPCMD, REG, WMIC, SC, ROBOCOPY, and even CACLS and REGINI.

reg delete "HKLM\SOFTWARE\Fubar 2013\StupidKey1" /f
reg delete "HKCU\SOFTWARE\Fubar 2013\StupidKey1" /f

It really doesn't matter which two, or three, or six languages you want to compare and contrast.  Languages are tools.  Nothing more.  PERIOD.  Anyone who gets into a heated argument over which programming language is "best" deserves an open-hand smack.  Ok, enough of that, back to the discussion...

The ideal approach is to learn as many options as you can.  The more options the better.  You CANNOT learn too many options in any profession.  That is the crux of becoming a master at any trade.  Whether you are a carpenter, a painter, a brick mason, a surgeon, a soldier, or a programmer... the more options you learn the better equipped you'll be at facing unexpected or unfamiliar problems, and the faster you'll be at addressing the familiar problems, and more efficiently.  That is what they call "value-add".  Learning.

So, before you write something (or someone) off as obsolete, think again.  Maybe it's still useful. Maybe it's not really "broke".  Maybe the newer alternatives offer clear advantages in some situations, but not in *all* situations.  Rather than throwing out old options as a standard practice isn't really so good after all.  If it's still there, at least give it consideration.  You never know when the "old" option might be the "better" option.

Now, this is where my Perl colleagues will say "I can do that in one line" and chuckle.  I hate those guys.

No comments: