4 ms·
While I don't disagree that C# is good, I don't see how you could say that Java is in any way behind. At least in concurrency, I would argue that it's somewhat
by debacle 14y ago
While I don't disagree that C# is good, I don't see how you could say that Java is in any way behind. At least in concurrency, I would argue that it's somewhat ahead. Threading in Java was more intuitive to me than threading in C#.
- sk5t 14y agoBoth this and the parent post should be more specific, as pre-lambda, pre-TPL threading in C# was not too much different from standard Java threads. Long-standing language support for events and delegates put C# slightly ahead of Java at the start, but only in the last few years has C# left Java in the dust.
- bunderbunder 14y agoIt's been a while since I last spent much time with Java, but to my knowledge it's still missing: - User-defined value types - Lambdas - An equivalent to LINQ (and PLINQ) - Language-level support for asynchronous programming - True generics (Java's implementation is essentially syntactic sugar on good old-fashioned typecasting.) - Extension methods - Late binding
- debacle 14y agoMost of those have nothing to do with threading.
- j_s 14y agoGGP: While I don't disagree that C# is good, I don't see how you could say that Java is in any way behind. GP: [List of features where Java is behind.] (May have missed that the sub-thread is about 'scalable, concurrent systems', though typical C# development leaves threading worries to ASP.NET/SQL libraries.) Personally, I would appreciate it if you'd share how Java threading beats C# threading, particularly C#'s async/await. I don't know much about Java.
- bunderbunder 14y agoFair. I had interpreted you as saying you didn't feel like Java was far behind C# in general. I'm not terribly versed in what Java's got going for it in the concurrency department, so I'm not really qualified to speak to that. The stuff that's been happening in C# and .NET since version 3 is pretty fantastic, IMO, but I don't really know the details about how what Java has compares.
- debacle 14y agoNo, I greatly prefer C# to Java. I just prefer the clarity of thread management in Java - it feels a bit more high level than C#.
- usea 14y agoIn the past few years C# updates and new .net libraries have had a sort of concurrency and parallelism focus. The Task Parallel Library (TPL)[1] is basically like goroutines in Go. They're a concurrency construct, for executing code that gets multiplexed to threads via the thread pool by default. Absurdly useful and very easy to use. This contains stuff like Task, Parallel.ForEach, .ContinueWith() etc. The TPL Dataflow[2] stuff added just recently is data pipelining. Completely thread-safe communication of data, with the ability to construct a complex data pipeline that your data gets pushed through. Similar to channels in Go. Also added recently are the async and await keywords[3] in C# and VB.NET. These are compiler features that allow you to write asynchronous code exactly the same way as you would write synchronous code. Basically a replacement for the IAsyncResult + BeginFoo/EndFoo pattern, it allows you to write simple and readable asynchronous code. Not necessarily multi-threaded as it can be used with single-threaded code, but it allows the stuff that interacts with your multi-threaded code to not bend over backwards for it. [1] http://msdn.microsoft.com/en-us/library/dd460717.aspx http://msdn.microsoft.com/en-us/library/dd460717.aspx [2] http://msdn.microsoft.com/en-us/devlabs/gg585582.aspx http://msdn.microsoft.com/en-us/devlabs/gg585582.aspx [3] http://msdn.microsoft.com/en-us/library/hh191443.aspx http://msdn.microsoft.com/en-us/library/hh191443.aspx
- upthedale 14y agoDon't forget Rx [1] It enhances support for the IObservable/IObserver interfaces, the duals of IEnumerable/IEnumerator, allowing Linq manipulation of asynchronous events. As others have discussed or at least alluded to, C# certainly started out on a par with Java, but has grown into a different beast altogether, if one makes use of all the new developments mentioned. These days my C# code is very un-Java-like, and far more Functional. [1] http://msdn.microsoft.com/en-us/data/gg577609.aspx http://msdn.microsoft.com/en-us/data/gg577609.aspx