Hub · Blog

23

May

From .NET to iOS — what I learnt during my break through to the ‘other’ side

For the best part of the past ten years, I’ve been a software developer, with the majority of that time building .NET applications. Microsoft has a platform that enables languages such as C# to be incredibly powerful, constantly evolving, and expressive, yet easy to read and follow. Technologies such as ASP.NET MVC, WebAPI and EntityFramework remove much of the complexity from the developer, allowing them to concentrate on their primary tasks — building and releasing software.

Recently, I was given the opportunity to cross-train, learn and contribute to judo’s iOS native SDKs. Given the above, I surprised myself with how quickly I jumped at the chance. I’ve been working with the SDK team for just over a month now, below are some initial thoughts from my jump to the ‘other’ side.

Visual Studio to Xcode

In the beginning, I found myself dismissing Xcode as a Visual Studio Lite, or something similar. However, once I had recovered from the initial culture shock, I found myself warming to Xcode. Sure, it’s not as feature rich as Visual Studio and I found debugging to be a pain at times, but Xcode is rich and intuitive enough to allow a novice such as myself to quickly develop Cocoa applications. Given that the best thing about Visual Studio at the moment isn’t native to it (hello ReSharper!), there might not be as much difference between Xcode and Visual Studio as I initially feared.

Cleaning up

One of the luxuries of working with .NET is not having to be concerned with cleaning up unwanted heap objects. Apple opted for a model of Automatic Reference Counting in Objective-C and Swift. While both languages do *most* of the leg work for you (the Objective-C and Swift pre-compilers deal with the headache of the alloc/retain/release statements), I found it a chore to have to worry about strong/weak/unowned references, and the potential pitfalls of getting it wrong. That said, in an ecosystem that is heavy on graphics and user interaction, having a memory management model with a smaller footprint is desirable.

Swift is the future of native iOS development

At judo, we have SDKs written in both Swift and Objective-C, so I have to become familiar with both languages. However, for my personal projects, I’ll only be using Swift. For me, Objective-C looks and feels aged, while Swift’s syntax gives familiarity with other C-based languages, while providing enough differentiation for the language to feel fresh and modern.

One of Swift’s biggest strengths is its strong focus on immutability. It nudges you towards creating constants over variables and structs over classes (structs can have their state changed but you must explicitly mark the method as mutating in the signature). Limiting what can be modified at runtime helps to ensure cleaner code and (hopefully!) less bugs.

Another area Swift does well in is it use of Optionals, which languages like C# and Java don’t support for reference types (unless you hand roll your own). Having a type that is guaranteed not to be null unless you mark it as Optional takes away much of the pre-condition and guard checking that bloats code bases in other languages.

Both sides of the fence

Learning new things is always good. In software engineering, anything that enables you to cast aside dogmas or preconceptions is even better. The more strings you can add to your bow, the better it is for you and the organisation you work for. In addition, exposure to our native iOS development has brought me closer to the experience of our customers, which for any developer is invaluable.

These are some excellent Pluralsight courses that aided me:

https://app.pluralsight.com/library/courses/swift-in-depth
https://app.pluralsight.com/library/courses/ios-9-fundamentals
https://app.pluralsight.com/library/courses/ios-dotnet-developers

More on ARC:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html

 


About Judopay · Judopay simplifies in-app payments, enable frictionless checkouts and intelligently prevents fraud for leading companies globally. Our payments and mobile experts help guide businesses and their development partners to create best in class apps to make paying faster, easier and more secure. Founded by serial financial technology entrepreneurs in 2012, Judopay is backed by leading venture investors and supported by banking and card scheme partners to offer in-app payments that are simple, frictionless and protected.

Contact us, we'd love to hear from you

* Required. We will get back to you soon and we never share your details.