r/sysadmin • Systems Engineer • Aug 18 '16

PowerShell is open source, available for Linux and OS X

https://github.com/PowerShell/PowerShell
1.3k Upvotes

369 comments sorted by

View all comments

Show parent comments

9

u/jimicus IT Manager Aug 18 '16

I think that's essentially the point.

.NET integrates very nicely with Windows because Windows itself is object-oriented.

Linux isn't. Linux treats everything as a stream of text. Application configuration, OS configuration - very few of these tasks were designed around OO ideas.

Which realistically means the Linux .NET implementation (and hence the Linux Powershell implementation) will either:

  1. Never give you complete access to all the things that go on under the hood in the same way it does on Windows OR:

  2. It will, but as soon as you do something outside the .NET framework you'll be manipulating plain text files in Powershell (which somewhat eliminates 90% of the goodness Powershell offers) OR:

  3. Implement a shim layer that makes the non-OO land of Linux look OO to anything using .NET. (Which is going to be an unholy mess of incompatibilities and incompleteness because we can't realistically expect the various applications in Linux to start to account for this sort of thing when them implement new features, and I think even Microsoft would be hard-pressed to blag sufficient resources to implement modules that manage Apache, Nginx, Samba, Postgres, MySQL, Postfix and OpenLDAP using the same syntax as the existing modules that manage SQL Server, IIS, Exchange, Active Directory, etc etc)

15

u/theevilsharpie Jack of All Trades Aug 18 '16

.NET integrates very nicely with Windows because Windows itself is object-oriented. Linux isn't. Linux treats everything as a stream of text.

There is nothing inherently object-oriented (or text-oriented) in either Windows or Linux.

2

u/LeeTaeRyeo Aug 19 '16

Eh, I'm not super familiar with Win32 programming, but from what it seems, it is fairly OO-friendly. I mean, everything functions by creating a handle to some structure and then passing messages around to the different structures, which then causes functions to be invoked on individual structures depending on handles. This is very reminiscent of Objective-C's object system. In ObjC, you essentially have structures with access levels and a set of messages that the structure will respond to, with each message being either a class message or an individual message which acts on an individual instance of the structure, based on a pointer to that instance.

Also, almost no one uses straight Win32 anymore and most use COM or some such library, an object oriented framework on top of Win32.

I could be wrong about all of this, so take it with some salt.

2

u/virgnar Aug 19 '16

Can you clarify what you mean by that? Nearly everything in Windows is represented by an object, and a lot is done in Linux through interacting with it as if it was a file or stream of data.

4

u/[deleted] Aug 18 '16

There's nothing special about text with regards to PowerShell. Text, or text arrays, are just native objects to .NET and are of course handled just fine in PoSh.