As a new developer people tend to steer you towards Python or to an even greater degree, JavaScript.
I know this to be the case because I’ve done this myself. But I think I’ve had a change of heart.
You see the barrier to entry with JavaScript is VERY low. Technically all you need is VSCode and a Web Browser. Both free and bot available on almost every OS.
Tip: if you setup VSCode in the cloud like I describe here:
you can literally code on a tablet.
When I was first exposed to Microsoft and dotnet back in 2004 there was an extremely high barrier to entry. You had to have a MSDN subscription, (which was $3000-5000 per year).
But today Microsoft has really changed their tune. You can get a free community edition of Visual Studio, you can sign up for the free tier on Azure and even DevOps is free up to a certain number of users.
Windows 10 is more open than ever, dotnet is cross-platform, etc. So what is the barrier to entry like now? I would say it’s about the same as with JavaScript. You have a choice of free IDEs and free hosting.
So now this is where people argue that “JavaScript” is easier to learn. But is it though? I’ve spent a lot of time with both and I have to say that the learning curve with C# might be just a little bit steeper but once you learn the basics you can advance at the same rate as someone learning JavaScript.
One thing that I had forgotten about since I hadn’t done a great deal of dotnet development in almost 5 years was how much the IDE assists you. I can create a Model with 20 properties in about 10 minutes. The prop
snippet is your friend.
I never really feel at home in a JavaScript codebase but I dove into a fairly complex ASP.NET backend project recently without having done much in over 5 years and everything was still accessible to me. I still had the muscle memory.
I think one of the Pros (though it could be considered a con by some), is the fact that the C# language itself doesn’t seem to be evolving as rapidly as JavaScript. It’s more “mature” if you will. Maybe that has more to do with the fact that its highly structured.
One of the things that struck me as funny when I came back to dotnet was the fact that if you search online for how to do something the C# code snippets you find are going to be fairly similar. Whereas, with JavaScript you can find 100 posts with 100 different ways to do things.
I think a lot JavaScript development is, “let’s see how clever I can be” instead of, “let’s see how readable and robust I can make this.”
These are my personal opinions and I’m sure this “hit-piece” is going to cause some controversy but I think if you commit to taking a look at the “new” dotnet you’ll be pleasantly surprised.
Thanks for reading and that's all y'all.
Top comments (39)
Ignoring node and demo which are js on the server, and blazor which is C# in the browser (via webassembly) they are solving problems in different parts of the stack so I don't see how you choose one over the other. Also it would be more appropriate to compare C# to Typescript as both give you static types and type checking. My biggest issue with C# was the number of using statements required to achieve even the simplest of tasks. For example simply connecting to a SQL database requires about 20 lines if code to import and set up the connection protocol.
20 using statements vs 20,000 node_module files? 🤔
Ah yes, but I don't need to know WHICH 20,000 mode_module files :)
I can't remember the last time I had to manually add a using statement with Rider, or really with most any modern IDE. They just add them for me.
And I don’t need to know what usings I have. If you place your cursor over the red squiggly then hit CTRL+ . It will add them for you. 😂
Yep. I use rider too. Or you can use Resharper. And I don’t know if it’s still around but there issues to be Visual Studio Power Tools that added usings.
With JavaScript you can use the fetch api but it sucks and almost no one does so you ‘npm install’ axios and then add an import statement. JavaScript doesn’t have good date time handling so you ‘npm install’ date-fns.
Would you like to see how many import statements I have on my current JavaScript project?
There are several files with 30+ imports but the average is about 12 per file.
Now with Blazor all of your front-end usings can be put into one file and you can maintain them there.
And I’m not sure what you mean here. You say that C# and JavaScript are “different parts of the stack” but I can build a front end with JS or C#. I can build a Mobile app with JS or C#. I can build a server with JS or C#. I can build a game with JS or C#.
How are they different parts of the stack?
I think the poster meant to say that C#, and (vanilla) JS are not really comparable, because C# is statically typed so a better (Apples to Apples) comparison would be Typescript v.s C#. But in complete fairness, you're not entirely wrong. They (C# and JS) can accomplish the exact same end goal. You can make a mobile app with JS or C#, you can make a backend server with JS or C#. So the overall functionality of what your trying to accomplish would still be the same, aside from the language differences.
So why wouldn't they (C# or JS) hold the same spot on the stack? Maybe I'm confused sorry. I apologize.
I wasn’t comparing them. I was saying that instead of starting with JavaScript you could start with C#.
Traditionally JS is used for browser / client side interactivity and data manipulation C# is middleware and intercepts the HTTP GET/POST calls and does something with them. The lines are more blurred now becase you can run JS on the server in node, I am not aware of a native implementatin of C# in a browser. You can compile to web assemby but that is a different topic altogether. JS is front end code, C# is middleware
LOL. Blazor is C# running in the browser using web assembly.
+1000 for C# readability. When you see code like this in Javascript, you ALWAYS need stop to think:
console.log(false == '0');
console.log(null == undefined);
console.log(" \t\r\n" == 0);
console.log('' == 0);
Some can say this is a language "feature", IMHO this is a critical failure for a language. Compare this with features line C#'s LINQ that turns loops in lovely readable things. I hope Blazor WebAssembly be successful then I will never need look back to javascript again!
And forget about stuff like
[] + [] = ?
{} + [] = ?
[] + {} = ?
0.1 + 0.2 = .300000000000004
1+2 = 3
1+2+3 = 6
1+2+3+"4"= "10"
Stones and glass houses.
Other than that it's just the usual IEEE 754 weirdness.
What Every Programmer Should Know About Floating-Point Arithmetic
JavaScript's sin was to base its core numeric type entirely on a floating point representation.
PS: And how well do you think will a client-side Blazor app be running on something like a Moto G4?
Don't get me wrong, client-side Blazor will be a boon for MS shops for implementing internal enterprise web apps - but the public web is about reach and that means dealing with the lowest common denominators in terms of client device computing power and connection quality.
As it is the current JS ecosystems will need to go on a serious diet to keep the web relevant.
Web assembly is fast but has a huge file size so the initial load will take too much time.
JS is designed for the web so the animations will be a lot easier with JS, I think there are not so many libraries for blazor or community support to do hard parts of animations.
Other UI can be done by CSS and HTML, and interactivity also can be done by js. using typescript will make the work easier.
Checkout: Framer Motion, GSAP
Pro Tip:- Use snowpack as you package bundler, there is no npm install needed. It streams npm imports from remote CDN and cache forever.
Huge file size now. But is it really though? I think now it’s 2.4mb which is large but that only has to be downloaded once. And the file size is getting smaller. I heard that some of the experimental branches have it down to 100k.
2.4 mb is also huge, preact project is 4kb + your code size i.e ~40kb
Webassembly is designed to do low level computations on the web, so better usecase will be making apps like video editor, photo editor, ml projects, etc.
For frontend you can't just replace JS, its the only language for frontend capable for doing backend too
I disagree. The size is coming down.
It's new, it's just going to take time. Most JS based projects area about 3.0mb total including images so this is not that bad.
yes, I agree but the bundled size is >1Mb in js projects images are excluded.
Images are served via CDN so they cant be count in project size, we are talking about code here.
I built many projects, each has source code less than 200Kb which is less than 1.6MB
WASM is a great language, it is fast and safe too.
It is meant for making Web Apps whether SPA or PWA, It is not meant for making websites. Smaller SPAs can be made in JS or WASM but WASM is recommended for larger projects where speed matters or security needs.
WASM can do cryptography, cinematography, Hashing, video editing, sound manipulation, ml projects, browser games, etc. It does all the low-level computations for you and gives you lo level hardware access.
These things are not required in a simple website or web app
Its real-life example is Figma it uses WASM with JS
Now you’re just being shitty and pandering so I’m not going to engage with you anymore.
Do you REALLY think it’s necessary to point out that
200k is less than 1.6mb to someone that’s been writing software since 2004?
🤡🤡🤡🤡🤡
I love both :) on our current project, we use C# for the backend (.NET Core API) and Angular/Typescript for the Frontend, and it has been a great DX. I know technically Typescript is not Javascript, but if you're coming from the C# world, Typescript makes so much sense, both being born from MS, they share similar principles. VS Code is just an excellent IDE for both (Omnisharp and EsLint are great extensions for this).
Vscode is awesome 👌
I don't think your first language really matters that much. I started with JavaScript but landed my first paid gig writing C# with Blazor and can now pick up new languages pretty quickly because I learned the core of programming.
Until I got this gig, I had never even considered C# as a viable option (MS historical baggage) and while the transition was difficult, I actually found myself pining for the readability and static typing of C# (and LINQ of course) when going back to writing JS.
I think the only time that your first language matters much is when you know exactly which path you want to take in your career. For instance, if you are set on being a front-end dev, it is a no brainer to learn JS first. If, on the other hand you want to work on the backend, JS may be a viable option, but there are also plenty of other options available.
If I wanted to learn web-dev specifically in 2021, I would actually suggest a different approach from most other people (and one that is likely very controversial).
I would first suggest picking up the basics of HTML and CSS including becoming very comfortable creating forms. Then, learn some basic PHP to handle form submissions and DB persistence (I suggest this because it is very simple to set up and teaches the core principles of HTTP requests and the relationship between server and client).
Once you are confident submitting form data and persisting and retrieving data from the server, next start to pick up some basic JS to learn how to override form submission default behaviour.
At this point, you can now create full web apps and will have a good understanding of the HTTP protocol as well as knowing enough SQL to be dangerous. This is not a trendy stack by any means, but there are a huge number of jobs out there so you could quite easily get a full time paid gig knowing just this which would allow you to spend your free time diving into other, more trendy frameworks and languages to build atop your core web stack knowledge. Knowing these basics, would also mean you could pick up pretty much any modern MVC framework and get up and going without too much of a learning curve (Laravel, Rails, .NET MVC etc).
I personally think there is too much emphasis put on programming language minutiae rather than learning enough to be productive and employable (I should know, I was programming for 6 years before going professional).
I realise, this has veered away from the topic a little but hopefully someone out there can glean something useful from my comment.
yeah, my whole point was that in my eyes C# is a viable option for new developers. 5 years ago I would have never recommended it as a first language simply because of the cost. JavaScript is free. Back then you had to have an MSDN subscription to get a version of Visual Studio that you could install plugins into.
¯_(ツ)_/¯
Yeah, I agree with you, I just went off on a bit of a tangent about mildly related things :)
I think C# and .Net are awesome options for a beginner for many reasons. There are also a myriad other languages that are perfect for teaching core concepts like OOP etc.
I think the main point I was trying to make, was that so much emphasis is put on language minutiae such as NaN === NaN in the beginner community rather than a focus on teaching programming concepts that are language agnostic. As such, the choice of language itself shouldn’t be the main focus, but what you are using the language for and the broader concepts it teaches you.
I find that Tim Myers made a very important point.
"One of the things that struck me as funny when I came back to dotnet was the fact that if you search online for how to do something the C# code snippets you find are going to be fairly similar. Whereas, with JavaScript you can find 100 posts with 100 different ways to do things."
C# is so well structured its good that there is only a few ways of doing something. Being in this industry, I feel its not really about how easy it is to use a language, its how easy it is for others to read your code. And C# is good for that, no real surprises in code where u need to pause and think what this function does as their naming conventions are all solid.
Yes exactly, if you look at my JavaScript code you are going to be confused. It seems like with JavaScript a lot of times I'm trying to "make it work".
With C# there are only a few ways to do a particular task so if you and I sat down and were asked to write a simple controller with GET, POST, PUT, and DELETE verbs. Our code would look similar.
But if we did the same in JavaScript maybe you use axios and I use fetch, and our code would no doubt come out looking quite different.
All I can say is that as a C# developer, Microsoft has me all pampered ( 0 w0) ♥
Their development ecosystem is really good. You only need to download VS and that's it, I can do a bunch of things with it! Games, websites (with javascript or any of those trendy frameworks), mobile apps, desktop apps, etc. Also, Azure DevOps is a great tool to manage projects and Azure itself is really good as well.
I'm quite happy as a C# developer c:
Personally, I feel c# is one of the best designed languages.
I agree, although I havn't used it for many years. Unforunately for the foreseeable future there is no getting away from JS for the front end. The major frameworks make it easier by applying some design constraints, but in the other direction Nativescript, React Native, Quasar/Electron and Ionic now mean that JS is becoming more dominant in user platforms that are not Chrome. Unless wassm gets a good run out in 2021/2022 JS is still going to be the dominant force despite its fragmented ecosystem
No there’s not. But you can always specialize in C# and pickup JavaScript or TypeScript when you need it.
My post was more about the fact that if you’re a brand new developer you don’t have to DEFAULT to JavaScript anymore.
I know nothing about JavaScript (other than it's the slow black-box in our projects), but for a quick overview of changes in C# releases check out: docs.microsoft.com/en-us/dotnet/cs...
9.0 is elsewhere but limited to .NET 5.0.
There might be a few quality of life changes you don't even know about!
I’m using .net 5.0 😂
My biggest attraction to C# and Azure is Microsoft has really useful documentation.