PowerShell – Scope & Tooling Design Guidelines

Example of scope:

$var = 'hello!'

function My-Function {
    Write-Host "In the function; var contains '$var'"
    $var = 'goodbye!'
    Write-Host "In the function; var is now '$var'"
}

Write-Host "In the script; var is '$var'"
Write-Host "Running the function..."
My-Function
Write-Host "Function is done."
Write-Host "In the script; var is now '$var'"

Tool design guidelines:
Do one thing, do it well.

  • Retrieve data from somewhere
  • Process data
  • Output data to somewhere
  • Put data into some visual format meant for human consumption
Advertisements

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