Archive for May 24th, 2007
Thursday, May 24th, 2007
I like that .NET objects I’m familiar with are available to me on the command line, as objects:
> “hello, world!”.ToUpper()
PowerShell’s codename, Monad, comes from Gottfried Leibniz’s monadology, a philosophy in which the universe is a composite of fundamental elements called monads that are integrated in a “pre-established harmony”. Similarly, PowerShell is a composite of the complex tasks of a series of components. The components are special programs called cmdlets (pronounced command lets), which are .NET classes designed to use the features of the environment. The key difference between the usual UNIX approach and the PowerShell one is that rather than creating a “pipeline” based on textual input and output, PowerShell passes data between the various cmdlets as objects (structured data).
If accessed individually from the command line, a cmdlet’s output will automatically be converted into text, but if its output is to be used by another cmdlet, it will be converted into whatever form of object is most appropriate for that cmdlet’s input. This has the advantage of eliminating the need for the many text-processing utilities which are common in UNIX pipelines, such as grep and awk, as well as allowing things to be combined interactively, or in a scripting environment, which would otherwise require a more complex programming language. For instance, a listing of processes will consist not of text describing them, but objects representing them, so that methods can be called on those objects without explicit reference to any outside structure or library.