3 ms·
I don’t have any problem with the idea that .net is a fast, capable, modern language suitable for many purposes. But I had to laugh at their example that “crus
by jmull 5y ago
I don’t have any problem with the idea that .net is a fast, capable, modern language suitable for many purposes.
But I had to laugh at their example that “crushes” (why the embarrassing phrasing?) node.js.
Why, returning plain text is as simple as declaring a private “PlainTextActionResult” class that implements the IActionResult and the IActionResult method ExecuteResultAsync, creates an HttpContext.Result, sets the status code symbolically and the content type textually, manually calculates the content length, and returns an asyc Task object!
“Crushed it!” (with Enterprise-y code).
- Merad 5y agoWhoever wrote that code either doesn't know the framework or perhaps is doing a custom implementation for some performance optimization. All you need to do to return a plain text response from an action method is `return Content("text goes here")`
- kumarvvr 5y agoTry building a serious app with node. Its a pain to build and maintain. In .net, you can have teams of people working on business logic DLLs, Data Access DLLs and have a few person team tie them all up in a web app. I hardly think that is possible in node. All the enterprisey things in .NET are a god send in a 10k loc web app with solid debug and profiling capabilities. And all that will save you time and money. So many developers try to compare the structures of different stacks based on "hello worlds", whereas, the actual issues crop up in actual web development.
- karottenreibe 5y agoWhy do you believe the same thing can't be achieved with packages in node that you feel is so useful for multi team orgs in your DLL scenario?
- jmull 5y agoWell, I have. With both .net and nodejs. They both do the job fine (you mention 10K LOC, but I’m not sure that you mean because that’s still comfortably tiny — a one-person app at most, where pretty much anything works.) In my experience they both scale just fine. Your limiting factors are much more defined by your app architecture, dev group politics (as reflected in response to management), and what I’ll call your dev workflow process (how many minutes is it, between when you as a dev make a final, correct source change, and the change makes it far enough that another person can see and evaluate it in the software?)
- draw_down 5y ago
- keithnz 5y agoerr, super easy to return text, if you haven't used .NET for a while, this is the minimum program to return text via the end point /test var app = WebApplication.CreateBuilder(args).Build(); app.Map("test", () => "hi there"); app.Run();
- jmull 5y agoOf course. So why the tortured code for the performance test? Click through to the link to the code. BTW, the link is a screenshot of the code, but that doesn't happen to show the ugly part. Could be shenanigans, could just be a minor stupidity. IDK, but it doesn't fill me with confidence in the article's general message.
- keithnz 5y agoFrom the looks, they just made a controller to return various mime types of responses, for the text they have made their own custom HTTP response, my guess is because there is no default serializer that produces text/plain (given there is no real standard for serializing into plain text)