Making life easier for newcomers to the .NET ecosystem
liamsymonds.com
liamsymonds.com
But after the Net Foundation and hot-reload drama https://news.ycombinator.com/item?id=28779342 https://news.ycombinator.com/item?id=28897314 https://www.theverge.com/2021/10/22/22740701/microsoft-dotne... https://news.ycombinator.com/item?id=28972431 I can't really trust MS with anything open source anymore :( https://news.ycombinator.com/item?id=28968231
think dotnet (and especially F#) have a lot of low hanging fruit to make it more attractive to newcomers and easier to onboard.
The branding is honestly trash. I feel like if C#10 and latest .NET framework were renamed to something completely different and relaunched under some new company, we wouldn't go a single day without it gracing the front page of HN.
What % of developers are missing out based on principles alone? Microsoft is certainly an oppressive monster but they arguably produce some of the best tools in town right now.
Can you expand on this point? What tools Microsoft provides that are the top-of-the-crop right now?
At the top right of each window pane is a popup menu that let's you change the window mode, it's that simple.
I never felt I was lacking anything in stock Visual Studio and since my company won't pay for anything I never considered Resharper.
Fwiw I have Linux at home and trying Rider (I have used Android Studio before) I much prefer Visual Studio.
When I need to write advanced SIMD code, or consume C libraries like FreeType designed to be hostile towards FFI, I often make C++ DLLs to be consumes from C#.
Unlike Rider, Visual Studio is not just .NET IDE, it's a C++ IDE as well. The two debuggers are integrated too, it's easy to debug both C# and C++ at the same time.
90% of my use would be to open and read/write files, read from stdin and argv, regex, maybe some http requests and math no heavier than the occasional integral or limit.
There was much mention in this thread of the docs being out of date, referring mostly to older dotnet APIs. Also, by mentioning specific use cases, I was hoping - and got - very specific and helpful recommendations.
DotNet and C# works fine for all of those things, but it's definitely simpler to get spun up with a Python script for the quick and dirty. DotNet really shines as things get bigger and you need to have more structure.
For huge projects, that verbosity is what makes it maintainable.
https://fsprojects.github.io/FSharp.Data/library/CsvProvider...
So if you wait a few weeks to get full support assuming you want an IDE experience and not running everything from the console:
- if you want free (as in beer): Visual Studio Code - if you have a Jetbrains license or don't mind paying for one: Rider
About programming, most of the things you have mentioned (except integrals and limits) are in the C# standard library. Here’s a few tips.
Be sure to handle exceptions in your Main(). On Linux, I usually printing messages into `Console.Error` stream and returning a non-zero status code. Without the top-level try/catch in the main, unhandled exceptions crash the process with no information about what happened.
Set <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> compiler switch in all your *.csproj files. It causes the runtime to detect integer overflows and throw exceptions in runtime when it happens. It’s very useful to debug things (exceptions come with stack traces, if you keep the *.pdb files they will even contain source file names and line numbers), but I usually keeping the setting in release builds too, for a bit of extra safety. The performance overhead is negligible on modern computers.
About the I/O, use modern APIs, the usability’s better. For instance, when you need to read a text file line by line, call File.ReadLines() method, returns a lazily-evaluated sequence of these lines. Also, modern .NET supports spans pretty much everywhere and therefore you can read/write stack allocated buffers or unmanaged memory. Albeit depending on your use cases, stack allocated buffers might be a premature optimization.
About web request, the standard library has two HTTP clients, older WebClient, and newer HttpClient. For many use cases the functionality is equivalent, pick whichever API you like better. In both cases, I recommend their async-await APIs to make requests. The language supports async main for a few versions now.
I much appreciate the mention of catching exceptions. For my own programs I usually don't catch exceptions because I want the failure to be hard and informative. It seems that dotnet is the exception here.
Don’t abuse LINQ. It’s awesome, but I can only recommend for simple use cases. For advanced ones, too easy to screw up, and too hard to debug. When that’s the case, I’m usually writing a foreach loop instead, and/or generator methods. Also, when I do use LINQ I prefer the C# syntax like `seq.Select( x => x.something )` instead of the SQL syntax `select something from seq`. It’s a matter of taste but IMO compiler is doing too much magic with the SQL syntax.
A few years ago, .NET finally got what MS calls string interpolation. Good stuff, can recommend, I think Python has an equivalent for a decade: https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
Most articles on the internets view C# as an object-oriented language. That’s only part of the story. In the typical code I’m writing, at least 50% of code is pure functions (in FP sense) in static classes. And at least 50% of non-static classes are structures (these are value types, an array or List<> of them will keep items at sequential memory addresses, good for performance) with all the fields marked readonly, i.e. immutable types. .NET 6.0 even has record structs now, with automatic readonly.
It has tons of features missing for Windows development, debugging across .NET languages, C++, COM and WinRT.
Debugging of GPU code, parallel code, integration with mocking frameworks like Fakes, architecture modeling even for files without source available (code maps).
I know I don't.
Most people just responded by not using those APIs or recreating them.
VSCode kinda works (but also creates a launch.json file somewhere).
Rider just works. If it creates something somewhere, I couldn't care less (as I couldn't care less for any other IntelliJ product which tend to just work).
Also. Obligatory rant by Casey Muratori on Visual Studio: https://www.youtube.com/watch?v=GC-0tCy4P1U
I tried to install a previous version. It started installing, and then ... just failed. With no description of what failed, and how to deal with it.
So eventually I gave up.
WHat's launch.json and where is it described? And why can't it figure stuff automatically like Rider? And why does VSCode create a separate launch.json and why can't the two share the same one?
So many questions, so few answers.
Microsoft overall has a terrible naming sense, with occasional good accidents.
Just rip off JetBrains already.
I'd be curious to know why you feel that way? I've been doing .NET development for ~20 years (since the original beta) so it's hard for me to see it through a newcomer's eyes.
ASP.NET Core doesn't seem more complex to start with than any other web framework I've tried (most recently actix-web (Rust), Phoenix (Elixir), Django, etc.)
To be clear I have .Net experience going back to the beta frameworks in the early 2000’s and have hand held some huge products on the platform from inception to maintenance phase architecturally and infrastructure wise. It’s been a bloody rough ride and I regret every moment of it and wish I’d picked another platform bet. I’ve had the entire stack rug pulled from underneath major projects multiple times and burned months in pointless rewrites due to tech changes and obsolescence. The majority of the open source ecosystem is broken or abandonware and the commercial bits are overpriced, with poor support and barely work. It’s hell.
The only good bit has been being paid by the hour to unfuck stuff which has been profitable.
We're talking a lot about doing something for the environment, it could start with using "fast enough" languages.
Of course we need to find a compromise between performances and ease of use. So I wouldn't abandon .net core for Ruby or Python, but I would for something as performant (or better ofc) but friendlier to use.
But that doesn’t give me much confidence when it comes to finding out how to fix things that go wrong.
The Microsoft documentation is garbage, the worst I have seen. But the language and framework are good.
The c# language is now like an Indian train at rush hour. Busy and dangerous. Very easy to shoot yourself in the foot if you don’t know what you’re doing. LINQ and its contract breaking promises are a fun one for example. One interface returning IEnumerable<T> and you’re in big trouble when someone assumes the data is already materialised.
If you are referring to lazy loading, awaiting calls and ToList()..ing them solves that too.
I know I will get crucified for this, but that's what happens in practice.
I suspect Microsoft wants most developers to throw their hands up and just follow the "hook your app up to our $$$ azure authentication products $$$" tutorial.
The happy path for AspNetCore could be achieved if Microsoft started the entire conversation with "Here's a request pipeline and here's how you add middleware to it". Everything else is some form of abstraction on top of that. You can learn about how to do all of this 1 afternoon if you know what to focus on.
Once you figure out how to get at HttpContext with your services available in that scope, you have the rabbit entirely cornered. Relying on Micrsoft's middleware to do everything for you is how you get trapped in their puzzle box for all eternity.
It has a excellent server (kestrel), a middleware pipeline, routing system and common dispatching patterns like pages, MVC or minimal apis.
It is excellent in every degree of abstraction. Love the basics, go for kestrel. Work with http basics go for middlewares. Want to work with request and response principles and routes go for minimal API. MVC for a bit more structure. Pages for a traditional set. And Blazor Serverside if you love state.
All of this experiences are good.
I would prefer some examples what is bad here! And spare me DI.
Easy to make a simple endpoint for a tutorial, but after building any serious application the other language stacks end up hooking together several large packages and modules just to get the same standard functionality that ASP.NET provides.
In .NET I find that it's incredibly powerful when you know what you're doing. But there's just so much crap to wade through that I'm just thinking "why isn't this easier?".
The abstractions that .NET throws at you to start developing with it encourages developers to write their own applications as these crazy complex mazes of abstraction too.
Why can't .NET just be simple? Hand me a request with a Stream, give me a Stream to write my response to. That's all a HTTP handler needs to be, whether it's middleware or not. But instead it's just overwhelming.
https://www.hanselman.com/blog/a-net-6-minimal-api-todo-exam...
dotnet new web
then type
dotnet run
and you have a web app running.
If you'd like to edit Program.cs with notepad or w/e (the default text is below, which is incredibly simple).
var builder = WebApplication.CreateBuilder(args); var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
This is what comes to mind to me from GP's mention of crazy abstraction mazes.
For example, `AddMemoryCache() ` gives you a memory cache with the default settings - or you can change them by using the options argument. Request rewriting is really simple too, and even authentication is relatively straightforward.
I get what you mean about "crazy abstraction mazes", but thankfully over the past few years we've been trending away from the madness of ludicrous inheritance hierarchies that were sold as "clean code" and dogmatically hoovered up by junior devs (including me, once upon a time!).
I would agree that bailing on dogmatic 2000s OOP has been an improvement.
But app development isn’t a pretty place where time crunched developers are expected to carefully design complex data structures…..at all.
In fact there is more reinventing the well in go because all the std lib is just that… a library. When you need all the fluff around parsing routes, validating objects, preventing XSRF and a multitude of common solved problems, you have to reach for third party.
I also don't agree that one is 'reaching' for anything, since as soon as you interact with the broader world of interconnected systems, most of the first-party Microsoft things just don't work. They are almost all designed for their own standards that are too different or have to be manipulated too much to be compatible with something else.
Some things don't even exist like a basic Redis client. At that point even a highly experienced Microsoft developer has no choice but to get that non-first-party library.
dotnet tries to do too much by itself and that makes it annoying to use unless you happen to be building what it wants you to build.
I can admit that there are different ways of thinking and different styles for different people and teams and that .NET is a valid choice, and lots of decent software is built with it. But I've chosen to stay away.
I have done a lot of stuff in a lot of languages/frameworks, from electronics to desktop applications to websites and server stuff. Never cared that much about specific technology. It's fine if it gets stuff done is my motto, but I must admit that .NET is my go-to technology. Everything else I touch seems like a huge mess in terms of design, documentation, tools etc. I'm not saying that .NET is perfect, but at least someone spend some time on design before it's release and it has certain consistency that other projects rarely have.
FWIW, I did try to give it a shot with an open mind, but shortly after that project I decided I'm not accepting any more .NET work.
You can use C# .NET in a simple, non OOP way.
You can use F# in a functionaly style.
Nobody forces OOP upon you.
I use these languages every now and then, I just don't have the deep knowledge required to do everything effortlessly and I get frustated by things that people accepted as "the norm" on those platforms. Like the whole depencdecy stuff and node_modules blackhole in node.js, string handling in C++, weird Python syntax etc. People used to these platforms probably don't have an issue with any of this and accept it as a trade-off for some other amazing stuff on that platform that I don't know about and don't appreciate.
For example, I'm a newly minted C++ programmer as of 2 weeks ago - while the language is not that easy, my biggest struggle was getting everything to compile and link, and I felt like it's in a different class of difficulty.
Another example, while node.js/Typescript is often seen as an easy language, I remember trying to set up webpack+scss+typescript+react+styled components + a zillion other made me very sympathetic towards Mr. Cobain's life choices.
And another thing - I don't get the Microsoft is evil angle - I mean they are certainly no saints, but neither is any other FAANG company.
I feel like 99% of this is the historical perspective. If you dropped a totally new developer into a pure .NET 6 codebase w/ VS2022, I strongly suspect they would have a reasonable time of it.
IMO, senior developers who stopped following tech news are the primary reason the community has to struggle with this perception today. There are shops where legacy .NET Framework 4.x solutions are being spun up today for no reason other than ignorance has taken hold.
Arguably, the marketing disaster is still primarily Microsoft's fault, but I feel the community could do better with listening and adapting too.
I think because most of the features come out of customer request >> architecture plans.
As a result, you end up with a billion different weird behind-the-scene links and requirements that didn't have to be that way and consume unnecessary cognitive load when working with it.
I wish! 2 years ago we visited one of our providers and I soon discovered their solution was being actively developed on .net 3.5 and Visual Studio 2008.
To this day I still have to install .net 3.5 on our machines that use their software (.net 3.5 isn't installed by default on Windows 10) so I know for a fact they didn't upgrade.
I’ve just about mentally broken down, unable to use the pattern matching features, among other features.
That is, blogs, Stack Overflow, code examples, etc.
Most of that is the fault of authors, but presumably you don't want a 20 year .NET veteran to be the only person capable of writing a complete "Hello World"?
As a consequence, the new developer experience feels like the bad old Java days of "Oh, you want too foo? Well, that tutorial is built using the bar framework, which is incompatible with the nubar libraries you have on your machine."
Agree with another comment here that Microsoft needs to clearly cut legacy off + rename, in order to have a future.
At the start you can just translate all the basic C constructs such as classes/structs/methods/for loops/ifs etc. to their C# version (which is extremely similar in nature).
After that you can add C# specifics such as LINQ etc, but it's not necessary to be proficient in the language.
Online snippets of anything you search for invariably just works, I've never had an issue of something being outdated.
Ahh, finally we are told, this new release of .NET solves all the issues. Except when I try to do a simple forms based app with a drag and drop designer (something supported trivially decades ago) it's a constant list of errors, unsupported notices etc.
I'm serious. What's the quickest way to drag a button onto a form that when I click it will change a label text to "hello world" with the new .net desktop platform?
What some people don't realize how huge the .NET sector is (at least here in Europe). A lot of businesses and public services are running on Windows Server and their pace is glacial. Our company is still stuck in the Windows Forms world and slowly transitioning to WPF and even though .NET Core has been around for a while it's truly hard to move old code to the new world.
And UI is not the only thing, which hinders us. WCF for example or windows only components (registry or auth-things) are hard to migrate and sometimes require a whole rewrite of some parts. It very much feels like the python 2 to python 3 migration, but the with the risk of Microsoft completely abandoning the old legacy tech in a few years (while python 2 apps could still chug along fine, if you're not in the mood of upgrading).
I recently opined about the UI story on HN[0] and was met with a lot of 'who cares?'
Which is really unfortunate, in the process of making .NET 'Webscale' we completely forgot about the desktop workflows that brought so many into the language in the first place.
> What some people don't realize how huge the .NET sector is (at least here in Europe).
Yeah, a lot of folks here have no idea. I've come to realize it over the years (interacting with a number of very talented European .NET devs, seeing the variety of tech from Europe/Russia) but a lot of American devs really seem to have their blinders on.
Odd to note, of all the non-Microsoft OSS libraries I knowingly pull into my app, not very many of them have a US origin or majority of contributions from the US. IDK how much of that is mindset vs contracts (i.e. difficulty perceived or real to get approval to work on or make an OSS project) but it's something I've noticed.
> And UI is not the only thing, which hinders us. WCF for example or windows only components (registry or auth-things) are hard to migrate and sometimes require a whole rewrite of some parts
The biggest problem though is that there are -footguns- in upgrading. For example, if your old Web calls were using HttpWebRequest or an abstraction over it (like RestSharp,) all of the old assumptions about it not caching like HttpClient go out the window.
IDK if you tried CoreWCF, but it's a thing. (I have never worked with WCF.) I know it's limited though. I'll admit that I understand why Microsoft made some of these decisions around killing off certain technologies. I -do- wish they would have handled the process better though.
I think one big problem overall though is the community has in many cases not really 'stepped in' to fill these gaps.
This is not to detract from the people that are -trying-. But projects like Avalonia have had a hard time building momentum.
That's because they're mainly useful for people who want to make GUIs for Linux or OS X and/or use F# (with Avalonia.FuncUI).
File/New Project. Select Winforms App for .NET Core. A new form comes up. Click to Toolbox on the left. Drag a button to the form. Double click on the button to handle the click event.
It's that simple. No errors.
The only things I had to touch wasn't related to the graphic part.
But to be fair I wrote all the XAML by hand, I never build a UI with the drag and drop tools. I never manage to get the result I want with these tools.
And most stuff steers you towards the `dotnet new` CLI command to get started. Which I hate, I much prefer a .sln file from the get-go but maybe that’s on me. But it’ll get you a .NET 6/C# 10 .csproj in no time.
I ended up ditching visual studio and solution files though. Vscode and the dotnet cli are a good compromise and arguably more productive than trying to discern what some visual studio wizard just did to your code.
The churn is getting too fast as they start to get out from under the shadow of continued compatibility with legacy 4.X dotnet. When languages move this fast, the library and tooling ecosystems cannot keep up and you lose one of the greatest advantages that C# had possessed.
We have JetBrains Rider
The dotnet cli is an acknowledgement of the fact that an IDE is only part of the tooling story. Software toolchains need to be automatable and based on properly documented formats and conventions, not stuck behind GUIs and undocumented project files like it's the 90s (or, you know, you're Apple).
Once they're hooked on, they'll have to learn the details. I don't know if you're old enough, but Rails got a nice momentum with their 'Blog in 15 minutes'.
From my point of view, they are chasing the wrong carrot.
And since they now optimize VS templates for hello world, that code needs to be manually written.
But there language features i like
> And most stuff steers you towards the `dotnet new` CLI command to get started.
As a developer with 20 years experience interested in getting into dotnet now, what do you recommend that I start reading?`dotnet new sln
dotnet new console --output folder1/folder2/myapp
dotnet sln add folder1/folder2/myapp`
will result in something more like the new project experience from Visual Studio.
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-sl...
Everything else I've seen is very far behind Django/Python and probably PHP, Ruby, Go and Java, though I have less familiarity with those. Documentation and ecosystem certainly. EF as an ORM is a disappointment. Writing REST APIs is at least five to ten times as cumbersome and a lot more annoying. And I have to struggle a lot more to find libraries and support.
And it's not just a problem of being anti-Microsoft. Microsoft is running the show and can decide virtually anything (but not everything). You have to be Ok with that, whatever that means for you and your business.
The whole ordeal with the enterprise application structure was a hassle for me to begin with, but after some mentoring and guidance from a senior developer, it all made sense in the end, and I started to apply the same kind of structure in my Flask projects.
What is it that you found C# to be lacking in compared to what we're used to in the Python world?
Comparing .NET to Flask is much easier on .NET, since it doesn't have all those Batteries included and yet doesn't reap the benefits from an async/type annotation approach like FastAPI.
Also Django Rest Framework makes it a lot easier to get up and started.
I forget sometimes how bad and confusing it is because I'm still mostly using NancyFx, which has a much simpler and explicit way of defining routes.
There is another OSS project, Carter, that builds on the ASP.NET Core goodness, allowing you to define endpoints the same way as you did in Nancy.
How come? It's one of the few things I'm really missing since switching most of my development work away from dotnet. EF Core + LINQ give you type-safe and very compact queries. I don't think there's anything similar for Hibernate, for example: there is JPA Specification API with metamodel generation. The idea is very similar, but with much more boilerplate.
1. Type safety/refactorability
2. Composability (can I reuse my queries)
3. Expressivity (can I generate the queries I want)
Of these, EF only solves the first, which is far and away the easiest of the three.
Composability in EF is possible via expression tree splicing, however it requires such a degree of discipline and insight that I have never seen anyone do it, or even any discussion around it.
Like almost everything in the .NET ecosystem, EF makes a bunch of promises that are fantastic for hello world, but are disastrous as your project grows.
To be clear you can get a long way by abusing EF's willingness to try and interpret arbitrarily complex expressions - it just provides zero tooling or guidance on how to build those expressions.
Or projections. It's possible to write a reusable projection for EF like so:
class MyTableProjection {
public static Expression<Func<MyTable, MyTableProjection>> Expression =>
t => new MyTableProjection {
Id = t.Id,
Str = t.Str,
Flag = t.Flag
};
public int Id { get; init; }
public string Str { get; init; }
public bool Flag { get; init; }
}
dbContext.MyTable
.Where(...)
.Select(MyProjection.Expression)
.ToListAsync()
But I have never seen anyone do this because it breaks the promise that you magically won't have to write any code or abstractions.[1] https://github.com/scottksmith95/LINQKit [2] http://www.albahari.com/nutshell/predicatebuilder.aspx
Re: Composability
You can generate something like the WHERE clause of a query in a function and return it alone (rather than as a SELECT query) or even combine it with another WHERE.
e.g. In SA the "select" and "where" portions aren't tightly coupled.
Re: Expressivity
Right now you can easily build up ef.core queries by chaining IQueryable.Where, which is nice but you can only do that for selects and something like OR conditions are difficult to implement.
e.g. in SA you can just pass a list of predicates to the or_() function.
e.g. in SA you can build a WHERE clause and then pass the same clause to a select or a bulk operation.
This means we will probably never get: 1. Ability to pull non entity types out of the database without a whole lot of boilerplate. See the bizarre obstinacy here: https://github.com/dotnet/efcore/issues/10753
2. Any kind of bulk insert/delete/update ability. It's been a "to do" for years now.
3. Much better query composability.
Basically their response is to just use raw SQL for anything that isn't a unit-of-work feature. They're missing a lot of benefits that a ORM could provide when they say that.
The ef.core team feels like a lot of rejects that were stack ranked out to their own team. I know that is mean to say, but they iterate extremely slowly compared to teams like asp.net .core, visual studio code, c# language group, f# language group.
But Go has a philosophy of minimal baggage, which is quite the opposite of C#. If that means you can't build a decent ORM, maybe you either don't need an ORM or Go isn't the right fit for that project.
( I'm using code first fyi)
DRF is much more convenient.
Here's a scaffolder as an example if you want to automate things like that: https://github.com/ArmandJ77/CQRSAndMediator-Scaffolding
You need to add the correct attributes to your class for form validation ( eg. Required / StringLength )
Then scaffold a MVC controller or an api controller ( It will add the class to your DbContext)
Then add-migration / update-database for your migration.
And it's done
Autogenerated migration files that you don't need to touch and 1 class to describe the model + 1 auto inserted line in the DbContext
Python: which version again, PHP: good luck not doing a kind of injection, Java: Beans? spring? Maven? Gradle?, JavaScript: which 30 packages are currently best of breed, ...
Maybe Ruby. Rails killed all competition.
Ignoring all what I said, the .NET documentation is definitely worth to improve on the aspect of current versus past state. They should color code it :)
.NET is bigger than Microsoft in some ways. The recent kerfuffle with the .NET Foundation shows that.
Please, Microsoft: invest in marketing, especially to corporations who don't know anything about the tech stacks they use. They need help understanding why .NET 6 is so amazing and why .NET is no longer .NET Framework + ASP.NET Web Forms + IIS.
While being negative press, this article is for the most part right.
Well, because MS didn't screw that (5.0, I don't know about Core 3, haven't been a .Net user at that time) release up. The Net devs inside of MS also didn't, well, appreciate these actions.
But what would be an example of a wrong negative article or comment about 6?
Nothing on .NET 6 is a screw up. So there is no change regards .NET but the mood changed.
Sorry about the wrong articles ... I broke edit that. I was just disappointed by the commentary.
Yes, it's this. The whole removal of the hot reload from CLI got HN in a tizzy
Their biggest gripe seems to be that Rider's default templates still have old references, and how they "might" follow a tutorial incorrectly that might not work and dishearten a new user so much they give up on the whole language, all the while overlapping the definition between ASP.NET and C# (which of course, could be improved, sure).
I don't really view the new dotnet core/5/6 platform as very stable, not when they are still releasing this often and making breaking changes.
Result: less cloud costs by better performance, capability to run on Linux, lambdas, containers and ability to stay fresh and not turn into Cobol.
I understand where you are. I also have to explain my manager ongoing costs for upgrades. Not only for .NET bit every part of the stack. Luckily we have cyber security as an ongoing excuse.
The name has enough history, it's better to focus on what can be done to improve the ecosystem than worry about a 20 year old name.
I think that absolutely matters a lot for the health of an ecosystem.
> The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995".
- Install Visual Studio Code (you probably have it already)
- Install Ionide extension
- Create a new `.fsx` file
- Start writing code :)
This is by far the quickest way to build something simple on .NET. It doesn't even require a package manifest to pull in dependencies.
And it works on all major platforms.
- dotnet new console
- VS Code
- Install C# Plugin
- Start writing code
- dotnet build
Also works for the big brother C#
edit: one more qualm, the Mockito equivalent for C#, NSubstitute, cannot mock a concrete class, only an interface. This meant that every C# project I encountered was littered with pointless interfaces that had a single implementation, that only existed because of NSubstitute usage in the testing. This seemed to devolve into C# devs writing an interface for damn-near everything out of habit. I'm talking about writing an interface with getters and setters for a POC#O. I still get nauseous thinking about it.
edit: turns out I have a lot to complain about on this Monday! I pray for anyone living under the tyranny of Stylecop rules, which will fail your build if you put a public static field below a private static one, but for some god-forsaken reason cannot actually fix the problem for you.
I've never heard of NSubstitute (that doesn't mean it's bad), but most places I've worked at typically use Moq (https://github.com/moq/moq4) which does support interfaces and classes.
I am still not sure which I need (...or both?) but either way I managed to get neither Visual Studio nor VS Code to get any code to run or compile! I downloaded and installed both SDKs but both failed to work at all - it seems there is some invisible thing configured somewhere (Windows registry? certainly not in the hello world source I was trying to write) that points to the SDK version to use, and neither the .Net nor .Net core SDKs I downloaded appeared to be the correct ones and everything chucks up error messages about the wrong SDK or missing MSBuild (whatever that is), despite just following the tutorials to do `dotnet new`. Very frustrating.
It has certainly put me off trying .net now. I wanted to migrate off of golang for my future cross-platform work, but this has really put me off - if I cant even get a hello world to work after a clean SDK install, I can only shudder to think about what the runtime dependency hell is going to be. Real shame.
Note, dotnet 6 only works on VSCode or VS2022, older versions of VS don't support it, so you'd have to drop to dotnet 5.
The trouble is that you can still write code in the original language, e.g. don't use the elvis operator or Linq or '?.', which is what is likely to happen if you write a lot of code in other languages too - C++, Java, Kotlin, Python, Javascript. There's a common 'subset' language in all of those that's easy to carry mentally from one to another.
One thing that Intellij/Kotlin has is that if you write "old fashioned Kotlin", there are a lot of IDE inspections that can convert that "old style" code to sort-of idiomatic Kotlin.
Its infuriating. Give me that C# approach any day.
VS debugging is a bliss. immediate window: god sent.
Does VS crash five times per week. Yes. And it sucks every time. And do I swear upon my late father's grave I will migrate away from .net and devote the rest of my life to destroying MS? Also yes.
Then all of a sudden a critical bug is found in production that I can reproduce perfectly, locally, and fix seamlessly and I forget about my mission.
Well, it was nice of the Windows side to wait for the .NET6 launch before stealing all their headline thunder by going back to the 2001 antitrust behavior of forcing the use of Microsoft's own browser. [1]
[1] https://www.theregister.com/2021/11/11/latest_windows_11_bui...
MS took control of javascript community in through typescript and npm. Now most of companies want typescript guy doing frontend in react/angular. Added already one more abstraction to already complex JS ecosystem.
I have used Python recently. It felt like breath of fresh air. Plus IDE are really smooth.
I have nothing against dotnet/C# as language. Its ecosystem that tightly controlled and criticism is shot down quite literally. All important libraries in MS world are locked behind paywall unlike Python, Java, JS, ruby communities. This scene has changed in recent years, but quite it was like that before 2018. Like PDF generation, SSO libraries, tools for profiling.
Anyway I personally think that dotnet should not be once first language/entry into programming career. You will miss innovation open source ecosystem and will be behind for years than your other language peers.
Also dotnet job market has lot of issues, good paying job are required you to either maintain legacy system in SOAP/XML, webservice and what not. Not much of vibrant job market for dotnet i would say.
Apologies for rant.
I suppose you need Entity framework and linq as well to make a full application.
I have used .Net since the pre Alpha 1.
The consulting company I worked for needed X number of consultants certified on this new platform thing so they picked a few of us and said that this .Net thing is now us, run to get certified so we can have our super triple gold star parter relationship.
My background was C and C++, Delphi, some Java for the past year.
So now I was ordered to be a .Net guy. Yay.
A couple of days ago Microsoft officially released C# 10 and .Net 6.
I like reading books, I had preordered
Pro C# 9 with .NET 5: Foundational Principles and Practices in Programming 10th ed. Edition by Andrew Troelsen
It came out May 14, 2021, which is around 6 months ago.
The new version for C# 10 and .Net 6 will be released around May in 2022 about 6 months from now.
It is not just small changes either. If you know C# 2, there is a lot of code you will not be able to understand in C# 10,9,8.
Sells books, blogs, ads, conferences, where people who have spent 4 weeks with a beta version, teach you how to be a master C# developer with C# 10.
To be a "good"/"up to date" C# developer, who does not bring in all the "old stuff" from 6 months ago you have to spend time reading blogs, downloading alpha and beta versions, and keep track of what MS promised would be in the next release and what never made it. The "oh its new, shiny, shiny, shiny".
I like to wait for a proper release before I spend any time on it.
I still have my 2nd edition of C Programming Language K&R from 1988. It is still relevant and informative in 2021. (It is also well written).
It is impossible to master a programming language and framework that is a constant moving target.
Many programming languages are able to be both useful and produktive without being stuffed with new features of keywords and convention every 12 months.
Right now, there is not a single programmer in the world who has mastered C# 9, certainly, none for C# 10.
Oh there are a lot of bloggers and fanboys who have -used- C9 maybe even C# 10, and who make $$$ writing, speaking, consulting etc. But using and mastering are two very different things.
So please, wait 5 years before the next version of the programming language is pushed. If there are crucial bits you have not been able to get right in 10 version of a programming language, taking a step back would be a great idea.
Not sure how it can be any easier than gcc main.c && ./a.out
I think the dotnet approach is definitely preferable for real projects, though. If you want to get a script done in Python then that's quick and easy, but if you need to manage dependencies, you run into the exact same pattern.
Whether it's cargo new, python -m venv ., npm init or whatever incantation Java developers use, all these toolsets are pretty much equivalent. With IDE support (Visual Studio is great, VS Code works) the entire experience becomes much better.
You can't run a quick "helloworld.cs" without creating a project, but I don't see that as a problem per se. In practice, C# isn't built for scripting so it doesn't make sense to optimise the toolchain for anything but a project approach. If you want dotnet scripts, run Powershell, that's what it's good for.
The most annoying part about dotnet is the setup, specifically ensuring that telemetry is off. Microsoft insists on an opt-out, and leaves it up to you to figure out where to put the environment variable to disable their stalking. Other projects such as Flutter have the same problem.
Running `dotnet new` is optional, it outputs a template "hello world" program source. It's a "yeoman" kind of tool.
I can't think of any language (python or java included) that works without at least 1 line of source code present.
I'm not too familiar with Java but DotFX is an official project that builds a static HTML website from your source code comments.
I need to complete the full guide at some point but the end result is an application deployed on Linux with both a web app and independently scalable crawling services with zero downtime deployments. Hosted site here: https://pricefalcon.me/
For a simpler deployment without k3s, this guide is the one I originally followed for my trends site and should still work for .NET 6. https://www.hanselman.com/blog/publishing-an-aspnet-core-web...
I've never needed .NET libraries in my code, and never have seen the point, it always breaks, and seems to add orders of magnitude of bloat.
There's no real need for it, can't the rest of you skip it as well?