Automating the world one-liner at a time…
Hello everyone. I’m the programming writer for the PowerShell developer audience and I would like to know what language you use to write cmdlets. This is a very unscientific survey, yet getting your replies will help me decide how to add VB.NET and C++ sample code in the documentation. The content that I’m writing is the Programmer’s Guide and SDK that you find on MSDN
Thank you in advance, and if you have any other documentation questions don’t hesitate to send me an e-mail at email@example.com
I've done a few in C# but would love to see some C++/CLI sample code (and maybe port some of my native stuff to PS).
If I remember correctly, when they created the original .NET documentation base, it was decided that they would focus primarily on providing examples in VB and secondarily in C#, because it was assumed that C# programmers were able to do the mental translation between languages (while the same was not assumed of VB programmers). This decision has been of some frustration to me on certain occasions because doing that mental translation precludes the at-a-glance interpretation of example code.
That is, if you've been at it long enough, you can probably get a decent understanding of a piece of code without actually having to read it--just skimming will do. This ability is frustrated, however, when the code is in the "wrong" language. Even though you can read and understand it, it takes more effort than you'd care to expend.
With that in mind, it's worth pointing out that while VB programmers make up a significant portion of the developers working with .NET, the overlap between programmers who prefer VB and programmers would be interested in writing PowerShell commandlets is probably minimal. People who use VB with .NET are often the ones who would still be on VB6 if they could be. Remember how they tried to petition Microsoft reconsider? They're not going to give up cmd.exe either without a fight. People who develop for PowerShell, at least initially, are going to be those who are excited to try out new technology. Those users will have long since learned C#.
I'm using C# almost exclusively for cmdlets. Mainly this is because these cmdlets are intended to work with a system written in C#, and I like C#, so writing the cmdlets in that pretty much makes sense...
I use VB. I know, I'm a throwback. But I wouldn't be on VB6 if I could. I *can*, if I want to, but I don't mind VB.NET. I'm excited about the new technology... I just like the VB syntax better, is all.
Some companies have internally settled on VB as a standard, for various reasons. If there were developing cmdlets, they'd want to see examples in VB. It has nothing to do with anyone's capability, it's just a company's desire to keep their internal code in a single language. Likely the decision dates back to the VB6 days when all they had were VB programmers, but there it is. C# isn't inherently "better" a language for most purposes; it's just different. After all, it's all MSIL in the end, no?
I'd be a strong supporter of providing examples in both C# and VB. Anything MS can do to make these technologies more accessible to a broader range of programmers is essential.
I write cmdLets in C#, when working on a project in VB.NET i convert the C# code for aesthetic reasons to VB.NET with the various tools available.
I've been wanting to write one in PHP using Phalanger but i don't expect code samples for that, Once you start you'll be publishing samples in IronPython, Ruby, COBOL or any other language that can be compiled for the .NET framework.
Since Powershell is supposed to provide a glide path to C# i'd stick with that.
Please make the examples in C# so as to be consistent with every other Microsoft example, application block, etc. Anyone can translate on the fly while simultaneously learning PowerShell so naturally the VB programmers should translate.
C# C# C#
though supporting examples in other languages won't hurt. But i'd prefer more comprehensive documentation over more diverse language examples anyday.Also the glide between powershell scripts and C# based cmdlets is more natural syntaxwise the way that powershell is designed.
I haven't gotten a chance to write my own cmdlets yet, but I've been very excited over the idea of writing a cmdlet library for Python and utilizing both Python.Net and IronPython for them.
Here is mine in order of preference:
-- Powershell :-) :-) :-)
-- C# (why must we still live with statement separators?!?!?)
>> Please make the examples in C# so as to be consistent with every other Microsoft example, application block, etc. Anyone can translate on the fly while simultaneously learning PowerShell so naturally the VB programmers should translate.
I just read this. UGH! It's the C# programmers that have the skill to translate, VB is more for people who want to get things done and are not choosing a language based on what will most boost their egos.
If it is a choice between C# and VB, do VB as the C# people have the skill to translate more often than vice-versa.
Wow.. there's a huge C# following here, so I need to chime in. VB.NET VB.NET VB.NET!!! Our entire company is standardized on coding in VB.NET and i wouldn't have it any other way! VB.NET!
No offense to the C sharpees - C# is great (I don't get into language religous wars because I feel that each langauge has its own advantages and disadvantages). I just like VB.NET, personally.
I only use C# for cmdlets. But I suggest VB.net as second language as nearly every C++ User can at least read C#. In my experience this is defintively not true for the typical VB programmer.
I'm looking into developing a tutorial/course which will help VB scripters and VB.NET programmers write VB.NET cmdlets. Afterall the Cmdlet class is one which doesn't care which language is used and since these folks are either VB scripters/programmers or new to scripting all all together IMHO the VB path would be a logical way to go.
Never wrote a cmdlet yet - but I will have to do in the future.
Doing that in Ironpython would be nice.
I like to see cmdlets samples in C++/CLI