4 ms·
How is having the entire C# ecosystem a big miss?
by vips7L 2y ago
How is having the entire C# ecosystem a big miss?
- jodrellblank 2y agoIt's a big miss for the casual convenience of a scripter/non-programmer. A Pythonic way to do a remote procedure call is XMLRPC (pseudocode): import xmlrpc svr = xmlrpc.connect('http://remote/') result = svr.add(1, 2) The C# way is to use the Microsoft Windows Communication Foundation (WFC) Client Proxy using the Service Model Metadata Utility Tool and the Web Services Description Language (WSDL) and XML Schema Definition Language (XSD) files from the remote server, declare a public interface attributed as a Service Contract referencing a namespace, generate a class which inherits from the generic ClientBase<TChannel> and implements the new interface, create an instance of said WCF client and call its methods. (Or rely on Visual Studio magic to hide all that) - https://learn.microsoft.com/en-us/dotnet/framework/wcf/accessing-services-using-a-wcf-client?source=recommendations https://learn.microsoft.com/en-us/dotnet/framework/wcf/acces... In any decision, Python goes for "What would Guido do?" and C# gets some union of "what would a committee of Microsoft, IBM, Oracle do?", "What would impress Gartner?", "What is Microsoft legally obliged to do, and backwards-compatibly required to do?", "What would we do if we tried to do everything everyone needs all in one?", "What would Java do?", "What would a large team need to design and maintain a stable, typed, large system for years?". PowerShell is on top of that; there's no simple included graphing and drawing, no simple hooks into Windows own voice recognition and OCR, and definitely not into whatever magically good ones newer Office / Cloud is using, no casual email or spreadsheet handling, no Visual Basic style form building, no simple data science; there's a few things you can do or download, generally less convenient than a Python equivalent. And Microsoft are leaving it all 'to the community' but the community is using Python so that's where the Excel power-user who wants to script a couple of things will go.
- vips7L 2y agoI don’t think Python, a general purpose scripting language; and PowerShell, a shell, are going for the same things. They have different goals and by your definition every other tool is a “big miss” because they are not Python. I have never desired to do xmlrpc, ocr, voice recognition, or gui building from my shell (and if I did I still don’t see how importing a C# library would be a big miss). What I do desire to do is open files, read their contents and pipe them into other programs, something that Python makes a pain to do with all the file handling. Powershell definitely excels at this, does that make Python a big miss?
- jodrellblank 2y agoI thought I was replying somewhere under this other side-thread https://news.ycombinator.com/item?id=40875610 https://news.ycombinator.com/item?id=40875610 which says "There are probably users in the millions that are ok at the basics of programming, but don't have the job role to where tools like Java or C# make sense. Python is usually a good fit here, but I really wish Microsoft had something written for us common folks and not just server admins and IT folks. If Microsoft put some more effort into PWSH to where it wasn't turtle slow at things like parsing files and then started adding things like what I talk about above. Maybe even cmdlets for statistics and science...it could be something pretty amazing that your typical business analyst could quickly use" in that context C# library isn't fit for it. Yes I agree Python and PowerShell aren't going for the same things; that's annoying because PowerShell is 80% of the way there. > "I have never desired to do ocr, voice recognition, or gui building from my shell" I have wanted those things. Windows which has a built in speech recognition engine which is COM automatable, a shell (PowerShell) which can be a COM client, and I have a folder full of phonecall recordings. I have a folder full of photos with things like menus and road signs and I want the equivalent of strings.exe for OCR and PowerShell could almost do it. I've wanted to build a Delphi or VB6 or C# style drag-drop GUI and tried to do it in PowerShell with SharpDevelop, WinForms code, the ShowUI module. I've wanted to build a TUI but Windows console host isn't good at those. I've wanted to get jpg metadata out and done it with Shell.Application automation around Explorer instead of downloading mediainfo. All these thing have something in common - a core in a low level language, glued together or scripted in a high level language. Microsoft have written the core. They have written the high level language. They just didn't bother to make it all integrated for the ordinary power user, or flesh it out with more features along those lines over the years. > "if I did I still don’t see how importing a C# library would be a big miss" Because, compared to a builtin "ConvertFrom-Speech" you have to be enough of a programmer to know you need C#, go looking for a package, navigate oneget/winget/psget/nuget/github to download it, worry about .NET version compatibility and module paths, work out how to add an assembly, and then deal with interop, [ref] parameters, byte arrays, streaming. > "What I do desire to do is open files, read their contents" Same. And the contents could be all common formats on Windows since the 1990s - MP3, JPG, Excel - things Windows can read and play, things Explorer can read metadata from. > "and pipe them into other programs, something that Python makes a pain to do with all the file handling. Powershell definitely excels at this, does that make Python a big miss?" Yes, I think PowerShell is a far more convenient REPL than Python's REPL. Than any REPL I know of, actually - within the boundaries of introspecting small simple data, PowerShell and .NET at least. And yet Python has set()-set() and PowerShell has [system.collections.generic.hashset[psobject]]::new().ExceptWith() (it doesn't return anything it mutates in-place) and every week, people post on the internet asking how to do essentially set union, intersection, subtraction and equality checks in PowerShell and the answer has been unsatisfying for decades.
- neonsunset 2y agoNowadays, WCF and even CoreWCF are frowned upon. Popular choices are gRPC, SignalR and JSON-RPC.
- jjkaczor 2y agoHeh... just wait until you get onto situation with a client machine/environment, open PowerShell and are faced with "Constrained Language Mode"...