Is C# / Xamarin a good choice?

Discussion in 'Mac Programming' started by nmaxcom, Feb 5, 2017.

  1. nmaxcom macrumors member

    Aug 28, 2014
    So, right off the bat, I'm happy to learn or refresh C, C++, C#, Swift... I like them all (ok I don't like Swift that much :p).

    I'd love to do some small (medium?) Mac Apps that might want to turn into Android/IOs apps. Plus, I'm investing in learning more C# for a Windows project. So staying away of other languages would do wonders to my sanity.

    For those reasons I looked into C# and Mac and found the Xamarin effort and the Microsoft + Xamarin effort.

    I've been fiddling a bit and it doesn't look too bad. I love that I can write C# to create an app for Mac, IOs, Android, Linux... I don't like having to smash Xamarin, Xcode and who knows what else together to do it. (AFAIK, Xamarin for the logic and Xcode for the UI). There's also Qt there, not sure if it's worth mentioning.

    I'd love to have the input of other Xamarin.Mac developers about the bugs and the little messy workflow and so on and help me decide if maybe I should drop the hybrids and struggle more going for Objective-C / full on Xcode. Since I haven't gone that route and it's not easy to find videos to see the workflow/how comfortable it is that experience... I'm all ears.

    I'd love to keep my C# and also be able to design wonderful UI's.

    Any and all advice is welcome guys!
  2. spiffers Suspended

    Apr 12, 2009
    I would go for Swift, its getting more and more support across platforms, there is a group working for getting it run on Winblows and Android as well. Objective C is supported on multiple plattforms, but it will not have the same momentum as Swift. And do not even think of running Mono or PhoneGap or some **** like that, its just another layer between you and the metal, something that slows crap down.
  3. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar

    I got my current job showing how much superior native apps are compared to Xamarin, Phonegap, and Titanium apps and now work rewriting all of our inhouse apps natively.

    The problem with Xamarin and other "build once, deploy anywhere" type of development tools is that unless your application is extremely basic, it'll break down very quickly and you'll end up with bugs and quirks and have to try and troubleshoot whether its your code, a bug in Apple's stuff, a bug in Xamarin, or something else. You also (unless somethings changed since I last used Xamarin) can't do a lot of the lower level stuff directly, like using Core Animation or Core Graphics.

    I would suggest learning Swift. It sucks at first, but after using it for a bit you really come to appreciate the things it does (especially if you currently work with C#).
  4. nutjob macrumors 6502a

    Feb 7, 2010
    Although there are versions of Swift targeting non-Apple OSes , they're not really usable right now and there doesn't seem to be a lot of development activity around them. If you want cross platform support Xamarin works now. Your comment about Mono is uninformed, Xamarin compiles to object code on the iPhone and you can do the same for the other platforms (so called AOT) if you want.
    --- Post Merged, Mar 8, 2017 ---
    When did you last use Xamarin?
  5. padams35 macrumors regular

    Nov 10, 2016
    I've used MonoDevelop/Xamarin. It's a sweet C# IDE but the cross-platform aspect is overrated. Unless you stick with GTK# it is easy build a GUI for one system that raises NotImplemented like exceptions on another. I had a really bad experience a couple years back when an indie game project I was on committed to using C# WinForms and I discovered too late to protest that the Mac side of WinForms was still full of placeholders.
  6. spiffers Suspended

    Apr 12, 2009
    Swift for Ubuntu is rapidly evolving, so Im thinking you are the less informed one. I work on a team, we used to have Xamarin and Phonegap "developers", now they are gone. Both "languages" are separated from the metal with another layer, and one is depending on yet another organisation to get the crap together when there is a bug in the framework. And you also depend on them to get their arse in gear to release updates after Apple releases theirs.

    Working in Swift or Obj-C brings one closer to the metal, and there is just one organisation you are depending on.

    Dependency is evil, so keep it to a minimum. Code smart, code native.
  7. kiwipeso1 Suspended


    Sep 17, 2001
    Wellington, New Zealand
    Just learn Java, then you have Mac, Windows, Linux, and you've covered Android and most of how iOS works.
  8. DavidLeblond macrumors 68020


    Jan 6, 2004
    Raleigh, NC
    For mobile development at work I've been working with Ionic. Probably not a popular opinion here, but I wouldn't do it any other way these days.

    That's mobile only though, I'm afraid.
  9. nutjob macrumors 6502a

    Feb 7, 2010
    You seem unable to grasp the requirements here. The issue is how do you develop across platforms. The solution is not to learn 5 different languages for 5 platforms. Again, I say you're uninformed becuase you keep on talking about being "close to the metal" but your Swift compiler compiles to the exact same object code that the Xamarin compiler does, on any platform. The extra layer you talk about is for adapting the common language to all platforms, a minimum and minimalist requirement. With Xamarin you have full access to the source code so you don't depend on anyone to fix bugs, or work out if they are bugs.
  10. AdonisSMU macrumors 603

    Oct 23, 2010
    I need to start looking for iOS/Swift jobs. I am currently doing JavaScript, CSS stuff....ReactJS, NodeJS, SASS. I like Swift. It feels very natural for me coming from JavaScript. I'm currently building out a CMS in ReactJS and I just "completed" a pure Javascirpt library I built from scratch. I want to do native development now.
  11. 960design macrumors 68030

    Apr 17, 2012
    Destin, FL
    Learn HTML5 / CSS3 / JavaScript (ES6) / any backend language you like ( Java, RoR, PHP, C#, ect )

    Take that knowledge plus learn Single Page Application development ( Angular2, Ember - I like this one, ect ) and write applications that can be deployed on every OS.

    You can use something like to package up the SPA ( single page application ) into a native application for Mac, Windows and Linux. A great benefit of deploying as a web application is that it is easy to port to native iOS and Android. The backend could be local or remote ( or both, especially with mobile ).

    Good luck and let us know what you come up with!
    --- Post Merged, Mar 13, 2017 ---
    You can do so much with JS right now.
  12. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    Native really is the way to go. The only people I find opposed to native are those who are one trick ponies and only know web languages and don't want to learn anything else.

    I had a meeting last week where I showed a partial rewrite of a web app shoehorned into mobile vs a native swift app and not only was the swift so much cleaner and easier to read through, but there was so much less code in my version verses the original. The error checking code alone was hundreds of lines shorter and even those who didn't know Swift could read through what was happening.
  13. spiffers, Mar 16, 2017
    Last edited: Mar 19, 2017

    spiffers Suspended

    Apr 12, 2009
    I head a department of + 20 developers, so I know the ins and outs for most platforms. He asked on a Mac centric forum, under "Mac Programming", then the only answer is Swift or Obj-C.
    We have done cross platform stuff before, but the lack of support, long time of getting updates and buggy frameworks, got us back to native. We do not have the time to work on bugfixes on frameworks authored by others, we have to focus on our own portfolio and clients. Our experience with the different cross platform frameworks was that we could deliver mediocre apps pretty fast, but we do not deliver mediocrity. If we want performance and stability, we have to work native, on all platforms. For us is the crap you mentioned not an alternative.
    Im done discussing this, have a nice day :)
  14. 960design macrumors 68030

    Apr 17, 2012
    Destin, FL
    Just to speak up for the 'one trick ponies'. I prefer web languages because of deployment and maintainability. You are correct writing to the source is much cleaner / simpler.

    For example, client wants a maths flash card application.
    You would write an awesome application in swift. The client says, but I want to use it on my Android. You are an amazing programmer and write it in java. Client says thanks, my son's teacher wants to use it in the classroom. Can you make it into a Mac OSX application. Absolutely... only a little tweaking to get the iOS swift to work with Mac OSX. Teacher calls back, but we have four old dell laptops... can you get it to work natively on them as well. Sure, sure... you port over the java code ( because why would you want to write it in .net or C# at this point ). Then the teacher's friend calls and asks if you could get it to work on their classroom set of chromebooks. At this point you almost give up, but love a challenge. You rewrite the application in HTML5/CSS3/JS using SPA tech ( Ember.js for example ) and low and behold you are amazing!!

    Two weeks later everyone calls you and says that for some crazy reason whenever it subtracts 3 it gets the wrong answer. You consider purchasing a boat and sailing around the world... far, far away from people.

    This scenario sounds silly, but is the reason I know so many programming languages. Started with basic over 30 years ago on a TI/99-4A and have moved through C, C++, C#, Java, VisualBasic, Objective-C, Swift, JS, PHP, SQL ( is that even a language? ), and dabbled in many others. I now prefer to deploy applications based in HTML5/CSS3/JS/PHP because the internet of things is happening right now and may continue far into the future.

    I have similar meetings and show how developing multiple code bases costs more money, takes more time, requires more staff and produces a differing product ( meaning they look and act slightly different ) across platforms.

    For your scenario swift seemed the better choice. As a caveat, I'm currently writing a swift application that will deploy only on iOS devices, because it is cleaner/faster. If it becomes popular, I may have to rewrite for multiple operating systems. No doubt, these are the troubles all application developers want to have.
  15. BHHOWARD macrumors newbie

    Mar 16, 2017
    I have Objective-C/Swift/Android/Xamarin experience developing native applications.

    IMO Xamarin provides the most cost effective/time-to-market way to produce native Line Of Business applications intended to be deployed on iOS/Android. You will want to design your solution with multiple projects to ensure separation of concerns to receive the value of Xamarin as a cross-platform development tool. That said, you will not get away from a strong understanding of each platform to be successful. This includes reading Objective-C/Swift/Android java posts on implementations for that platform and converting that to C#.

    It appears you are using Xamarin.Mac or Xamarin.iOS for the UI and Xamarin PCL for the business logic. There is also the ability to use Xamarin.Forms to create a UI that adhere to each platform's specific implementation (e.g. tab on top or bottom) as long as the screens are similar in function across each platform. Xamarin.Forms has a fairly large learning curve to produce the UI experience you want in each platform. In addition, Xamarin.Forms recently announced support for Mac and is in their nightly builds. Also to note, Xamarin.Forms XAML is scheduled to undergo tremendous change with the MSFT acquisition.
  16. nutjob macrumors 6502a

    Feb 7, 2010
    Wow, you sound like a great manager! Congrats! Clearly I'm wrong and your amazing staff of 20 makes you right regardless of any sort of facts that I might bring to bear. But let me humbly retort in the face of your importance:

    Firstly, you didn't read what the OP was asking, which was for a cross platform solution with a single language, instead you relied on the name of the forum. Secondly you demonstrate your lack of understanding of the Xamarin system, which provides the ability to deliver native user interfaces while using a common language and runtime. Even though Xamarin provides UI "frameworks" they are optional (beyond language support). Thirdly you seem to have missed the memo, even after I point it out a couple of times, that Xamarin is indeed a native compiler. It's the same thing as a Swift compiler, just in a different language. They both compile down to the same code that executes natively. So native APIs, native compiler.

    Finally, my sole interest is in correcting the record and providing an informed and technically correct discussion. Whether you read it is irrelevant.
  17. spiffers, Mar 19, 2017
    Last edited: Mar 19, 2017

    spiffers Suspended

    Apr 12, 2009
    I read the OPs question, and I still advice strongly to go native and not learning the "semi-native" crap. Yes, the codebase is "almost" the same when compiling a Swift app or a Xamarin app, Xamarin has a overhead of misc stuff, Swift does include the runtime at the moment, but as soon as the ABI is set, that will go away. So then there will be bigger difference between native and "native". Further there will always be a lag between when new APIs are released by Apple, and till Xamarin cathes up. It will always be a game of catchup.
    But there is a big issue here, Xamarin is not a language, but a C# wrapper and some frameworks and tooling.
    And don't forget who is behind the pile of stink. Even if you gild a turd, its still a turd.

    For an indie developer with windoze background, could be the absolutely only reason why someone would go that route. I would still recommend them to learn Swift and Cocoa, and get rid of any reminders of that Seattle based pile of crap.
  18. DaveP macrumors 6502


    Mar 18, 2005
    Well, at least you are making it clear that you are biased.

    I have a lot of experience developing iOS, Mac, Android, and Windows native apps and limited experience with multi-platform options. It seems a lot of native developers tend to be elitist towards native development and look down on multi-platform or web based technologies, something I can have a tendency to do as well. But non-native can be perfectly viable as well. The details and complexity of the application are an enormous factor. For a relatively simple app, HTML5 could be a perfectly acceptable solution. And speed may be irrelevant. Even giving HTML5 a 100x performance hit may be trivial if the native code executes in 0.3 microseconds, a user isn't going to notice the increase to 0.03 ms.

    Also, keep in mind these technologies change rapidly. One's opinion and perspective may be based on their experience from 3 years ago and things may have changed considerably since then. Every approach has pros and cons and they must be weighed. There is no single answer for everyone.

    I will echo BHHOWARD's point that even with Xamarin you will likely need to understand each underlying platform.
  19. nutjob macrumors 6502a

    Feb 7, 2010
    Hmm, you said you were "done discussing this," so there goes your credibility, but let's move on...

    I don't think anyone would argue that using native tools and languages is more comfortable, the problem is it's just not practical unless almost all your code is platform dependent. Writing the same code in different languages 4 times, correctly, and maintaining it, is next to impossible for a sole developer or a small team. The duplicated codebases that do the exact same thing (or are supposed to) can become a critical problem for large teams. When you don't have a single code base that is a common point of reference and co-ordination, things start falling apart quickly.

    As I mentioned, the problems you pose, like new APIs can be solved locally and easily. In that case you can write your own interfaces and use the official ones later. It's all fully open source.

    But you really don't know what Xamarin is. It's essentially just glue that allows you to use not just C#, but any CLI language with several very popular platforms (if you can import the appropriate APIs to your preferred language). It's not a framework. It's not a C# wrapper. It's not a turd. Before you start complaining that it's glue: every other compiler also has to provide some sort of glue to interface the language to the platform. Even "native" compilers.
  20. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    Keep pushing for Xamarin, it keeps me employed when I'm hired to rewrite Xamarin, Phonegap, and Appcelerator spaghettiware into native code ;)
  21. kilon macrumors newbie


    Nov 12, 2008
    Athens , Greece
    You can write native code with any language because even the most stupid language has a FFI to C. Obviously C# is no exception.

    Native code by the way is ONLY machine code. That's the only thing that the machine understand hence why everything is obliged to output machine code or else it won't execute.

    C is the best at generating machine code.

    The problem is how easy it is compared to using an official language.

    Definetly not as easy.

    The choice is yours in the end the user only cares about the result not the method.

Share This Page