5 ms·
There is nothing low ceremony in .Net. I recently ran through the entire ecosystem thinking that there must be something akin to Sinatra (micro web framework)
by rishav_sharan 6y ago
There is nothing low ceremony in .Net.
I recently ran through the entire ecosystem thinking that there must be something akin to Sinatra (micro web framework) in .Net. Nope. Every single thing is built on top of ASP .net.
I did find a WIP library where they are trying to go for a low ceremony framework https://github.com/featherhttp/framework https://github.com/featherhttp/framework, but even that is built on top of ASP .net
For me the worst bit about .Net is their treatment of F#. IMO, it is one of the most practical and usable functional languages out there. But none of the official docs have anything on F# at all.
Here is an example doc; see if you can find any code example for F#.
https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/sql?view=aspnetcore-5.0&tabs=visual-studio https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor...
Its always C#. And I have 0 interest in that kitchen sink language.
Between ASP.Net and C# being the entire world for .Net, I have really not much interest in using it for anything. There are plentiful of interesting languages and ecosystems that I can use for my small time projects.
- dfgdghdf 6y agoSuave is a low ceremony web framework for .NET
- rishav_sharan 6y agoI really liked Suave, but its performance I fear was too low to realistically use it for my project. Here is the last techempower for it; https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext&l=yyku7z-1q https://www.techempower.com/benchmarks/#section=data-r19&hw=...
- goto11 6y agoAPI's are the same for F# and C#, so it should be trivial to translate the code examples from C# into F#. Just remove the curly braces and change "var" into "let".
- rishav_sharan 6y agotwo problems here; 1. For a new comer to the language, this is still too much of a hurdle. 2. If I wanted to use F# only as a proxy for C#, then I would rather use C#. I want to write F# code in a functional first and idiomatic way. This is the stock answer I have gotten in the .Net Community and as someone who wants to use F# for web apps, its a huge turn off. There are pretty much no tutorials, no recent articles and no performant native F# libraries out there. There is no push from MS to improve the situation. and the community is like - This is fine! Expecting a new user to write c# code with "let" isn't going to fix that.
- piaste 6y ago> There are pretty much no tutorials, no recent articles and no performant native F# libraries out there. Giraffe [1] is the de facto standard F# web framework. It's a plugin on top of ASP.NET (for all the reasons described elsewhere - performance, security, ecosystem) that lets you write functional-style 'route >=> function' code without controllers. If you want a more batteries-included approach, Saturn [2] builds on top of Giraffe to provide, well, more backend batteries (database layer, etc.) Finally, the SAFE stack [3] are a set of project templates that combine the above with a F# frontend (via the Fable JS compiler) and some Azure deployment helpers. [1] https://giraffe.wiki/docs https://giraffe.wiki/docs [2] https://saturnframework.org https://saturnframework.org [3] https://safe-stack.github.io/ https://safe-stack.github.io/
- oaiey 6y agoF# deserves more love in their communication. Definitely. F# appeals to many, however, from a product management perspective (aka MS perspective) there is a ratio of 100 C# dev to 1 F# devs (MS showed statistics once on it). Also, F# is community owned to my understanding (up to the statement of a MS Research Employee and F# inventor Don Syme to say that the "Microsoft." prefix on ASP.NET Core are not open source community friendly) while C# is 100% design & developed by MS. Which - IMHO - makes it very delicate for Microsoft to communicate well here.
- pjmlp 6y ago
- oaiey 6y agoNancyFX was a Sinatra Port for .NET Framework. I belief the current .NET Core variant is called Carter. And for sure, they are all based on ASP.NET Core. ASP.NET Core is extremely modular which allows, e.g. a middleware stack like Sinatra being built on top of ASP.NET Core's Kestrel webserver (which ... cite once again Techempower benchmarks) beats everything nearby in the current situation. It would be a horrible choice to built a web server framework right now on .NET without using Kestrel. You will never achieve to get close to the performance of that.
- rishav_sharan 6y agoYeah. I want to be able to use Kestrel without using ASP .NET. Not very likely, but I think separating the two out would help the ecosystem a lot in the long run.
- oaiey 6y agoIt is technically separated out. Just shipped with .NET Core in a big framework bundle called ASP.NET Core (which is in all containers etc anyway). Look at the techempower benchmarks implementation .. they run as close as possible to Kestrel. They have variants with raw kestrel interface, some with low-level middleware (I guess with express like routing) and then full-blown MVC like comfort.
- rishav_sharan 6y agoThanks for the pointer. I will check it out
- mdpm 6y agoLow ceremony? Complexity in real world applications requires complexity in the frameworks that address them. Users will be more disappointed by simplicity that leaves them addressing complexity without guardrails, conventions, and tooling support. If your view of low ceremony is matching HTTP verbs to methods, you may happily code your own against the HTTP primitives; if you want a framework that abstracts the complexity and provides a shiny-happy path, you may have to allow for some ceremony. The tooling is the antidote to this. I think the place you trip up here is in not wanting to use a batteries included approach, while using a framework that makes the necessary abstraction/complexity tradeoffs for projects of mid to large scale. The appropriate tradeoffs _cannot_ be one size fits all. F#'s support is tricky, as the number of users here is dwarfed by those in C#; and although .NET supports this language diversity, there are no direct idiomatic 'conversions' possible between C# and F# in many cases. This multiplies the effort of providing documentation and examples. I too would like to see it treated as a first class citizen, and for that - the code is OSS.
- rishav_sharan 6y ago> I think the place you trip up here is in not wanting to use a batteries included approach, while using a framework that makes the necessary abstraction/complexity tradeoffs for projects of mid to large scale You have hit the core of my issue here. I am more used to the node-express or golang's way of working where you start off with the smallest and simplest scaffolding and then add on the bits that you need. Rails and ASP .Net are not something I want to use for my small time projects. Its probably unreasonable for me to expect .Net to be something completely different from what it really is, but I really hope that .Net grows up to enable other way of using it.
- manigandham 6y ago(ASP).NET is also like that. The default templates just include more to start with since the platform is designed to scale to many scenarios and features. You can trim out a lot. Take a look at the techempower benchmarks to see examples of different usage of the framework.
- jtdev 6y ago
- thrower123 6y agoYou could still use Nancy. It sucks a whole lot less than the pile of abstractions that have been built into ASP.NET lately.
- manigandham 6y agoYou can use .NET without ASP.NET. You also don't have to use all of ASP.NET either, it just comes with a full featureset and the default templates are configured for easy productivity. You can bind directly to sockets and write TCP responses using the fantastic memory and networking code, or use the robust Kestrel webserver to write low-level HTTP responses, or go up the stack and let it handle everything while you only deal with objects. .NET supports as much ceremony as you want to deal with.
- dustinmoris 6y ago> You can use .NET without ASP.NET. You also don't have to use all of ASP.NET either, it just comes with a full featureset and the default templates are configured for easy productivity This is only true in theory, but couldn't be further away in reality. Microsoft suffocates everything which is not built in-house 1), so there is absolutely no OSS ecosystem going on in .NET which would allow a choice of different non-ASP.NET web frameworks. Other languages have a wealth of different web frameworks and some are super basic and lightweight and others are huge with batteries included. You don't get that in .NET at all. Everything is ASP.NET Core, and ASP.NET Core is a typical Microsoft product - an attempt to build a one size fits all solution, the magic silver bullet to solve everyone's problems at once. Like with all silver bullets, when trying to please everybody you end up pleasing nobody. 1) Except F#. In F# you will find a more vibrant OSS community and non ASP.NET alternatives (most famously Suave), but only because Microsoft doesn't care about F#. Instead of creating an equal level playing field for C# and F# they are morphing C# into an F# hybrid and eventually will stop caring about F# even more than now.
- decafninja 6y agoI'd say it's the community that suffocates everything not developed by Microsoft, not Microsoft itself directly. It's probably a cover your ass situation, especially at the larger, more conservative, enterprise-y, non-tech companies .NET is frequently used at. No middle manager would get fired for suggesting to use a Microsoft developed & endorsed solution instead of using some hipster open source framework.
- 6y ago
- aggieben 6y agoASP.NET is pretty bare bones, all by itself. It's pretty much just a simple pipeline of request handlers with DI support (which is also optional). MVC, routing, Razor - all unnecessary if you don't want to use them. I agree that the ASP.NET documentation is lacking in F# code samples (although the example you picked is a bad one as Razor doesn't support F#, and so naturally wouldn't have F# code samples). You might find that Giraffe is a more comfortable framework, as it's essentially an F#-ified shim on top of ASP.NET.
- kinjba11 6y agoA lot of this thread feels like Microsoft's terrible naming having not surprising negative consequences. "ASP.NET" can mean so many things to so many people. To me it's usually a synonym to the full-fat MVC with controllers, DI, everything. This is reinforced by most of the dotnet templates and documentation, which make it feel like if you ask for a banana you're given a gorilla and the entire forest whether you want it or not. In comparison, if you look at Go you'll see the "net/http" package. It's the HTTP server. Extendable. Built in - not something to download from NuGet. Only does HTTP - not reinventing its own DI, configuration management, IIS, etc.