The Genius of Verb-Noun in PowerShell

I have always admired much of the design of the PowerShell language. Its simplicity and readability to me are its two greatest features. Something that I think gets overlooked sometimes is the design of the cmdlet names, which use verb-noun in their naming, such as Start-Process. When you start to compare PowerShell against traditional command line languages like bash and CMD you begin to really appreciate how easy PowerShell makes it on the user in terms of usability and learning. The naming of the PowerShell commands provides a way for users to intuitively figure out what cmdlet they need to use and what that cmdlet does. Now, I am not saying PowerShell is BETTER in general than others like bash, but its hard to argue against PowerShell being a more readable language.

Take for instance viewing the processes running on a machine:

On a Linux machine in bash this would be the command top. How do I know this? Well, it’s just something you sort of figure out when using bash, but lets say I just started using Linux and I want to find this, I could search the man pages I suppose:

Fail.

Scroll, scroll, scroll oh there it is. Top displays Linux processes. Not exactly easy to figure that out though and it is sure as hell not intuitive given the name of the command.

In PowerShell, the cmdlet is Get-Process. If I did not know that and wanted to find I would use Get-Command:

Or since I know the way the PowerShell designs its cmdlet naming, I can just use tab completion, which is what I do from time to time. I know that I want to display something, so Get is usually what is used for that. I know that I want to display processes, so…

Get. Dash.Process.

Makes sense.

This illustrates one of my biggest gripes with the Linux command-line and bash in general. The commands are really, really not intuitive.

Grep. Sed. ls.

Sure, not hard to remember once you use Linux for a while, but lets call the command naming what it is. Poor design in terms of usability and readability.

PowerShell got that part right.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *