Starting a new project : PCL or Shared

Xamarin Team talk about pros and cons better than me. So follow the link below.

http://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

Shared project

> You only plan to target Android, iOS and Windows Phone
> You want to start coding as soon as possible
> You don’t plan to use Xamarin but you want to see how it works from a closer look
> You are familiar with #if directives

It works like if you were adding files as link. Every platform’s project will add the files from the shared project as a link. It means that when you add a file in the shared project, every reliant project will add this file.

PCL project

> You plan to use the project in other projects like an ASP.NET project, a WPF project, a Windows 10 app etc.
> You want to reduce dependencies
> You want to separate concerns

Conclusion

I’ve tried both way. I prefer the Portable approach. I’ve always been a huge fan of Portable Class Library and dependency injection. I felt I was coding the base of my application faster with the Shared project at the beginning. As an exemple, you can log what you want in the shared project because you have access to the Debug class. With PCL project, you don’t. So, you have to create an interface of a LogService and its implementation on each platform (e.g. AndroidLogService, iOsLogService, WinPhoneLogService). It’s the same thing with HTTP request : in the PCL project, you don’t have access to the HttpClient class. Thus, we have to make some extra work that isn’t necessary with the shared project.

If you don’t know PCL and dependency injection yet, you may start with the PCL approach as you will learn new interesting things.

Xamarin pricing & editions

Start with Xamarin

When it comes to chose between all editions, you have to keep in mind few a things.

First, take a year subscription instead of a month subscription. It will cost the same but with the year subscription, your licence will still be activated. You won’t be able to download new release if you doesn’t renew your subscription. Whereas with the month subscription, your account will be disable when you stop your subscription.

All prices are given for only one developper and only one platform. It means that if you want to target both Android and iOS, you will need 2 licences. If you add Windows Phone support, you will need another licence. No need to be good with math, iOS + Android + Windows Phone = 3 licences required. You can add more target over time : you don’t have to pay for all platform. Especially if you plan to target a particular platform first (most of the time, you will start with either Android or iOs platform).

4 editions

They are 4 editions : Starter (free), Indie (300$), Business (999$) and Enterprise (1899$).

The Starter edition is useless in my opinion : you can’t try Xamarin Forms because of the maximum size restriction. You may use this edition to check that your installation is fine. But don’t rely on this edition, you can’t expect starting your project with it.

The Enterprise edition isn’t affordable for most of developers. 1899$ per platform = 5 697 $ a year for only one developper.

They are 2 editions remaining : Indie and Business. The Indie edition cost 299$ while the Business edition cost 999$. The main difference is Visual Studio support. If you are familiar with Visual Studio, you can imagine how much you can increase your productivity with it. The integration in Visual Studio is almost perfect. I worked with the Business edition and Visual Studio for 4 months. You can develop an iOS application from Visual Studio on a PC and a remote Mac with “Xamarin.iOS Build Host”. But don’t get confused, you will need a Mac with any edition.

Now that I work for myself, I’m using the Indie edition. The main reason is that a Mac is required to build iOS app. I made the choice to buy a second hand iMac 27″. Then, I tried Xamarin Studio for a month. The goal of this trial was to find an answer to this question : “Can I live without Visual Studio ?”. The answer is yes. I was reassure when I loaded a 4 months old Visual Studio project without any trouble. I could even deploy and test it on some device or in any simulator. I would even say that Xamarin Studio handles nuget packages better than Visual Studio.

Xamarin installation process

Xamarin installation is one the easiest one i ever done as a developper both on Windows and Mac. It’s fast, doesn’t add tons of software (I aim Visual Studio with all Sql Server, all languages packages, all… It really hurts when you want to uninstall them).

I find working on a Mac the cheaper way to develop Xamarin Forms application. You will save 700$ per platform per year ! Which is, in my position, something I can’t ignore. For 2 platforms, i already saved 1400$.

A last word, 700$ isn’t expensive at all for an individual developer considering the benefits it provides.