Hacker News new | ask | show | jobs
by driverdan 4378 days ago
Serious question: If you're building web products from scratch and can choose your environment why would you use .NET (other than "because I know it")?

I've personally never used it because I'm opposed to closed-source single platform languages / frameworks and would like to understand the mindset of those who use it.

3 comments

1. c# is a great language - LINQ and type inference make it as succint as python (or even more when I use extensions methods and generics!), static type system gives a lot of safety eliminating huge classes of bugs, decent performance compared to other succint languages like Python or ruby. Really hits the spot for me, and I would hate to go to a dynamically typed language now.

2. VS is a great IDE if you give it enough RAM.

3. LINQ2SQL makes for quite pleasurable, succint and type-safe database manipulation. Bulk updates suck though, but that's an ORM for you. SQL is also a good database, and when time is right I can make use of remote database mirroring, instantly boosting my fault-tolerance. I could use Postgres as well, but SQL tips the scales with LINQ2SQL.

4. Reasonably popular, compared to web dev in other succint statically typed languages say, Haskell. So I can find answers on stack overflow.

5. Nuget. Sometimes I need a commercial package, and I can often times just get it from Nuget, play with it, and then punch in serial number after paying to remove watermarks etc. It's nice to have those packages for when I need them, to be able to buy my way out of problems.

6. Backward compatibility. I heard that ruby was breaking it more than once and python did it once. .NET seems to be less prone to this.

And I really see no downsides to it. Windows is only 20% more expensive on AWS, and hosting is literally the last on my list of expenses. Performance is good enough for me - given my business model I will be able to afford a small data center before my single Windows server gets too small for my workload. VS is slow, but buying extra RAM is a small price to pay to get it up to speed.

On AWS booting Windows can easily take 10-15 minutes. On the same type of EC2 instance, it takes 30 seconds. This makes auto scaling quickly very difficult because you have to scale up in anticipation of demand rather than as it occurs.

One other problem is that Windows by itself easily takes 1+ GB of RAM whereas Linux can easily run 64MB-128MB. So while Windows may only be 20% more expensive for similar hardware (which I don't object to either), I can run cheaper hardware and have more of it available to the application instead of the OS. Our metrics show the savings to be about 60% less expensive when counting hardware and licensing costs.

The boot time is annoyance, and resource hogging is unfortunate, but I can easily buy my way out of those problems by buying bigger machines and doing it in advance. My time is more valuable, I think, and server costs are negligible next to payroll. There are business models where hardware costs dominate like, I don't know, video processing or something, but most startups are not in that boat - they need to iterate on UX as fast as possible.
A very good reason that's not "because I know it" is that there aren't many good alternatives. And before you start yelling at the monitor and before you start listing languages like PHP, Ruby, Python, and server side JavaScript try to understand that I don't mean alternatives as in "other programming languages that work on the web" but alternatives as in "other programming languages that use the same paradigms". (I hate myself for using that word but it sort of works in this context.)

But what do I mean by this? C# is a statically typed object oriented programming language with functional constructs that has a good IDE and some good web frameworks. The other alternatives that I listed are dynamically typed and use text editors for the most part. And while there's nothing fundamentally wrong with that kind of workflow you should understand that not everyone is a fan of it. I've worked with Python and PHP before and done quite a bit of JavaScript and it always feels to me like giving instructions to the computer instead of having a conversation with it. Again, this is a matter of personal preference.

Two alternatives to C# that are a bit closer in terms of thinking would be Java and Scala. Java I don't love and Scala, while I'm OK with it as a language, has given me nothing but problems although I must say that I'm not giving up on it yet. Working with Scala on Windows was sub optimal, especially when trying to get Typesafe Activator running on PowerShell, and when I worked with it on Linux I quickly realized that IDE support for Scala is not particularly great. I tried Eclipse, Netbeans, and IntelliJ IDEA Community edition and none of them were at Visual Studio levels of quality with regards to Scala and Play.

About .NET being a closed-source single platform language / framework, that's kind of true, but Roslyn and friends should make that less true in the future. And besides, even though .NET runs best on Windows servers every other component that can form your web application like databases, load balancers, caching, etc. can run on its own native OS. The idea that if you're going to use .NET then everything that you use must have been made at Microsoft is so odd nowadays that not even Microsoft supports it. For example, the basic web application templates that are built into Visual Studio incorporate third party libraries like Bootstrap and jQuery, and guidance on how to use .NET technologies with technologies like AngularJS is commonly given by Microsoft itself.

From reading all the previous threads, the answer seems to be Visual Studio.

Me, I use it because I know it, and because it works for me. I see no reason to jump ship.