10 ms·
6 Months with C#
- damian2000 14y agoGood article, but I have to disagree with you regarding the C# ecosystem. Sure, its mainly windows, but there is boatloads of tools and support out there for it. Visual Studio is a great IDE, and the documentation for C# and .NET is generally good. I'm a C# developer mainly, and recently did a bit of Java development in Eclipse (Android ADT) and did miss some features of C#, but the languages are still very, very similar.
- NateDad 14y agoThere's definitely a lot of C# code out there. I do think that open source C# code is more limited than some of the other popular languages. However, the .Net standard library does so much that you often don't need much more other than perhaps a custom protocol implementation or some UI code. I think Windows is the major drawback to C#. No one with half a brain is going to write server software that only works on Windows. Desktop software? Sure... I wouldn't write desktop software in anything else (at least for mass market software). I admit to not having worked with mono, and I think it is kind of a catch-22 - if it's not a common framework, no one will write for it, and if no one will write for it, the framework won't get much love... which is a shame, because Java obviously is in dire need of some competition to spur innovation over there at Oracle. Using Java feels like going back in time to 2002.
- tucaz 14y agoWhy not write server code for Windows? I fail to see a major reason that would stop one from doing that. Actually, its a pretty good, well supported and documented and stable platform.
- josteink 14y agoIt means that hosting your code suddenly goes from a simple equation about what hardware will cost you, in terms of actual servers, virtual servers or other solutions to a matter of involving licensing software just to have your code run. It means that if you ever need to scale up, you'll have to buy more licenses. It prohibits unlimited, automatic scaling. It's also the once a month embarassing ordeal with sites being down due to server reboots after another round of Windows Update. I deploy lots of stuff to Windows-servers, but I can see why some people would avoid it if they can.
- sultezdukes 14y agoBut what you're not understanding is that they're costs to the alternatives. There's costs to deploying on Linux. There's costs to building software in Java as opposed to C#. There's costs to hiring Linux sys admins as opposed to windows sys admins. If you don't look at the big picture costs than you lose out on a lot of options.
- NateDad 14y agoThis. If you're just running a single server inside your enterprise firewall that will only need to scale as the company hires new employees, it's probably fine. However, if you need something that can grow with demand from customers (which is usual 3-5 orders of magnitude greater growth than you'd see from your employee base).. then the licensing and costs become prohibitive.
- tucaz 14y agoEverytime I see someone talking about "unlimited" something my spider sense ticks off. Except for Google, Amazon and some other big guys, most of companies will worry about lots of things before what you mentioned become a problem. Also, AWS, Azure and AppHarbor have takem the license problem out of the way.
- nkohari 14y agoAWS doesn't really take the license problem away -- it just rolls the cost into the price of the instance, which is significantly higher for Windows.
- tucaz 14y agoAnd will only become a problem when you reach a huge scale. If by that time it is still a problem then maybe your problem is not having a good enough business model.
- nkohari 14y agoWe're seed-funded and have somewhere around 70 instances in AWS, almost all Linux. In our business, our margin depends largely on our operational costs, and using Windows would be a significant hit to our bottom line.
- brudgers 14y ago"No one with half a brain" This does not contribute to the discussion.
- NateDad 14y agoYou're right. It was poorly thought out and unnecessarily inflammatory. My apologies.
- emn13 14y agoAlthough the core libraries in .NET are huge, many are also very shoddy. There are also a few great API's, but the overall quality and usability is pretty uneven. This is mostly a problem with API's back from version 1.0 - however, unfortunately, those API's often haven't been updated. Documentation is also not always equally good; MSDN has lots of pages that describe a method Bar.Foo() as "Fooing a Bar", which is next to useless. I get the impression the java APIs are often better documented. NuGet might really turn things around; here's to hoping...
- mattmanser 14y agoYeah, the worst ones are the stream ones, some what ironic given that he singles one out over Java. The IO one may have `ReadToEnd`, but it's still nowhere near as simple as Python or Ruby, it just shouldn't have to take that many lines of code to read a file. And these days I include RestSharp pretty much straight away if I'm going to be doing any HTTP calls, the native HTTPClient API is horrible. But even that's not got the greatest API, there's absolutely no good reason to have to declare a `RestClient` before doing a `RestRequest`, it's just a waste of lines of code. You always end up just writing a wrapper round it.
- eel 14y agoThere are ways in the .NET framework to read an entire file with one line: File.ReadAllText("file.txt"). And the System.Net.WebClient class provides ways to make simple HTTP calls in much fewer lines than WebRequest does. Likewise, Python has ways for interacting directly with streams.
- emn13 14y agoWebClient's API is essentially buggy; it cannot support encoding properly since the order of operations of the API is different from in HTTP, and further the response headers aren't properly exposed to let you work around the limitation. It's fine for a quick hack, it's useless for a reliable web client.
- sultezdukes 14y agoNo one with half a brain is going to write server software that only works on Windows. Once you step out of your little bubble, you'll realize what a stupid comment that is.
- NateDad 14y agoI guess I should have qualified my statement better. When I said server software, I meant servers to host cloud services that need to be easily deployed and scaled with demand. If you're writing a server that's only used inside your own company, and thus doesn't need to scale quickly, it doesn't really matter... in which case, Windows is a decent option, especially if you have a lot of windows devs in house. However, for cloud deployment, there are a lot of hassles with scaling on Windows, mostly due to licensing costs and hoops you have to jump through for that. BTW, I write server software for Windows in my day job, so I'm not some Linux zealot who's bashing Windows for no reason. Windows is fine. Non-free licensing is not (when a good free alternative exists).
- ashkenazi 14y agoIt even saves time, I use it a lot whenever I create an app, even integration with cousins like Visual Web Developer through SQL Its really a good language to use, but promotes laziness. But its my language though so I can't complain about it since I make a living out of it. I got called by an IT company, one of the biggest in South Africa but they want me to program with Java but I'm just not interested in that.
- crag 14y ago"It is quite difficult for Python or Ruby to have the level of IDE that Java has. IntelliJ for Java is hard to beat. And Jetbrain (the company that makes IntelliJ) also produces Resharper (R#)..." Jetbrains also makes IDE's for Ruby and Python; Rubymine and pyCharm.
- insraq 14y agoBut the language support is not as good as Java and C#, which are static typed and IDE can make use of static analysis.
- gambiting 14y agoMono is actually finding its way to new platforms all the time. I was surprised to find out that the recently released Playstation Mobile SDK is based entirely on Mono, so Playstation Vita runs it. And I am pretty sure there's an implementation available on Android. As for iOS there's Xamarin. MonoDevelop on MacOS is also quite good.
- nkohari 14y agoI've been a fan of Mono for a long time; unfortunately, we've had a lot of trouble trying to scale it in production. Our application was originally built for .NET (on Windows). It was successfully ported to Mono, but we continue to have strange problems (machine load average going to 50+ and becoming unresponsive, etc.) which we believe are related to the Mono GC. After spending a good amount of effort trying to fix the Mono version, we decided to bite the bullet and migrate to another platform (Node.js), which has proven to be significantly more stable under load. I'm a huge fan of Miguel and the rest of the Xamarin crew, and I'd love to see a universal implementation of the CLR take dominance. I think maybe 5 years ago the CLR had a real chance to win in the battle of multi-language runtimes, but at this point I think the war is going to the JVM. (Chalk that up to yet another short-sighted decision by Microsoft.)
- sultezdukes 14y agoI'm a huge fan of Miguel and the rest of the Xamarin crew, and I'd love to see a universal implementation of the CLR take dominance. I think maybe 5 years ago the CLR had a real chance to win in the battle of multi-language runtimes, but at this point I think the war is going to the JVM. (Chalk that up to yet another short-sighted decision by Microsoft.) The problem is that Java (the language) completely dominates the JVM landscape still. I don't see Oracle in the game at all as far as contributing/endorsing something else, and obviously Sun was completely oblivious to anything else until it was too late in the game for them. If you look at the CLR, VB.NET has and F# actually have significant percentages of uptake because they're actually supported by Microsoft. Scala, Clojure, etc.... are just miniscule blips on the radar in comparison.
- spo81rty 14y agoI don't understand why everyone on HN hates Windows server so much. From an administration standpoint they are much easier to setup and use thanks to their GUIs. Windows is very standardized and has very good management tools and interfaces. C#, ASP MVC, and Visual Studio are extremely good tools. I've programmed in C# for 10 years and never had a project I could not do quickly with it. It has very good support of 3rd party controls like Telerik, and there are lots of open source projects on codeplex, github, etc. The most expensive part of software development is paying developers. Spending a few dollars on good dev tools or 3rd party controls is a very good investment and can save a lot of time.
- katbyte 14y agoI've done both (win and linux) and they each have their disadvantages and advantages, it would be hard for me to pick a clear winner because it really depends on your skillset and the task at hand. If i were to do a big enterprisey project with a big budget i would definitely be more likely to go with windows while if i were to do a web/online start-up i would more likely pick Linux.
- martinced 14y agoMedium enterprisey project with a medium budget, I see people picking C#/CLR> But really big enterprisey stuff with really big budget? It's all Oracle DB + Java on Unix there. Just as all the really big infrastructures (Google, FedEx, Amazon, etc.) are all Unix.
- spo81rty 14y agoI think you nailed it. Large enterprises want support. Although some also see potential cost savings of Linux.
- tucaz 14y agoIf I had to, I would bet with no fear that web development today can be made with any tech stack (.net, ruby, python, etc) without signficant differences in schedule or effort put on it. Choosing stacks todays is pretty much a matter of taste and skill availability.
- sultezdukes 14y agoGood writeup, and I agree with much of his post. Going back to Java from C# at the language level is just painful. The Java library/framework is more complete and diverse than the .NET one, but it's actually improved alot for .NET in recent years with Microsoft becoming much more open source friendly, the ALT.DEV community, Mono, etc... The .NET community is much more comfortable with alternative not from Microsoft these days than in the past. IMHO though, the JVM has a better alternative language ecosystem than the .NET one. Yeah, .NET has F# builtin to VS these days, but doesn't have things like Scala/Clojure (not first class citizens), Kotlin, Ceylon, etc...
- brass9 14y ago> IMHO though, the JVM has a better alternative language ecosystem than the .NET one. Yeah, .NET has F# builtin to VS these days, but doesn't have things like Scala/Clojure (not first class citizens), Kotlin, Ceylon, etc... And the irony is: .net was touted initially as a polyglot platform, whereas JVM has been primarily associated with Java only.
- sultezdukes 14y agoThere's really not much irony there. VB.NET and C# were released together from the beginning, where Sun only thought of Java (the language) until too late in the game for them. Sun was screwed because of factors beyond Java, but because of internal politics there, they never realized the full potential of the JVM.
- stevenelliottjr 14y agoI have been a C# developer since 2004 and nowadays I use it with Xamarin Studio to write iOS apps on the Mac. What Miguel and Nat have done with Xamarin is awesome and I think the future of .NET lies more with what they're doing than what MS is doing IMO.
- pmelendez 14y agoI have also been working for the last 6 months with C# at the office and I was reading the article nodding all the time. Working in C# is a good experience and you have the feeling that it's an upgraded version of Java. However, for me is still boring. It's not easy to explain and I am pretty sure is very subjective but I feel C# lacks of soul. In the sense that programming in C# isn't as fun as programming in Scheme or Python. Maybe is just me, but I don't use C# outside of my work.
- MatthewPhillips 14y agoMicrosoft is trying too hard to make C# answer to every single technology trend, adding dynamic type, asynchronous methods, etc. In most cases you wind up with a working but much worse alternative to the real thing. For example, here's how you create an anonymous function that returns a string in C#: (new Func<string>(() => { return "foo"; }))(); That's pretty awful and as a result you rarely see anyone doing stuff like that, whereas with JavaScript it's used regularly. But for C# it's another checkbox that they can say they support. C# should stick with trying to be the best statically typed compiled object oriented language.
- sultezdukes 14y agono, that piece of code that you contrived up is awful, not .NET's anonymous functions.
- yread 14y agoeh? How about ()=>"foo" ?
- MatthewPhillips 14y agoPicking on the simplicity of my example completely misses the point.
- nkohari 14y agoYou're right, that is awful. It's also unquestionably the worst way to write it. Try this instead: () => "foo" Please don't participate in a conversation if you aren't willing to spend the time necessary to gain a baseline level of understanding of the topic.
- MatthewPhillips 14y agoThat's not equivalent code, it doesn't execute itself. That it simply returns a string with no logic and therefore can be written slightly simpler belays the point I was making. You simply don't see this type of code being used much in C# because it isn't idiomatic, yet it exists to mark off a checkbox.
- seanalex 14y agoI've been using C# for several years, and have bounced between it, Java, Node.js for my side-projects. After all said and done, I keep coming back to C#. I feel more productive and can design and churn out code quicker than say in a Node project. Overall, I actually do enjoy coding in C# and using .NET more than any other language I have experienced so far. The day I tried to use Drupal was the day I realized I made a serious mistake for not thinking I could do things better or quicker in C#/.Net instead. Overall though, Microsoft is trying to move to an "ecosystem" platform. Exampes are Nuget powering their closed/open-source ecosystem for projects and Azure server templates. Even their latest ASP.NET MVC 4 is pushing several open source libraries onto their default project template. They truly see they couldn't win the web battle with WPF/Silverlight as their only options, so they are going for a different angle here in the last year. Additionally, a lot of interesting things are coming out of Microsoft and its employees, such as the open-sourced SignalR which is actively being updated and may become a standard for C# webapps. I realize C#/.NET is not the go-to language for small web-apps yet, primarily due to licensing, but give it time. I say if you are on the fence, and are interested at all in C#, give it a shot! There are many free options for development IDE's and hosting provided by Microsoft. For example, you can use Visual Studio Express and host up to ten websites for free on Azure.