Live data from Hacker News

Ask HN: Is Xamarin worth learning?

news.ycombinator.com

41–50 of 168 posts

Re: Ask HN: Is Xamarin worth learning?

#41

No one is mentioning how expensive Xamarin is and there is no proper free version. In the free version you app expires after 24 hours AND it has to be below a certain size, I dont remember maybe 2 MB or something. To make something you have to cough up a lot of money, and the sad part is this information is incredibly hard to find, you only stumble upon it when you download GBs of files.

That's not true anymore, Xamarin is now free for everyone, except larger companies, see https://blog.xamarin.com/xamarin-for-all/

Re: Ask HN: Is Xamarin worth learning?

#42
post #17

When using Xamarin I always get the feeling I'm writing Java code--but in C#. The cross-platform project is a blessing, it's truly amazing to be able to write code once and use it on all platforms (especially if you use Dependency Injection for even more sharing). The downside to this is that making a UI seems to even out your gained time--it's extremely messy and even complicated. Code that's valid in C# produces va…

> Some of the most used API's are not documented at all, simply having a "To be added" description. I rarely find myself reading the Xamarin documentation, and mostly browse documentation and StackOverflow as if I was coding a native iOS/Android app. This works because the Xamarin wrapper is pretty much identical to native APIs.

Agreed. I never read the Xamarin documentation, instead I'm looking at objc or Java and then impl as c# instead. The method names, signatures and idioms match almost one for one. When the API doesn't match it's because it makes sense to; Pickup a copy of the dotnet framework design guidelines and you'll see what I mean about the previous statement.

Re: Ask HN: Is Xamarin worth learning?

#43
Yes it is worth learning. It's a skill which is quite in demand especially from established companies for their business applications.

However, as others have pointed out, Xamarin Forms is a bit of let down.

In my experience, if you try to create custom designed UI (which is quite common in the native apps), then you find that Xamarin Forms is very limited. To overcome this limitation you need to write something called as a custom renderer for each OS you want to support. So it doesn't really save you much time.

Xamarin has something called as Xamarin Labs project on Github: https://github.com/XLabs/Xamarin-Forms-Labs But it's progress has been very slow.

If you have a business data collection / reporting app, where how things look is not very important, Xamarin can save a lot of time while creating cross-platform apps.

However, I wouldn't recommend Xamarin Forms for B2C apps.

Re: Ask HN: Is Xamarin worth learning?

#44

Yes it is worth learning. It's a skill which is quite in demand especially from established companies for their business applications. However, as others have pointed out, Xamarin Forms is a bit of let down. In my experience, if you try to create custom designed UI (which is quite common in the native apps), then you find that Xamarin Forms is very limited. To overcome this limitation you need to write something call…

AFAIK, Xamarin Forms was always meant to be simplistic, and not very customisable. They even say it was meant to be called Xamarin Duplo, but trademarks.

Re: Ask HN: Is Xamarin worth learning?

#45
post #17

When using Xamarin I always get the feeling I'm writing Java code--but in C#. The cross-platform project is a blessing, it's truly amazing to be able to write code once and use it on all platforms (especially if you use Dependency Injection for even more sharing). The downside to this is that making a UI seems to even out your gained time--it's extremely messy and even complicated. Code that's valid in C# produces va…

> The downside to this is that making a UI seems to even out your gained time--it's extremely messy and even complicated. Code that's valid in C# produces vague underwater bugs in Java code, which makes you keep hacking around until you find a working solution. Interesting, I had the exact opposite experience, since the Java->C# mappings often reduce much of the boilerplate code that you have to write if you were usi…

Most of my problems often come from constructors. For example, using a custom parametered constructor in an Activity or Fragment seems impossible, so constructor injection is already out of the question. This is valid C#, but will not compile. Hence, I stated that using Xamarin feels like programming Java in C#, which makes me feel like I would actually be happier writing Java code.

Instead, for this example you could subclass Activity/Fragment and use reflection to find properties on the activity to inject services into.

This is only one of countless annoying Xamarin problems I have encountered in my few months of use, and this one was relatively easy to solve. Vague problems also ensue when forgetting to inherit a class from Java.Lang.Object which leads to vague exception messages like "Specified cast invalid".

Sure, sometimes parts can be made faster in C#, but more often than not I spend day(s) debugging extremely vague bugs related to non-documented mappings.

Re: Ask HN: Is Xamarin worth learning?

#46
Hey Guys, Xamarin University Instructor here,

Obviously I think it's worth it, I learned it well enough to teach others. We have a bunch of free Self Paced Learning modules and videos at Xam University, as well as obviously the paid stuff that pays my salary ;-)

There is a ton of investment and effort from a small team, remember, we've only been with a "big company" a few months, so the improvements come at a blistering start-up pace. If you haven't seen it in a couple years, you should really check back.

If you are going to develop "all platforms" or even just iOS and Android, it is _certainly_ worth a long look. Access to every API you get access to in their native languages and the ability to avoid that language "context switching" pain. Plus, some amount of shared code (varies wildly, 25% - 75% depending on how heavily your app is just about custom UI and animations ).

Because we use the same APIs (except when we have better ones), you can leverage the same documentation and StackOverflow posts when you need to (yes with a little language translation), but you often don't need to because Xamarin has a _lot_ of great documentation as well.

And, as has been mentioned, "Xamarin Forms" does not equal "Xamarin". Although it is a valid choice for developing in Xamarin, it is only one option. Here is a super shallow comparison:

Xamarin Forms: Super fast for super simple UI's and interactions with common elements. It is highly opinionated on what it should do and look like on all platforms. Customization is do-able but starts to increase the complexity of the app quickly to the point where the below would have been a better choice.

"Xamarin" aka "Xamarin.iOS and Xamarin.Android": Use essentially the same development patterns as Native Android and iOS developers and use the same API's (plus .NET library, and many .NET 3rd party libraries). You get code sharing (as noted, amount varies considerably), ability to "think in one language (often including your server, which might also be c#), and access to some additional libraries (because we support both the Native libraries _and_ the .NET ecosystem).

Hope this helps :)

Oh, and a quick plug. Xamarin University is live classes taught by real, very experienced developers who can actually help you learn and understand, so we are, you know, worth asking questions of. Also, we'll be doing a free presentation all day on November 18th as part of Visual Studio Connect, so check us out there and see what you think of Xamarin _and_ Xamarin University!

Re: Ask HN: Is Xamarin worth learning?

#47
post #35

I've been extremely disappointed in Xamarin. The main issue is that you don't really get code sharing. I would estimate that only 25% of the Xamarin project I manage is cross platform code. The rest is this bizarre merger of native APIs with C#. It's difficult to write because of the lack of examples and documentation. It's also buggy, even with simple things like page views. The real problem is that I can write a na…

Hm, completely different experience here. I've been involved with three rather large Xamarin-Projects in the last year, and we were (team-wide) completely surprised at how much of the code can actually be shared, how our velocity compared to native development and the overall dev experience.

I think the code sharing thing really comes down to how you're using Xamarin – if you keep on writing apps the way you're used to from the original platforms, there's not much to gain. On the other hand adopting the patterns and ideas that influence the .NET sphere (DI/IoC, MVVM..), Code Sharing rates (or PCL vs. Native LoC) can be as high as 80/20.

Xamarin Studio certainly has its own shortcomings, but both Microsoft (Visual Studio for Mac) and Jetbrains (Project Rider) are actively improving or developing alternatives, so I think that pain is going to fade over time.

Re: Ask HN: Is Xamarin worth learning?

#48
post #23

Earlier quoted context omitted.

I can't find anybody that has done significant work with Forms and isn't complaining about it. It's giving the platform a really bad rep.

Forms is not Xamarin. It's a DSL in the form of a NuGet (aka npm/cpan) package developers can use to attempt to ignore the differences between the platforms. It's kinda like swing. Great for throwing together a line of business application and getting xplat ui for free. It's possible to build a performant application with the framework but it abstracts subtle things that come back to hurt you. For example. Forms apps…

I understand this, but how many people read these kind of angry rants on the internet and realise there are more ways to use Xamarin than using Forms?

Re: Ask HN: Is Xamarin worth learning?

#50
We use Xamarin Forms a LOT for our internal and public facing apps. I started exploring it almost 2 years back, because native Android development just sucked, and C# has the async/await keywords, which is simply perfect for asynchronous operations in UI.

It has not been an easy road. After 2 years, I'm finally beginning to reap the benefits. The simple problem is this: this is another layer over the existing layers and it's very hard to get it right, especially if the underlying layers suck.

Just because you've learnt Xamarin Forms doesn't mean you can choose not to learn the underlying native platforms. You can skip over most of the details, but something will always come back to bite you, and then you have to go figure it out. Xamarin Forms works on top of Xamarin Android, that works on top of Android SDK and Android Tooling, which works on top of the JDK, which works on top of the OS you're developing on. So many places for something to go wrong, and usually presents itself in the form of a cryptic error at the top. Developing for iOS is considerably easier.

So there's still a fair amount of expertise to develop if you're completely new to mobile development. Take it for what it is -- an abstraction, and as with any abstraction, any concrete manifestation will have its issues, and you must be ready to roll up your sleeves to figure it out. And it does get keep getting better with every subsequent release.

But it does eventually help -- we have to get the complex bit right once, and then it simply works. Don't approach this like you would approach an Android app -- make sure you understand UI design best practices -- especially reactive design and data binding.

We also have .NET stack, so I'm finally in this beautiful world where all my logic is represented as C# Expression Trees on the server side, that gets serialized and pushed down to our Xamarin Forms Apps. Looking forward to WASM adoption, so I can finally get rid of that JavaScript mess.

So if you're writing a one-time app, and you just want to target Android/iOS, and you don't care how you've done it, no it doesn't make too much sense.

But if you're trying to make a long-term bet, in this awful fragmented device-oriented world, (and having to write the same app twice goes against the very nature of your existence), well that's my bet, I will be cautiously optimistic. If you're on .NET, it's a no-brainer -- there are simply too many other benefits to ignore, and philosophically very true.

The architecture itself (Forms, Xamarin.Android, Xamarin.iOS, Custom Renderers, Platform Effects, Bindings to access native libraries) is theoretically flawless (or very close to it), a work of art -- and I'm a sucker for theory, no matter the real world pain.

Post reply on HN