Monday, March 18, 2013

Objective-C code side-by-side C# code.

Podcast interview with Miguel de Icaza @ Hanselminutes
mentioned nice side by side comparison of Xamarin's C# vs Objective-C.

How it Works - Xamarin 2.0:

C# with Xamarin

var attrs = new CFStringAttributes {
    Font = listLineCTFont,
    ForegroundColor = UIColor.Black.CGColor
};

var astr = new NSAttributedString ("Hello World", attrs);

Objective-C

CFStringRef keys[] = {
    kCTFontAttributeName,
    kCTForegroundColorAttributeName
};

CFTypeRef bval[] = {
    cfListLineCTFontRef,
    CGColorGetConstantColor(kCGColorBlack)
};

attr = CFDictionaryCreate (kCFAllocatorDefault,
    (const void **) &keys, (const void **) &bval,
    sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks,
    &kCFTypeDictionaryValueCallBacks);

astr = CFAttributedStringCreate(kCFAllocatorDefault, CFSTR("Hello World"),

He also mentioned F# even more concise syntax, and is coming to mobile, too.

With this update, Mono Touch and Mono for Android are also renamed
to Xamarin.iOS and Xamaring.Android,
and now there is a free edition (limited only size of compiled app).

Xamarin may be great, and there are advantages to C#,
modern, unified strongly typed language, the system is quite complex and large.
Xamarin comes with a slick installer, but even for simplest package,
download size is about 1.5 GB (mostly due to Android updates)
plus you need a Mac computer with XCode, that is another GB+.


Compared to web-based apps with cloud builds (i.e. Telerik Icenium)
where simple apps can be created in minutes, it is almost no comparison
for simple apps where web is sufficient.

No comments: