Live data from Hacker News

Why C# is the best language for mobile development

blog.xamarin.com

71–80 of 125 posts

Re: Why C# is the best language for mobile development

#71

Earlier quoted context omitted.

I don't understand. Are you saying that map, filter, reduce and al. on lazy sequences in functional languages are inferior to loops, or that Python list comprehensions and generators are inferior to loops? That's basically LINQ to objects. Maybe you're refering to LINQ-to-whatever (LINQ to SQL, etc.), a LINQ generalization where you can quote your expressions, rewrite the AST and emit something else (a very constrain…

In the vast majority of cases it is nothing more than syntactical sugar around loops. And no, I'm not saying that loops are superior, but rather I'm saying that loops are usually a terrible solution, but LINQ has a way of essentially hiding those egregious violators. Take a block of code with LINQ in it and rewrite it minus LINQ but logically performing the same operations that the sugar is resolving to. To most deve…

Most developers I know seem to prefer the loop version. I'm not sure what you mean by "sensibilities of construction", but I'm a big advocate of LINQ. If your concern is that certain linq calls iterate an entire sequence, that could apply to all kinds of scenarios that have nothing to do with LINQ like string concatenation. You should always be aware of the performance characteristics of methods you are calling. LINQ is not special in that regard.

Re: Why C# is the best language for mobile development

#72

Earlier quoted context omitted.

"var" is not dynamic typing. It's just a way to enable type inference - it's still as static as can be. It also has a very limited useful scope in C#, as type inference isn't supported in most areas.

There is only one place where the type inferencing is not supported, field declarations. Not sure how that became "most areas".

Miguel I'm confused then - your experience with Mono certainly means you have a better understanding, but I thought I understood it pretty well, too.

Places lacking type inference:

  - Parameter definitions
  - Method return types
  - Generic type parameters (sometimes)
  - Lambda expressions (due lack of syntax to indicate quoted code)
  - Field declarations
The only place type inference works for declarations is in local variable declarations and lambda parameter types if the delegate type is known.

Perhaps the definition of "most" is arguable, but C# has many places that need you to unnecessarily specify types, and there's no good theoretical reasons for any of it, right? (Except the whole syntax sharing for expression trees versus anonymous functions, which is debatable.)

Re: Why C# is the best language for mobile development

#73
post #21

Earlier quoted context omitted.

And if you've worked on a large project with a lot of cats to herd for both platforms, you will appreciate java very quickly.

I work on a pretty huge C# code base. Use of LINQ is the least of it's problems. If anything I'd say one problem is people not knowing about things like lambda expressions, linq, generics or whatever. It can really make code harder to parse when it's written in ways that don't take advantage of the full power of the platform.

Yes until we get to:

List, string>>>

Re: Why C# is the best language for mobile development

#74
"Async support as a first-class feature" - that's actually a flaw. C#'s async implementation would be better served by having e.g. a generic monad system that allows async to be done in a library. Instead, it's another baked-in compiler feature, like C#'s duck typing and LINQ's query operators.

Calling it "cutting-edge" is an exaggeration, too.

Re: Why C# is the best language for mobile development

#75
post #32

Earlier quoted context omitted.

Well, off the top of my head C# doesn't support mixins or multiple inheritance. You can get around the lack of mixins with extension methods and tight scoping but it's messy.

That is a false statement. dynamic C# 4.0 can do mixins: http://amirrajan.net/Blog/dynamic-c-sharp

so, yes this leveraging of dynamic metadata provider technically satisfies the requirements for a mixin, but you're still not applying this mixin to a poco, therefore i don't think it's fair to say the language/spec supports it natively.

this is another example of adding mixins to .net code via 3rd party library: http://remix.codeplex.com/

Re: Why C# is the best language for mobile development

#76
post #57

As languages go, C# may be the ultimate "middle ground" because it really excels and providing a middling implementation of [your-favorite-language-feature]. That is, if you're a functional programming enthusiast, you can do a lot of functional programming in C#. Sure, it's often more painful than haskell or lisp or F#, but it's workable. If you're a dynamic programming enthusiast, C# has a perfectly workable (but ul…

Sorry, but you're really attacking a straw man here. Neither C# itself nor the OP's article sell C# as being a prime language for functional, dynamic, or systems programming. Rather, it has inherited some convenient little bits of each paradigm to make the language that much nicer to write. For example, don't want to redeclare that "List >" you're copying over because it has a scope of 2 lines? Just dynamically type…

He's not attacking anything; the two of you are in (violent) agreement :). He's saying that C# provides all those little bits its "inherited", so it's an acceptably-good language for pretty much anyone, no matter your background.

Re: Why C# is the best language for mobile development

#77
post #73

Earlier quoted context omitted.

I work on a pretty huge C# code base. Use of LINQ is the least of it's problems. If anything I'd say one problem is people not knowing about things like lambda expressions, linq, generics or whatever. It can really make code harder to parse when it's written in ways that don't take advantage of the full power of the platform.

Yes until we get to: List , string>>>

In my experience, that kind of stuff is usually a problem mainly because of C#'s verbosity from lack of type inference. Although, with 4 unnamed elements there, it might start making sense to create a new type, and then it's just "List>".

Re: Why C# is the best language for mobile development

#78
post #21

Earlier quoted context omitted.

This is a fundamental place where the worlds of C# and Java differ. Where the Java world would say, "developers might misuse this, better not have it in the language," the C# world says, "developers could really use this, better put it in the language."

And if you've worked on a large project with a lot of cats to herd for both platforms, you will appreciate java very quickly.

I concede the point. I hope I never have to herd that many cats.

Re: Why C# is the best language for mobile development

#79
post #27

What is he comparing to? Arguments #2-#5 & #7 seem to apply to Java as well, and #6 just quotes an extremely lopsided benchmark exploiting one specific feature of their C# implementation. Most of the arguments would apply to Objective C too, I presume (though I haven't really used that outside of toying around). I'd personally expect we'll see a lot more JS for mobile apps: a terrible language compared to C#, but a v…

I don't think each point is meant to show that it's better in that respect than every other competitor. I think it's meant to be sort of like those feature grids on software packaging, where some of the competitors may have some combination of the features, but only Our Product has the complete set.

Re: Why C# is the best language for mobile development

#80

"Async support as a first-class feature" - that's actually a flaw. C#'s async implementation would be better served by having e.g. a generic monad system that allows async to be done in a library. Instead, it's another baked-in compiler feature, like C#'s duck typing and LINQ's query operators. Calling it "cutting-edge" is an exaggeration, too.

> Calling it "cutting-edge" is an exaggeration, too.

What is "cutting-edge" varies from person to person. Some people are easily impressed.

Post reply on HN