23 ms·
I'm a hardcore *nix guy but boy do I love me some C#. Up until now it's been the best language I have worked with but the worst platform due to it's lack of 'ni
by jpgvm 12y ago
I'm a hardcore *nix guy but boy do I love me some C#. Up until now it's been the best language I have worked with but the worst platform due to it's lack of 'nice things' that we just expect from languages/ecosystems these days.
Where 'nice things' is defined as being open-source, having open-source ecosystem of developer tools etc.
This isn't so much the beginning (as good stuff has been happening for a couple of years now) but it's a huge step.
Thankyou Microsoft.
- stinos 12y agoI'm not really hardcore anything but have been using Windows as main OS for years mainly because of the existence of VS. And boy it would be awesome if the stuff I write in C# now would just run on *nix :]
- eloisant 12y agoC# as a language is better than Java, but not as good as Scala.
- nathas 12y agoCan you explain why you think so?
- lmm 12y agoMost of the selling points on scala-lang.org still apply over C# - type inference, pattern matching, case classes (C# makes these less bad than Java, but the field/property distinction can still bite you), an inheritance model that supports the good parts of multiple inheritance without the problems, covariance/contravariance, for/yield syntax that's generic and user-controlled, higher-kinded types. It takes a while for your code to get big enough for the last part to matter, but it's huge when it does - you can handle any kind of "context" in a generic way, e.g. async calls, error handling, audit logging, software transactional memory, or custom things for e.g. database access. F# has a number of these specific implementations but they're kind of "hard-coded" in the language rather than fully extensible. So I guess the pitch is: imagine C# async/await could be "just a library", and other contexts that you wanted to handle similarly could also be a library, and the resulting functions are first-class citizens in the type system (no awkward choices of whether a particular function is async or not, you can handle that generically).
- Locke1689 12y agoSo I guess the pitch is: imagine C# async/await could be "just a library", and other contexts that you wanted to handle similarly could also be a library, and the resulting functions are first-class citizens in the type system (no awkward choices of whether a particular function is async or not, you can handle that generically). That's true in F# -- async is just a library in a computation expression.
- yohanatan 12y ago> F# has a number of these specific implementations but they're kind of "hard-coded" in the language rather than fully extensible. That's not true. You can extend the language yourself with "computation expressions" (and that's in fact how the 'async', 'let!' et al keywords are implemented).
- lmm 12y agoTrue, but what you can't do is abstract over them; you can't write a function that operates on "some generic computation expression" (you can't even write that type). So you can't write "sequence" or "traverseM" or more complicated/specific things you build on top of these.
- yohanatan 12y agoThere is an encoding supporting that level of abstraction (perhaps though not as straightforward as you'd prefer); namely using interfaces (which are first-class) to encode module signatures. See: https://gist.github.com/t0yv0/192353 https://gist.github.com/t0yv0/192353
- eranation 12y agoI don't know why you are being down voted. Erik Meijer, a huge .NET contributor who worked at Microsoft (on C# among other things), and was behind the reactive .NET extensions (and also a big Haskell contributor) - he was saying exactly the same thing about Scala vs C# - http://www.infoq.com/presentations/covariance-contravariance-joy-of-coding-2014 http://www.infoq.com/presentations/covariance-contravariance... I can also testify as someone who uses Scala on a day to day basis and used C# at work as well - I completely understand your statement, although it's very subjective.
- Vektorweg 12y agoPeyton Jones and some other nice people work at Microsoft to improve Haskell, which is IMHO the right tool.
- jbooth 12y agoProbably because, A), it was an uncalled-for digression into language wars, and B), now that we're here anyways, a lot of us think the majority of features in scala and Haskell for that matter are fundamentally misguided. My goal is not to write elegant code, but to write the least complex code with the lowest cognitive overhead. TCO, 10x the man-hours in maintenance and all that. If the choice is between having to write null-checks or having to understand category theory to read my code, I'll take the null-checks.
- psibi 12y ago> majority of features in scala and Haskell for that matter are fundamentally misguided I'm interested in the Haskell part. What features do you think are fundamentally misguided ?
- jbooth 12y agoI'm much less experienced with Haskell than with Scala, so I might be unfairly painting it with the same brush here. But, for example, https://www.haskell.org/tutorial/io.html https://www.haskell.org/tutorial/io.html. At the end of the day, this is a huge inner-framework anti-pattern over the same procedural syscalls that every other language handles procedurally. I shouldn't have to care what a monad is, and side effects? The whole point of I/O is side effects. It could be a no-op, idle process or CPU-burning busy loop if I didn't care about side effects. From that doc: " So, in the end, has Haskell simply re-invented the imperative wheel? In some sense, yes. The I/O monad constitutes a small imperative sub-language inside Haskell, and thus the I/O component of a program may appear similar to ordinary imperative code. But there is one important difference: There is no special semantics that the user needs to deal with. In particular, equational reasoning in Haskell is not compromised. The imperative feel of the monadic code in a program does not detract from the functional aspect of Haskell. An experienced functional programmer should be able to minimize the imperative component of the program, only using the I/O monad for a minimal amount of top-level sequencing. The monad cleanly separates the functional and imperative program components. In contrast, imperative languages with functional subsets do not generally have any well-defined barrier between the purely functional and imperative worlds." So, basically, they acknowledge that their theoretical model has a huge impedance mismatch with what we write programs to do (I/O, eventually, somewhere). And that's fine, they can knock themselves out and I hope it's fulfilling for them. It's not for me.
- joslin01 12y ago+1 as a Scala fanatic :) It's all about what works for you though.
- moonchrome 12y agoF# is more of a .NET analogue to Scala.
- edgyswingset 12y agoI'd say it's the .NET analogue to Scala with added elegance.
- karavelov 12y agoAnd removed flexibility that make it awkward - see for example the lack of higher kinds
- brodo 12y agoIn Scala, there are just too many ways to do things. It's optimized for flexibility and easy writability. C# on the other hand may be a little more verbose, but at least everyone can read everyone elses code.
- saosebastiao 12y agoFunny, I find c# much harder to read. Its almost as if it is easy to understand code for languages you know well, and harder to understand code for languages you don't.
- jbooth 12y agoYou find C# harder than this? trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[A, Repr] with Parallelizable[A, ParSeq[A]] { self => or def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That
- deleted 12y ago[deleted]
- saosebastiao 12y agoYou intentionally chose code that is hard to read...I could easily do the same with C#. It isn't representative of the vast majority of the code that I use nor write. That being said, when you understand the nuances of type annotations, that code is quite readable in the mathematical notation sense. It is concise and takes more time per byte to understand, but it tells me enough about the code that I rarely have to read the actual implementation to know exactly what it does.
- jbooth 12y agoIt's from the standard collections library, the most-used code in any language. It is in fact representative of the vast majority of code you use. The fact that it wasn't immediately clear to you that a lot of your code DOES use this code is probably the strongest argument I could make.
- HeavyStorm 12y agoApples and Oranges, my friend.
- garrettheaver 12y agoAs someone who has written applications in C#, Java and Scala (amongst others). I'd be curious as what makes you think Scala is a winner relative to C#?
- asdf1234 12y agoI'd happily switch from Scala to F# but I would miss higher kinds and using implicits for typeclasses.
- eloisant 12y agoOne big thing: Immutability by default. That's possible in C#, but it's hard to be sure everything is immutable => http://stackoverflow.com/questions/5097287/how-to-create-immutable-objects-in-c http://stackoverflow.com/questions/5097287/how-to-create-imm... A lot of interesting aspects of Scala are possible only because of immutability. And a lot of smaller things: * Typeclasses. In Scala you can implement them with implicit parameters, I have no idea how you would do it * Case classes. Again in C# you can implement something that kinda looks one with readonly and just a getter, but it's not as good as you won't get stuff like equality and copy, you'll have to write the boilerplate * Pattern matching, in particular with case classes * Option. You can create your own, or use the Option from FSharp, but all the lib you will use will be returning null all the time. * And more... Additionally there are aspects that are more of a personal preference, like how the "map" function is called "Select" and "filter" is called "Where", and so on. All functional languages use the same names, the SQL-like naming for manipulating collections is just confusing for me. At the end of the day, Microsoft tried to build a better Java when they designed C#. And it is indeed better than Java, especially because they moved fast in their versions while Sun/Oracle was terribly slow (why did we have to wait that much for lambdas??). But C# mostly sticks with the same concepts as Java (OOP) while Scala truly embraces both FP and OOP.
- deleted 12y ago[deleted]
- jkrems 12y agoYes, that's why you would use F# in .NET if you want something like Scala. And then I heard many people say that .NET wins again.
- lmm 12y agoF# is elegant but ultimately held back by its lack of higher kinded types.
- kvb 12y agoHeld back from what? I mean, I'd love it even more if it had higher kinded types, but it's a pretty great language as is.
- jakevn 12y agoIt's simply less expressive. Just as Go is fine without generics, F# is fine without HKTs. It's a sad realization for those coming from a language that does support HKTs. Still a great language.
- seanmcdirmid 12y agoI can't tell if you are serious or joking :). it is definitely a trade off to be made, the power offered by higher kinded typing doesnt come for free.
- bad_user 12y agoMeh, F# is pretty good, but Scala has a better type-system. You cannot model type-classes in F# for example and there's some ugliness in it, in a true Ocaml fashion - for example I don't like how you've got to deal with 2 types of generics or the prevalence of "static" methods, static methods that are complete hacks that go back to C++ at least (Scala has no such thing as static methods btw). In many ways Scala is a very elegant language, too bad that many people are scared by these myths that are flying around. That said, people are missing the forest from the trees. This isn't about the language, but rather about the runtime and the standard library. That's the true value of the JVM, that's the true value in .NET. There wouldn't be any problem for porting Scala to .NET. Sure, it would be difficult as .NET's reified generics are maybe too limited for Scala's type-system, but I'm sure somebody could make it work, at least partially. And there was a Scala for .NET, but it lacked interest so it died. But hey, you can still run stuff built in Scala on top of .NET by means of IKVM ;-) Has poor performance compared to a JVM, but then again, people are willing to build stuff in Scala for Android. Also Clojure.NET is doing pretty good from what I've heard. As a Scala developer that loves Scala and the JVM, I personally find this announcement very exciting. As finally, the JVM has true competition ;-)
- sixothree 12y agoDoesn't Scala run on the JVM, and isn't this announcement about porting the .Net runtime? And you're really drawing this comparison?
- seanmcdirmid 12y agoI went from scala to C# 7 years ago, and after some feature withdrawal, I began to like C# for its simplicity. It was not very elegant, I often had to settle for ugly solutions, but this was actually a step up from scala where I would obsess to find the most elegant solution for my code. In C#, the best way is more obvious even if not that good, and you settle more quickly. As the language is considered holistically with tooling, the error messages are always good and they don't make dubious decisions (getting rid of semi colons) that are theoretically sound but screw up tooling.
- frowaway001 12y ago> they don't make dubious decisions (getting rid of semi colons) that are theoretically sound but screw up tooling Wait WUT? I'm not sure you know what you are talking about ... that just doesn't make any sense. Scala 7 years ago is fundamentally different from today's Scala, so I'm not seeing how your experience is relevant anymore.
- seanmcdirmid 12y agoTaking out semi colons reduced the amount of redundant information needed for error recovery in the parser, leading to poorer error messages and reducing the quality of interactive IDE feedback. I know this because I was working in the IDE when martin made the decision. Maybe it was the right decision, but there were definitely costs! There is a very good reason they will never eliminate semi colons from C#, the visual studio team would never let them...C# is developed in a completely different style from Scala. I'm sure you are right: scala today is probably a much more simple language with great IDE support...7 years ago, it was a bunch of advanced features and building a decent IDE for it was a struggle.
- addicted44 12y agoWhy would you compare C# (although they keep adding functional programming concepts to it) to Scala, instead of comparing F# (which can commingle with C# wherever you need it) with Scala? I haven't looked into F# or Scala too much, but I bet F# comes out looking far better, because it was so deeply inspired by Haskell (but made practical).
- frowaway001 12y ago> I bet F# comes out looking far better, because it was so deeply inspired by Haskell (but made practical) Eh what? Scala is a lot closer to Haskell than F#/OCaml, and can express roughly the same things, while F# is a lot less expressive.
- pjmlp 12y ago> C# as a language is better than Java, but not as good as Scala. However Scala is not a first class citzen in the JVM, but C# is the systems language of the CLR, already a huge difference.
- aerique 12y agoWhat languages have you got experience with that you feel C# is the best language you have worked with? And what makes it such a good language for you?
- jpgvm 12y agoGenerics, Partial Classes, awesome Reflection API, Lambda syntax, LINQ, C/C++ compatibility, async/await, concurrency primitives, etc. I have worked with prettier languages, for instance I have picked up Haskell recently, I have also worked with faster languages, C was my forte for many years and I have worked with languages in the GSD category like Ruby and Python. C# is appealing not because of some feature that it has that other languages don't. But rather the long list of things they didn't fuck up. For instance by building concurrency and evented programming semantics into the core there isn't multiple competing event loops for instance. (unlike say Python or Ruby which have about 5 each, Java has more than I can count). It's not so much there is one single thing that makes C# really nice, it's the whole package.
- SCHiM 12y agoYou know what I also really like about C# is the .net runtime. I know that allot of people dislike it because there's so much leftover stuff from previous versions, however despite this it's one of the most comprehensive runtimes I've every worked with. Want to make a screenshot of the desktop? Got it. Want to post keystrokes to another application? No problem. Ohh I see you want to write a tcp server with asynchronous processing? Here's some generics you can just c&p. I know other languages have these features too, but C# makes it so damn easy to use in the stdlib it's just not funny anymore.
- eyko 12y ago> Ohh I see you want to write a tcp server with asynchronous processing? Here's some generics you can just c&p. So we've come to the point where copy-pasteability is a language feature? Tell me I can use a library or module. Tell me that the language comes with built in features to help me do this or that. But never tell me I can copy-paste generic code. Please.
- Pxtl 12y agoMicrosoft has been playing catch-up on developing that "nice things" like trying to build an open-source community. NuGet, open-sourcing the ASP.Net and EF stacks, etc. A long way to go, but they've recognized their big failing and are moving on it. MS makes some great technology and some terrible tech... but the problem is the terrible tech gets the same blessing as the great tech. An open-source community is the best way to develop best practices and properly replace their false-steps.
- ams6110 12y agoI'm not so sure I believe that they're trying to do a "nice thing" out of the goodness of their hearts. They've held pretty tightly to .NET because in order to deploy anything developed in .NET you needed to buy Windows licenses. Recently that hasn't played out so well. Software developers look to minimize costs and overhead that doesn't contribute to their mission (e.g. licenses and license compliance). There's just zero reason to pay for operating systems in 2014 when there are such capable free alternatives. So if people won't pay for operating systems what will they pay for? Stuff that still costs them money, i.e. hardware infrastructure and attendant maintenance and administration. Hello cloud. Development shops are happily sending Amazon millions of dollars a month so they don't have to buy servers, set up server rooms, hire system administrators, and worry about things like air conditioning, big UPS systems and emergency power generators, etc. Alongside Amazon, Microsoft is doing pretty well with Azure. And you can run free operating systems on Azure, and .NET is already well supported on Azure. So what will sell more Azure? Make .NET run on the free operating systems. Now all the developers who like the free OSs on their personal dev systems are suddenly able to develop stuff they can deploy on Azure. What about all the devs that like Macs? No problem, make .NET run on Mac OS X as well. I think this is all about making Azure services more compelling and more able to compete with Amazon than it is wanting to do "nice things" for the open source community.
- simplemath 12y agoYour analysis is absolutely solid, but I'm not sure anyone read this and thought "Oh gee how nice of M$ to give back". In the end I think this is overwhelmingly a net positive for both MSFT and developers.
- manyxcxi 12y agoI actually have this conversation frequently with my developers (most of them are .NET), so I'm really happy to hear someone else say this as well. I've done about a an even split in my career with C# and Java and feel as competent as the next guy bouncing between the two languages and delivering projects for clients, but I like writing C# the most, by far. The language is more modern, things like async/await, Linq, and Entity Framework make developing Java web apps drudgery in comparison. Spring does a lot to help (Spring Boot is great), but there's a lot of rolling your own and helping less senior developers figure out how to even START at Java WebApp project. But when it comes to automating my build process, doing continuous testing and deployment, setting up a environments in containers, or just where I'd rather spend most of my time operating- I'll take *nix and Java all day over IIS/Windows server. No thank you, the only Windows I have in my house is a VM for using Visual Studio and writing C# web apps on the occasion I need to for personal stuff. I will be truly happy when I can write C# code and deploy to something like Tomcat. I will never again go back to Java when that day comes.
- edwinnathaniel 12y agoTHIS +1. I feel that people need to feel and experience both side end-to-end deep in the bowel to be able to judge Java/C# because it's more than just the language; it's everything! IDE, Tools, Libraries, Environments, etc.
- aaqureshi 12y agoThank you for summing it all up, so well. C# has a language has so much stuff built into itself. When we work with java we have to take help from frameworks such as Spring etc .
- custardcream 12y agoSimilar situation. I deal with Unix/windows approximately 50/50 from a devops perspective. My word I'll also take anything Unix over windows at the moment regardless of the tech. To be fair in the short term, windows is maximally productive but if you hit an edge case or a rough spot you're SOL, especially if it involves Microsoft support or scripting. Rough edges cost me a lot of money and willpower. An example: I opened a case when IE9 was in developer preview with partner support. When they rewrote the download manager in IE for this release they changed how download prompting worked and removed a setting from the UI (and left it in the registry). This broke ClickOnce launches entirely for over 2000 users for us. Fast forward nearly 5 years and it's still broken, the case is still open and to get everything to work for the client we have to frig a registry setting on every workstation they roll out. That sucks for us and the client, badly. This is a typical story for us. When you deal with VSTO, MSI packaging, managing large clusters of windows server machines, random bugs that just blow up in your face suddenly after working for years, signing code, trying to get repeatable builds out of a CLR solution and automating all of these things, forget it. PowerShell gets you 80% of the way there but the last 20% is a tar pit of pain and impossibility. Now I've been in the Microsoft ecosystem for 20 years, certified and bought into it all. Perhaps I'm bitter and tired but I can't see past all this experience and have mixed memories of c#. All I see is hung instances of visual studio and working out which project file is buggered and all this is destroying the best language I ever used. I don't want to waste my life on giving them another chance. There is literally none of the above on Unix platforms from experience. I've only encountered one bug in the last 15 years due to a CIFS kernel bug and RH fixed it within two days. I haven't had any automation friction at all. I'm worn out and confused to be honest when I read back this post.
- mcv 12y agoThis is my impression too. I'm not terribly familiar with C#, and used to avoid anything from Microsoft like the plague, but a lot of stuff I hear about C# sounds like it's a bit ahead of Java. (Really, Java should be more like Groovy, if you ask me.) But the JVM platform is great, and I'm just not going to get locked into a MS ecosystem. But if MS opens up to the rest of the world, well, that changes things considerably.
- illumen 12y agoYou prefer yourself an Oracle cage?
- dingdingdang 12y agoExactly.. IMHO both Oracle & MS runtimes are dubious mechanisms, especially in the light of the native cross-compiling that Go and co. are gradually bringing to the fore.
- 72deluxe 12y agoI think you're in a niche avoiding Microsoft technologies. It isn't so much as Microsoft opening up to the world (which is true to some extent) as embracing the smaller market shares of Linux + Mac OS. Windows market share is colossal, and C# is a big thing in Windows land, even more important than C++.
- mcv 12y ago"Smaller market shares"? That depends entirely on how you limit your view. PC desktop, absolutely. But internet servers? Mobile? Those are places where Linux is huge, and Java is too. But the thing about Java is that it also works on Windows. And that's the great news here: you're not just stuck with Windows anymore if you use C#, and that makes it a lot more useful.
- vorg 12y ago> Java should be more like Groovy It has been since lambdas were introduced in Java 8. Groovy's original design by its creator James Strachan was about adding closures to the dynamic typing that Beanshell had at the time. The stuff added to Groovy since then (e.g. the MOP for Grails, DSL syntax, static typing in 2.0) are things Java already does better or things (if you ask me) it shouldn't do.
- itsboring 12y agoI'm so onboard with what you're saying. I've been using mono for the last couple years, so much so that I call myself a "mono developer" and not a ".NET developer". I worked at Microsoft for a couple years and I could already smell this brewing. The devs I respected the most were also the most unhappy with the platform tie-in. This is a desperately needed political shift for the organization, and I think it will actually boost morale as well.