Any reasons I should switch to Java or other technologies? What I get with the (much hated) Microsoft stack: - C# with LINQ and async await - Roslyn compiler as a service which speeds up development - mature .NET framework - more and more open source and cross platform parts and smaller independent libs - typescript - Xamarin cross platform tools I also use python and used Java in the past. I don't see any reason why…
Understanding .NET 2015
81–90 of 107 posts
Re: Understanding .NET 2015
#82Earlier quoted context omitted.
Yes c# generics are often a lot less painful, due to lack of type erasure, and support for variable number of type parameters etc. Having said that, more is possible with Java than many people realise. You can read statically available generic type params at runtime (field declarations, supertype tokens etc) . There are also workarounds for most of the erasure problems like methods that vary by generic type parameter…
Having to rely on reflection is bad though.
I mean, attributes are reflection, and they're absolutely invaluable.
Re: Understanding .NET 2015
#83What I still don't understand in this picture is the what does the future look like in terms of the .NET framework . .NET Core sounds great, and its great that they are unifying the implementation, not just the API, for many of the "app models". But, its unclear to me if there's the intention for .NET Core to fully succeed .NET Framework at some point in the future. Or, rather, will some of the app models we see on t…
Re: Understanding .NET 2015
#84Earlier quoted context omitted.
> games Ever played something like e.g. Bastion? http://en.wikipedia.org/wiki/Bastion_%28video_game%29 I mean if you are developing the new Unreal Engine - sure. But otherwise gaming industry would benefit from more of maintainable code.
For context, Bastion was written in C#. Here's what the lead developer said on the topic of GC: http://www.reddit.com/r/IAmA/comments/lwljh/iama_dev_team_of...
http://www.reddit.com/r/IAmA/comments/lwljh/iama_dev_team_of...
Re: Understanding .NET 2015
#85Earlier quoted context omitted.
Having to rely on reflection is bad though.
Why? I hear this a lot, but I never understood it. I do a lot of work with reflection to achieve things I can't otherwise do (around application extension, dynamic systems for games, etc.). I mean, attributes are reflection, and they're absolutely invaluable.
Reflection is like anything else it can be used properly and it can be abused. I've seen it abused far too many times.
I realize there are times in Java when reflection is unavoidable (Android's animation libraries rely on it), but I consider it to be a feature of C# that, so far, I've never had to use reflection in C#.
Re: Understanding .NET 2015
#86Earlier quoted context omitted.
This. The amount of new Thread(new Runnable(){...}).start() I have in my Android code is awful. And then inside the Thread you have to use runOnUiThread() to change UI stuff. Given how common it is for an app to hit the network, this should be much much easier. Looking at your example it might be slightly easier but it also isn't inlineable. C# solves both of these problems
Hah; check out RX & http://reactiveui.net/ which is the framework behind GitHub for Windows. You will never have to worry about which thread your running on ever again. Doesn't just support WPF - it also works on Windows Phone, iPhone, Mac OSX & Android: public SearchViewModel(ISearchService searchService = null) : ReactiveObject, IRoutableViewHost { SearchService = searchService ?? Locator.Current.GetService (); //…
If you implement SynchronizationContext and set it, you can actually have the TPL call back into whatever special threading stuff you want.
It doesn't work for WPF bindings, but for the quick'n'dirty procedural UI code it works great.
[1]: https://msdn.microsoft.com/en-us/library/system.threading.sy...
Re: Understanding .NET 2015
#87Earlier quoted context omitted.
It is and it isn't. LINQ is actually incredibly smart under the hood, so if I ran: myList.Where(x => x.name = 'Person'); .Where(x => x.age > 18); .ToList(); it wouldn't actually run two different array filters - it would combine them. You can imagine the performance gains to be had there.
Citation? I was unaware that the little IEnumerable functions did fusion. If you mean an IQueryable execution, like LINQ-To-SQL, then sure.
public static IEnumerable Where(IEnumerable source,
Predicate predicate)
{
foreach(var item in source)
{
if(predicate(item))
yield return item;
}
}
which means var results = myList
.Where(x => x.name == 'Person');
.Where(x => x.age > 18);
.ToList();
is executed just like var results = new List();
foreach(var x in myList)
{
if(x.name == 'Person')
{
if(x.age > 18)
results.Add(x);
}
}Re: Understanding .NET 2015
#88Earlier quoted context omitted.
I used to work in C# (now mostly live in JavaScript land) and I miss things like LINQ a lot. So here's hoping we see wider adoption of C# in the future.
It's pretty trivial to implement Linq-like functions in JavaScript, or, I think stuff like undersocre has them.
Re: Understanding .NET 2015
#89Earlier quoted context omitted.
> I liked some of the generics handling better, it can be less verbose it seems. It pays off in spades in a lot of situations, but the biggest I've noticed is Android development. Hitting a network from a button press in Xamarin is as simple as: button.OnClick += async { var data = HitTheNetworkForSomeData(); // Note that since this is still async, // you may want to set a global or have a // different approach to ha…
It's a shame Android is still stuck on Java pre-8, as your Java example could be nearly as consise as the c# with Java 8.
If ever, given their attitude on last year's Google IO.
Re: Understanding .NET 2015
#90Any reasons I should switch to Java or other technologies? What I get with the (much hated) Microsoft stack: - C# with LINQ and async await - Roslyn compiler as a service which speeds up development - mature .NET framework - more and more open source and cross platform parts and smaller independent libs - typescript - Xamarin cross platform tools I also use python and used Java in the past. I don't see any reason why…
- Groovy is nice and still very similar to Java(no learning curve)when you want syntactic sugar like LINQ or JDBC SQL without all the boilerplate code.
- IntelliJ Idea is similar to Visual Studio + Resharper.
But the biggest reason to start using Java is its extremely mature and rich ecosystem!
I'm currently doing software development on Windows with C#.Net and Visual Studio without ReSharper and I really miss Linux, Java and IntelliJ Idea :(