20 ms·
C# really feels like the most mature language that I've ever dealt with. Writing it feels clear, if something is wrong the debugger is very clear. The number of
by simonsarris 15y ago
C# really feels like the most mature language that I've ever dealt with. Writing it feels clear, if something is wrong the debugger is very clear. The number of features that are there is incredible (especially post C# 2.0 when they added generics). Properties are delightful.
How do you convert to a string? Convert.ToString(). How about an integer? Knowing only that one, it's what you'd expect!
I also picked JavaScript because I am in a love affair with this weird little language. I also think it is one of the easiest languages to teach basic programming with (videos forthcoming).
The amount of time it takes to whip up a five-cent program with javascript without even leaving my browser, heck without even leaving this tab is just astounding to me even after all these years.
One thing I noticed though while writing this comment is that more than the language itself, the tools that I use while building things in the language are what really make them a pleasure to use. If I wasn't using Google Chrome's web developer tools I'd probably consider JavaScript to be a nightmarish corpse of a language that punishes the slightest of typos with a silent malicious grin, as code execution carries on as if A.blah = 5 and A.blsh = 5 were both equally worthy of existing to the JS compiler/interpreter. Only by the grace of tools is JS tame at all.
- hackinthebochs 15y agoDefinitely agree with you on C#. It feels like this is what a standard, mature, widespread language should be. There are other languages that are better for specific tasks, but for the general programming language, C# really hits the sweet spot in terms of features, expressability, readability, and environment. This is the language that Java should have been--could have been. Also, I dread getting asked on my next interview "whats the one thing you don't like about your favorite language". I honestly can't think of anything off the top of my head. Granted, I've come across things that were frustrating at various times, but they never stick in my mind. I think that's a testament to how well the language has evolved.
- MartinCron 15y agowhats the one thing you don't like about your favorite language That's easy. So many hacker types dismiss you as some sort of weirdo for favoring anything that came from Microsoft.
- redthrowaway 15y agoOr, less glibly, it's a mostly single-platform language with support for other operating systems offered only through third-party tools.
- megamark16 15y agoI don't dismiss C# developers, I'm just glad I'm not one anymore.
- MartinCron 15y agoDo you mind if I ask why? Not being defensive, just curious.
- llimllib 15y agoWell, I'm not the gp, but I am a former C# guy who's happy to be out of that world. 1) I dislike C#'s types; they're neither as strong and intelligent as a ML/Haskell language nor as convenient as a Python/Ruby family language. 2) I much prefer the sense of design displayed by Python and Ruby open source projects over C#. (Not that there aren't issues there!) 3) I hate Visual Studio. Nice debugger, crappy interface for writing code. Horrific user interface design for the most part. (At least back when I was writing C# back in 2009!) 4) I hate Windows. Linux and Mac are far more developer friendly. I hated dealing with Cygwin to get some sort of reasonable (crappy but tolerable) command line environment. 5) I love git. Until fairly recently, git was not available and stable on Windows. For it and for many other bits of software, windows is a second class citizen. Shall I go on? Because I could. But I'll leave it at 5 for now.
- MartinCron 15y agoThanks for the thoughtful reply. I've absolutely felt your pain. Some of those things have maybe improved (I use git every day, I love my PowerShell, and Visual Studio + ReSharper is glorious once you tell some of the cruft to stay out of your way) but it's still a long way from perfect.
- tomjen3 15y agoThat is easy -- non nullable objects. What I mean by that is that you can already specify that some numbers may be nullable. I would love to be able to specify that some objects cannot be null and have the type-checker verify it. Even better I would have an option type so that you never need to use null, ever.
- hackinthebochs 15y agoThat's a good one, I'll keep that in mind. (I'm not just cribbing, I ran into a real world situation that just screamed non-nullable objects).
- nikolaplejic 15y agoThey don't really work at the type system level, but Code Contracts (http://msdn.microsoft.com/en-us/devlabs/dd491992 http://msdn.microsoft.com/en-us/devlabs/dd491992), though quite verbose, may be used to achieve that to a certain degree. The integration with Visual Studio is decent and the documentation is great, but they are designed to provide a whole design-by-contract framework which may be an overkill.
- pbz 15y agoI remember Anders saying that that was one of his regrets for not implementing this from the beginning. According to him adding this now would break quite a few things, but he hasn't yet given up on the idea.
- zmj 15y agoI agree in large, but there are some rough edges. -It's wordy. The var keyword was a step in the right direction, but there's still a lot of redundant type information, even compared to other statically typed languages like Go or F#. -Legacy code. A lot of things that are concise and easy in C# 3.5+ were possible but hideous in older versions. Sadly, that code must still be maintained. -Null handling. Like another commenter, I wish the language would help more with null values. I'd love an operator to do monadic null coalescing: var foo = thing1.thing2.thing3.bar; Sometimes I want foo to be null if any of the chained objects are null. It's a pretty good language, though. I'm looking forward to the Roslyn API to the compiler: http://msdn.microsoft.com/en-us/hh500769 http://msdn.microsoft.com/en-us/hh500769
- skrebbel 15y agoLegacy code is a problem in every language. Whether the language evolves, or just the common insights of how to use it best. In fact, C# deals excellently with legacy code. While, unlike the JVM, .NET is not binary backward compatible (allowing some excellent language improvements that Java still has not managed to pull off), it is nearly (but not entirely) source code backward compatible. Sure, this allows to old code using old constructs to stay alive, but it works. That alone is pretty unique, especially if you see that nearly any other language either does not manage to move its community to the next version with breaking changes (Python 3, PHP 6) or has tons of compatibility issues every time something changes (Ruby, Scala), or simply is at a standstill (Java). Having to deal with a DictionaryBase child class which was made before generics were added is way less of a deal than not being able to upgrade your software to the newest version of the language at all. Which is what would've happened if this was done like Scala. Or, if it was done like Java, we'd still be hacking DictionaryBase child classes. I'd maintain that no language/platform deals with legacy code better than C#.
- mquander 15y agoC# programmer for a couple years, and I think C# is OK (it's definitely way ahead of Java or C++) but I've definitely got a big list of things I don't like about it. The top of it reads: - Events and properties aren't first-class, which is lame. I can't even easily get the "get" or "set" method of a property without either using reflection or making a wrapper lambda. - No syntax sugar for tuples. - No syntax sugar for destructuring anything. Come on now. - The type system has big holes. For example, I still can't specify class Something<T> where T : new(T) (i.e. where a copy constructor exists on T.) And I can't specify class Something<T> where T : /* is a numeric type */. - It would be nice if there were type inference on more things, like property and field types. - All reference types are nullable which sucks.
- hackinthebochs 15y agoYour list basically boils down to "C# isn't <insert favorite language>". Which is fair of course, but most of your list wouldn't really make sense in C#.
- jbrechtel 15y agoWhy would sugared destructuring not make sense in C#? Or first class events and delegates?
- hackinthebochs 15y agoDestructuring just doesn't fit with the current language syntax. There are no copy constructors in C#, so something like [a, [b, c]] = [1, [2, 3]] makes no sense syntactically. In languages where declaring objects don't require a new, this syntax follows naturally. For the simple case of say, destructuring a tuple, that could work well: a, b = ReturnsATuple(). But anything more general would just seem tacked onto the language. But then again, tuples don't really fit well in C# either! Tuples are only useful if you don't have to declare their types, ever. Without full type inference, nothing is saved by using tuples over, say, an inline object. I don't understand the significance of first class events, so I can't really comment on that. And as far as I know, delegates are first class now with the inclusion of lambdas.
- frou_dh 15y agoYep. To me C# feels like the standout all-round language. It's not super-elegant, but it's modern and brings together a lot of useful features without messing up much. I especially like the stuff that was added in v3.0. On design alone, I would probably vote Clojure. The features and their rationale are very compelling.
- loudmax 15y ago<i>I honestly can't think of anything off the top of my head.</i> Limited support in the open source ecosystem? Open source projects are reluctant to build on something that might infringe on an MS patent. That's what keeps me away from the language. To be fair, this is more an indictment of the patent system than C# itself.
- hackinthebochs 15y agoI was thinking more along the lines of the language itself. Complaints about the (lack of) open source ecosystem are more than valid. That's something I dearly miss in the .Net world.
- MatthewPhillips 15y agoEh, C# is good for the environment it lives in, but it's not without it's cruft. C#'s answer for all of its missing features seems to be a generic class. Don't have tuples? We'll give you Tuple<T>. Don't have inline functions? We'll give you Func<T>. It feels very tacked on (especially Func).
- anarchotroll 15y agoI also feel like "Funcs" are a work around. What I like the most about C# is the fact that it keeps evolving and incorporating new paradigms (closures, lambdas, LINQ, etc)
- hackinthebochs 15y agoFunc<T> is just the type signature they use for lambdas. The syntax allows fully inline functions now: () => { DoSomething(); } No return value needed (compiles down to an Action<T> I think)
- masklinn 15y ago> No return value needed (compiles down to an Action<T> I think) Which is an other crufty thing in C#: because Void/() is not a type (inherited from Java), it needs to have both `Func<Tn..., T>` and `Action<Tn...>` in order to handle functions-with-a-return-value and functions-without-a-return-value.
- hackinthebochs 15y agoThis is true, but its mostly transparent unless you're doing something particularly ugly.
- masklinn 15y agoLike trying to take one of these as parameter or return it?
- 15y ago
- meow 15y agoWriting C# code in Visual Studio feels almost like telepathy. Intellisense is so good that, it nearly writes 30-40% of total code.
- Inufu 15y agoIf code can be written by auto completion, it's by definition redundant and IMHO shouldn't be necessary in the first place.
- javajosh 15y agoThat is not true. Autocompletion is a decision with user override enabled. It is, at the very least, a visible decision. That does not imply that it is totally automatable.
- jonny_eh 15y agoJust hide the default behaviour and make the overrides optional.
- d1plo1d 15y agoWhat about sensible defaults? If the libraries you use are designed with reasonable defaults that have already anticipated your needs there should not be any need for anything but the most basic syntactic autocomplete functionality (closing brackets for example) because any code at that point is customization for your specific project which is not easily generalized (otherwise it would be a default in the library).
- ben_straub 15y agoNo, it's more like the IDE is augmenting your brain and fingers. The code comes out readable, but you only have to type a fraction of the characters. It's a code-writing assistant robot. Also, it makes APIs incredibly discoverable. Not sure what a `IQueryable` provides? IQueryable iq = null; iq. and scroll through the popup. Instant one-line descriptions are available in the tooltips, and you can get full documentation with F1. you've ever experienced this, it's REALLY hard to go back to Emacs. It's incredibly well done. (edit: formatting)
- j_baker 15y agoClosure compiler is also very useful for making JS a bit more safe and fast https://developers.google.com/closure/compiler/ https://developers.google.com/closure/compiler/
- edwinnathaniel 15y agoIf only C# has Maven (that supports both Mono and .NET) and a solid cross-platform libraries, I'd leave everything behind.
- measure2xcut1x 15y agoI almost never log into HN (read it daily), but I felt compelled to put up a vote for C# because it makes me feel like I have super powers. As a solo developer, I get a lot of firepower from the MS stack, and C# is like the icing on the cake. There, I said it.
- sreque 15y agoI've spent most of my time in the open source world, and I would have to agree that C# on .NET feels like the most mature high-level software development tool I've ever used. C#'s biggest strength isn't the language. While the language is nice, there isn't a lot you can do with it in terms of productive development that you can't at least approximate in Java, especially with a good IDE to generate your boiler plate for you. Where C# and .NET really shines is in its native integration and low level facilities. How many other tools in the world let you debug a mixed application containing both native and managed code, all in the same IDE and in the same session, with the ability to set breakpoints in either area, view values, do memory watch points, and so on? It also feels so incredibly easy to call native code in C#. There's even a whole web site dedicated to making it easier, pinvoke.net! Lastly, C# itself contains several performance-sensitive features that have no JVM equivalent, including value types, unsigned integrals, and unsafe code with raw pointers. The .NET platform even has an implementation of tail recursion , now, though the C# compile will not generate IL that uses it, which makes it inaccessible for most people. When it comes to language design, C# is a little sloppy but it more than gets the job done. In terms of tools and low-level facilities for building a real-world application, C# on the Windows .NET platform feels absolutely world-class. For my favorite language, I of course, voted for Scala!
- veyron 15y agoHow is this C#+.NET integration on mono? Are the relevant low-level facilities translated well into linux or osx?
- sreque 15y agoI like Mono, and I respect the work that they've accomplished. It is incredibly difficult to build a runtime like .NET, especially as it was never designed to be cross-platform. That said, the Mono experience on Linux is inferior to that on Windows. MonoDevelop is nowhere near Visual Studio, so that I just develop on Windows and deploy on Linux. Unfortunately, that doesn't help the fact that both the soft and hard debuggers for Linux are nowhere near Microsoft's debuggers. It also doesn't help the fact that the runtime itself is less stable (i.e., more prone to crash) and there are APIs that only work well on Windows. I would also imagine that the Microsoft runtime exhibits much better overall performance. My understanding is that Mono mainly excels at MonoTouch, and that is where Xamarin is making most of its money, but I am not knowledgeable in that area.
- pjmlp 15y agoI just wish Microsoft would improve AOT compilation with NGen, or even better, provide native compilation as they do in Singularity with Bartok.
- rbanffy 15y agoIs it still a good choice if you don't intend to deploy to Windows?
- manojlds 15y agoProbably not, eventhough there is Mono.
- wycats 15y agoIf I wasn't using Google Chrome's web developer tools I'd probably consider JavaScript to be a nightmarish corpse of a language that punishes the slightest of typos with a silent malicious grin... Only by the grace of tools is JS tame at all +100000. We can thank the Webkit Tools team (including folks from both Apple and Google) for making the web platform environment as pleasant as it is. Kudos!
- underwater 15y agoHave you worked with Firebug before? Webkit tools is a carbon copy. It is smoother of course, in the same way Chrome is more polished han Firefox.
- ootachi 15y agoYou're talking to Yehuda Katz here. Yes, he has worked with Firebug.
- rplnt 15y agoHow these two compare to Dragonfly[1] (Opera). I never worked in depth with any of them so they look pretty same to me. Only difference I know is probably remote debugging which Opera had for years but there was no need for it in firebug/chrome dev so I wouldn't count it as an extra feature. 1. http://www.opera.com/dragonfly/features/ http://www.opera.com/dragonfly/features/ / https://bitbucket.org/scope/dragonfly-stp-1 https://bitbucket.org/scope/dragonfly-stp-1
- cies 15y ago> We can thank the Webkit Tools team (including folks from both Apple and Google) webkit originally comes from the KDE project and was known as KHTML (with its KJS companion).. they basically showed the world that a decent HTML renderer can be written in nice-API-C++-code (Qt-style-nice-API) and with limited resources. how long did Mozilla take to make Netscapes ancient codebase usable? it took forever! and chrome+safari+android+iOS >= 40% of the browser market. wow. anyway, lets also thank the KDE project that booted it. :)
- ttrashh 15y agoThe new await/async in C# 5 is beautiful. Just try/catch around an await and suddenly async is easy to read and handle errors.
- verelo 15y agoThis makes me so happy to read. Honestly i love writing in c#. I spend a lot of my life now using php, but honestly the times when i followed best practices the best (unit tests all over the place, often test first approach) was when i was coding in c#. I think the language just lends itself, and the IDE...to doing things right.
- bnegreve 15y ago> How do you convert to a string? Convert.ToString(). Actually, I think this is a bad example because oop is inadequate in this particular case. Converting something to something else perfectly fit the functional paradigm (take an argument, returns something, don't store anything). Why do you need a Convert object? How would you explain this to someone not familiar with C#. I think Console.WriteLine("hello"); is a better example.
- polshaw 15y agoI hate to hijack this comment, but this topic really highlights an issue with the HN comments. It is now virtually impossible to have any broader discussion since this thread filled the page. A topic that is massively more broad than discussion about C#.
- bmelton 15y agoI've only been here a few years, but how and why is this new? If you're implying that it has to do with the lack of visible scores, I'd point out that I think that the comments are still ordered by score, even if they aren't necessarily displayed. If it's just because of the sheer number of comments attached to the C# specific parent, I can't remember a time when a really popular comment didn't take up a larger share of space as more comments logically take up more space. I mean, there was the pre-pagination era, where you could just keep scrolling down, but that was also the era of HN crashing all too frequently.
- stdbrouw 15y agoWith "now", polshaw is referring to "this moment in the life of this thread", not "this moment in the life of HN" - so it's not about how HN has gotten worse, just that big threads like the C# one can push other meaningful parts of the discussion way down. It's not because it's always been that way that it's ideal.
- bmelton 15y agoFair point, I suppose. I guess I was just thinking to myself, as I read that, that this is easily the least of HN's problems. I suppose it IS a fair point though, especially considering that C# is (by my quick once over) only the fourth most popular language, and easily represents the most popular discussion on the topic. Also, looking through the additional pages, it seems as though there aren't many other comments that even have children, much less anywhere close to the same discussion space.
- Anirak 15y agoI just don't understand why we can't have a simple minimize button. And some sort of grid to indicate which comments are responding to what would be nice too.
- aswanson 15y agoI have to agree with this. If only ruby or python had such a powerful development environment (sigh). There's simply nothing in the open source community that rivals the beautiful, simple power of that IDE and language combination. Tools matter when you're trying to ship code.
- petepete 15y agoThe beauty of Ruby and Python is that you aren't restricted to an IDE in order to use them; I wouldn't enjoy using them if I was. I like to choose my own tools. This isn't quite so easy when using an all-encompassing (and platform specific) IDE like Visual Studio. I use tmux (with tmuxinator), with windows for my editor, shell, debugger, source control, logs. I'm able to, effortlessly, change any part of it.
- krallja 15y agoI'm not sure what this means. Are you saying it is impossible to write C# code without the IDE? If so, my .vimrc would like to have a few words with you.
- petepete 15y agoYou can write code in vim, yes. Do you debug it there too? Didn't think so. You use a separate debugging tool (or clewn, if you're a masochist). And a separate source control client (possibly wrapped in a vim plugin like fugitive). And a shell. Effectively you (like me) have probably put together your own set of tools that perform the functions of a IDE.
- tesmar 15y agoI used the Vim/Ruby combo for a long time but RubyMine pushed me from Vim to an IDE again (they aren't always bad).
- petepete 15y agoTo be fair, having just had a good look at RubyMine, it looks very good.
- shimon_e 15y agoI don't think anyone will be pulling out C# marketing videos from their archives any time soon. Like AT&T archives' the unix operating system http://news.ycombinator.com/item?id=3749496 http://news.ycombinator.com/item?id=3749496 It will be interesting to see what happens with C# if Microsoft succeeds with Windows 8 on the desktop, tablet, and phone.