Citrix’s inconsistent cmdlets naming

After being a part of a few email threads and discussions about Citrix not following the traditional name-verb cmdlet naming scheme I thought I would make a post with my take on that.

Basically, Citrix joined companies like Microsoft, VMware and Quest and is also trying to PowerShell-enable all of their products. However, they chose to not follow the standard naming scheme and went with a few of their own.

The ones for Provisioning Server are just bad: They user verb instead of a noun, prefix instead of a verb, and noun instead of a parameter.

So instead of: Add-Device – they have: Mcli-Add Device.

XenServer ones are slightly better (verb is where it is supposed to be) but nouns get colons and dots – something no other company in the world is using:

Get-XenServer:VM.NameLabel

I think I understand why XenServer guys are designing their cmdlets that way – they simply try to workaround the namespaces issue which PowerShell has (see my blog post about that and vote for the bug on the connect site)

Basically, they want to make sure that their cmdlets don’t produce naming conflicts if administrators also have VMware and Microsoft cmdlets on the same box.

We had the same issue with our AD cmdlets and are using QAD prefix for every noun: e.g. Get-QADUser.

So I totally agree that the issue exists but I urge Citrix and other companies to not try to workaround it in a way so inconsistent with what everyone else is doing. We will simply do a very bad service to administrators who have to manage more that one system. Consistency is key to the success of PowerShell and I hope we can maintain that.

My suggestions:

To Microsoft: As vendors start adopting PowerShell we will be getting increasingly more issues like that, so please:

  • Consider enforcing naming standards in PowerShell and Visual Studio templates or at least (if the fear of losing backwards compatibility is strong) make sure that compilation and snapin registration produce warnings if non-standard cmdlet names are used.
  • Please provide a viable way of handling cmdlet naming conflicts. Administrators should be able to easily avoid these and get predictable results.

To Citrix:

  • Please get back to the standard Verb-Noun (or Verb-PrefixNoun) notation.
  • Consider giving your snapins short names so your aministrators could use: XenServer\Get-VM (or just Get-VM if there’s no conflict) rather than Get-XenServer:VM.

Tags: , ,

About these ads

15 Responses to “Citrix’s inconsistent cmdlets naming”


  1. 1 Carter Shanklin March 16, 2009 at 5:09 pm

    2nded. MS needs to take the lead on this one. In the past MS has said that this is a very hard problem with no good solution, but if they don’t solve it PowerShell could become a victim of its own success.

  2. 2 Ewan Mellor March 16, 2009 at 11:41 pm

    Thanks for your comments, Dmitry. As you note, the natural names for the Citrix XenServer cmdlets would clash with VMware’s in many cases. For this reason, we’ve added a prefix to each noun.

    In addition, we added a command to create shorter aliases, for those who don’t have the namespace problem. Calling “Initialize-XenServer:Aliases Start” will make it possible to use names such as “Start-VM” and “Get-VM” instead, just as you would like.

    I have a blog post explaining Initialize-XenServer:Aliases (and many other things about the snap-in) at

    http://community.citrix.com/blogs/citrite/ewanm/2008/10/08/XenServerPSSnapin+Demo+-+Chained+VM+Starts

    We’re obviously not alone in looking to Microsoft for a lead on this. The guidance seems clear that you should not mess around with the verb, so we chose to put our namespace in the noun instead. Without proper guidance from Microsoft, inconsistency across the community is inevitable.

  3. 3 Joel "Jaykul" Bennett March 17, 2009 at 1:40 am

    You mean “Consider enforcing naming standards in” PowerShell (not Visual Studio) right?

    I must admit that sometimes I wonder why they didn’t enforce their standard list on the Cmdlet parameter by making it a strict enum instead of a string, but there you go.

  4. 4 Martin Zugec March 17, 2009 at 10:09 am

    Hi Dmitry,

    this is never ending discussion and my personal opinion is that it will be (and IMHO should be) before Microsoft kicks in and updates naming convention for PowerShell…

    We had pretty lengty discussion here about it: http://martinzugec.blogspot.com/2009/03/smart-function-names-in-powershell.html

    I would like to blog about it today, because without namespaces my life would be much more complicated. I use :- at the moment, however if there would be any industry standard (like \-), I would be more than happy to follow it :(

    Martin

  5. 5 Dmitry Sotnikov March 17, 2009 at 11:09 am

    Ewan,

    I totally get that you are trying to avoid naming collision and when you have time please vote for the namespace feature request for PowerShell at connect: https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=301052&SiteID=99 (plus probably add your comments to the request, etc.)

    However, I am not sure why would not you just use: XenServer\Get-VM instead (if you make XenServer your PSSnapin name) – this will provide the collision resolution in a PowerShell way, right?

    Dmitry

  6. 6 Dmitry Sotnikov March 17, 2009 at 11:11 am

    Joel,

    Yes, sorry for the typo. Was thinking 2 things at the same time. They can actually enforce/warn in both places – PowerShell itself and Visual Studio templates – would provide a bigger outreach…

    Dmitry

  7. 7 Dmitry Sotnikov March 17, 2009 at 11:13 am

    Martin,

    Let’s keep pushing for namespaces: https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=301052&SiteID=99

    The \ notation is actually a PSSnapin resolution and thus a full name which should work for cmdlets already. Did not try this for PowerShell v2 modules – hopefully will work there too.

    Dmitry

  8. 8 Martin Zugec March 17, 2009 at 11:18 am

    Hi Dmitry,

    no worries, already voted few times. Today I will post link to your feature request at my blog also (power of community ;))…

    I use prefixes for long time already at big customers with different skills, so I can tell you that they work really nicely without any problems.

    Two problems I encountered though are:
    – sometimes highlighting in ISEs doesn’t work. However I expect that once namespace syntax will be consolidated, they would fix it immediately
    – advanced tab expansion doesn’t work. For example Citrix\Logoff-Users, if you type Citrix, it works, if you type Citrix\, it doesn’t. Same applies for *x\ – won’t work. However because I work with frameworks, limitations to interactive sessions are not that important to me

    Anyway, one more point to add. You are focusing on snapins\modules (where this functionality already exists, XenServer\Get-VM etc…), however for me functions are where I feel that namespaces are really missing.

  9. 9 Dmitry Sotnikov March 17, 2009 at 11:49 am

    Martin,

    A couple of things:

    > sometimes highlighting in ISEs doesn’t work

    Would highlighting work for these in the PowerGUI Script Editor? Could be worth a try – after all it is a free download from http://powergui.org.

    > however for me functions are where I feel that namespaces are really missing

    Wouldn’t you be packaging your function libraries in modules in v2?

    Dmitry

  10. 10 Martin Zugec March 17, 2009 at 12:00 pm

    I tried it in PowerGUI already… It doesn’t highlight function if you use prefix\namespace. As I said, for me it is not huge issue, however it should be mentioned.

    But I encountered bug in PowerGUI now – it doesn’t correctly highlight function when using function scopes, so it makes sense it doesn’t work for my scenario also (:-).
    Only Global: scope is supported, I will write bug report for this.

    In PSv2, I will definitely use modules. Problem is that I am specialized for enterprise deployment, so it will probably take 2 years before I will be able to start using it :( On the other hand, I am designing frameworks, so “fixing” namespaces in future is extremely simple for me. However even with PSv1 I would like to have function names in same format as they will be in PSv2 (at least because customers\consultants won’t need to learn new naming convention).

    4 years ago I applied PSv1 naming convention to batch scripts in framework, so transition from batch to PSv1 was much easier for people involved (they were using same function names as before). And I would like to achieve same with PSv2.

  11. 11 Pete Downing March 17, 2009 at 12:48 pm

    Thanks for the feedback. We are working on updating and fixing our cmdlets and have the engineering team looking at your blog post now.

    Thanks!

    Pete Downing
    Senior Product Manager, Provisioning services
    Citrix Systems, Inc.

  12. 13 Sprocket Wiggler July 29, 2009 at 8:12 pm

    When I first encountered PowerShell, the concept of a list of approved verbs struck me as strange – why do I have to use a list of verbs MS decided on? There will always be some actions in my product that do not fit into any of these verbs, and my existing customers will have to relearn what the commands mean. However, after a while I came to believe that perhaps a small set of verbs does make sense, in that it provides a uniform way to address actions. E.g., Instead of “Assign-User” I can use “Add-UserAssignment”. Fine.

    But now there are 96 verbs. The list of “approved” verbs is well on its way to complete dilution. What is point of having 96 approved verbs? It’s not like users are going to understand or care about the difference between GET or SELECT or FIND or REQUEST. They want whatever is easy and fits the product. I’m sure PS3 will have 134 approved verbs. I see my example “assign” has been [arbitrarily] rejected for PS2.

    Seriously, is there a point to these anymore? Why not just suggest the best-practice of using the verb-noun syntax for your cmdlets and forget the whole approved-verbs thing?

    If my product has a “Wiggle” action and a “Sprocket” object, why do I need to find another way to convey “Wiggle-Sprocket”?

  13. 14 Dmitry Sotnikov July 30, 2009 at 6:23 pm

    Wiggle-Sprocket at least looks fairly consistent – and OK if your customers understand what Wiggling is and are fine with seeing a warning when importing your module.

    “Mcli-Add Device” and “Get-XenServer:VM.NameLabel” look completely non-PowerShell and this was what caused my concern – not non-standard verbs.


  1. 1 Episode 63 - PowerShell MVP Brandon Shell « PowerScripting Podcast Trackback on March 24, 2009 at 3:40 am

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




My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Follow

Get every new post delivered to your Inbox.

Join 2,328 other followers

%d bloggers like this: