1
\$\begingroup\$

A function is doing IO operation . If the IO reaches a size more than warning limit storage array will send the event to host. The same function will fetch the event.

I have used the verb-noun pattern and the name of the function is as below.

"Get-SoftAlertAfterRunIO"

It is not making sense as it is not only getting, it is also generating.

Another name I can use is:

Generate-SoftAlert

But it is not an approved verb. What could be the equivalent verb for generate?

Or is there any good name to reflect the behavior of this code.

The full code is given below

    function Generate-SoftAlert  {
    param
    (        
        $VolumeObject,
        $Size
    )  

    $Path = $VolumeObject.Path
    $IOTimeStamp = StartIO -Path $Path -LimitSizeInGB $Size 

    $IOStarttimeInArray = $IOTimeStamp.IOStarttimeInArray
    $IOStarttimeInHost = $IOTimeStamp.IOStartTimeInHost

    $IOEndtimeInArray = $IOTimeStamp.IOEndtimeInArray
    $IOEndtimeInHost = $IOTimeStamp.IOendTimeInHost

    $VolumeName = $VolumeObject.Name
    $IsSoftAlertInArray= Test-SoftAlertInArray -VolumeName $VolumeName -FromTimeStamp $IOStarttimeInArray -ToTimestamp $IOEndtimeInArray

    $DiskNumber = $VolumeObject.DiskNumber
    $SoftAlert = Get-SoftAlertInHost -After $IOStarttimeInHost -Before $IOEndtimeInHost -DiskNumber $DiskNumber
    $IsSoftAlert = ($SoftAlert -ne $null)

    $Message = $SoftAlert.Message
    $IsLogSense = $false
    If($IsSoftAlert -eq $true)
    {
        $IsLogSense = Test-LogSenseMessage -LogMessage $Message -DiskNumber $DiskNumber -thresholdInGb $WarningLimit   
    }

    return [pscustomobject]@{
        SoftAlert = $IsSoftAlert        
        LogSense = $IsLogSense
        SoftAlertInArray = $IsSoftAlertInArray
    }
}
\$\endgroup\$
4
  • \$\begingroup\$ A function is doing IO operation and once the IO reaches a given size it will trigger the event and the function will fetch it. What is "it" in "it will trigger the event"? What is "it" in "the function will fetch it"? \$\endgroup\$
    – Flater
    Mar 2, 2018 at 11:04
  • \$\begingroup\$ @Flater I have updated the question \$\endgroup\$ Mar 2, 2018 at 11:09
  • 1
    \$\begingroup\$ Are you ok with others reviewing more than just your question about naming - the rest of the code? Would you be ok if people don't mention changing the function's name? \$\endgroup\$
    – Peilonrayz
    Mar 2, 2018 at 11:18
  • 1
    \$\begingroup\$ Might be a good idea to take a look at the help center to get an idea of what to expect here. \$\endgroup\$
    – Mast
    Mar 2, 2018 at 11:24

1 Answer 1

2
\$\begingroup\$

Apply Approved Verbs for Windows PowerShell Commands article from Windows PowerShell Cmdlet Concepts, use New-SoftAlert:

Common Verbs

Windows PowerShell uses the VerbsCommon enumeration class to define generic actions that can apply to almost any cmdlet…

Verb (alias): New (n)

Action: Creates a resource. (The Set verb can also be used when creating a resource that includes data, such as the Set-Variable cmdlet.)

Comments: For this action, do not use verbs such as Create, Generate, Build, Make, or Allocate.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.