3 ms·
What is the criteria for chosing a framework vs implementing using language fundamentals? I don't care about one over another, but I would prefer if all exampl
by alganet 2y ago
What is the criteria for chosing a framework vs implementing using language fundamentals?
I don't care about one over another, but I would prefer if all examples followed the same approach. It would make the comparison more valuable.
- MortyWaves 2y agoI wondered this too. Personally, as someone that enjoys using C# a lot I was somewhat surprised it's example went with a plain HttpListener like that. But, that seems to be the general theme of all the examples there. Personally I think a more real world method would have been to use the most popular web server framework for the given language. Someone else already commented that the Swift example would never do it this way in a real application.
- cpfohl 2y agoSame thought! Python uses FastAPI. C# with ASP.NET looks similarly terse, and ASP.NET is “built in” (kinda). var app = WebApplication.Create(); app.MapGet("/people", () => new[] { new Person("Ana"), new Person("Filipe"), new Person("Emillia") }); app.Run(); record Person(string Name); The above (struggling to find the backtick on my Mobile keyboard) is straight from the ASP.NET website: https://dotnet.microsoft.com/en-us/apps/aspnet/apis https://dotnet.microsoft.com/en-us/apps/aspnet/apis
- neonsunset 2y agoFor some reason the repo uses outdated Mono (which is limited to ancient .NET Framework APIs and old C# version) which could be the culprit. In any case - https://github.com/begoon/http-server/pull/1 https://github.com/begoon/http-server/pull/1
- brabel 2y agoIt seems that the line is drawn on whether it's possible to do HTTP and JSON using the stdlib without having to write a HTTP message and JSON parser. For the cases where JSON is not in the stdlib, they seem to just use a library. But yeah, that makes the comparison less valuable because ALL languages could have used a library that lets you do the equivalent of the Python version. But it's still valuable to know which languages support this out-of-the-box, perhaps.
- ericcholis 2y agoI was wondering this as well. The Python example almost felt like cheating with FastApi....but I suppose it's also pythonic.