BPuhl’s Blog

A little bit of everything without actually being much of anything

It’s not a "one-liner" if…

Posted by BPuhl on February 15, 2008

…the language syntax allows you to nest and pipe a dozen commands together.

This seems to be a common theme with the Poweshell folks lately.  A rash of “examples” of how Powershell is so much easier, because you can do something in “one line” in Powershell that takes you 10-15 lines to do in VBScript.

Most recently from this blog:

[guid]((([directoryservices.directorysearcher] “(samaccountname=theuser)”).findall())[0].properties.getenumerator() | ? { $_.name -eq “objectguid”}).value[0]

Seriously, even in the blog post, he had to give instructions for what this thing means. 

Advertisements

One Response to “It’s not a "one-liner" if…”

  1. Laura said

    Amen. It’s Computer Programming 101 – just because you can make a line of code shorter through nesting (in this case, 4 parenthesis deep), doesn’t mean that you should if it will sacrifice readability/maintainability, particularly if your code is going to be managed/maintained by someone other than you. (And when in a modern workplace is that not going to be the case?)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: