Wednesday, August 20, 2008

Kevin Hoffman: 'iPhone Development from the .NET Perspective'

Published: 09:00 AM EST At WWDC, noted author and cross platform development expert Kevin Hoffman presented a comparison of Apple's iPhone development tools with those available for Microsoft's
Windows Mobile. Until now, his comments remained unpublished, but an attendee's notes on the subject provide some interesting insider observations.







Related AppleInsider articles:* Apple's open secret: SproutCore is Cocoa
for...
* Steve Jobs to showcase OS X, iPhone platforms... *
Coming to iPhone: Instant Messenger, EA's... * "http://www.appleinsider.com/articles/08/03/06/apple_announces_iphone_2_0_software_and_sdk_beta.html">Apple announces iPhone 2.0 software and SDK beta * "http://www.appleinsider.com/articles/08/02/07/apples_safari_3_1_to_support_downloadable_web_fonts_more.html">Apple's Safari 3.1 to support downloadable web...
.NET Addict Hoffman has written a series of books on Microsoft's .NET development frameworks and maintains The .NET Addict's
Blog
. He is relatively new to developing in Cocoa, but his understanding of both platforms gives him the unique ability to compare the two side by side. At last year's WWDC, Hoffman presented
a comparison of .NET vs. Cocoa. The session was so popular that he was invited back this
year to talk about the mobile versions of both: Microsoft's .NET Compact Framework and Apple's Cocoa Touch, used in the iPhone and iPod touch. Hoffman's presentation shed some light on the
productivity and market potential programmers can expect when targeting iPhone development, and subsequently the code quality and quantity users can expect from mobile developers. .NET CF vs
iPhone SDK For Windows Mobile development, Microsoft provides Visual Studio 2008 .NET CE 3.5 for development frameworks and SQLServer 2005 for database storage. Apple provides the UIKit for
building graphical applications and includes SQLite on the iPhone. Database Storage Hoffman noted that Microsoft's SQLServer "requires less hands on coding than SQLite," and that there's "more
going on behind the scenes." On the iPhone, SQLite uses SQL query syntax and leaves "object relational mapping up to you. There's no CoreData" on the iPhone as there is in the Mac desktop
environment. Development Frameworks On the other hand, Hoffman points out that while Cocoa Touch presents a consistent view-based controls hierarchy, the Compact Framework "steers you down the
wrong path." Its "double click and code" design results in spaghetti that's hard to reuse, because form and form code are merged together. Last year, Hoffman described the same principle with
regard to their desktop equivalents: Microsoft's Visual Studio does not encourage MVC (Model-view-controller). It's too easy to
stick code in views, for example, making development �spaghetti-friendly.� In contrast, Apple's Xcode �bakes in� MVC principles. There is no real choice in doing things in sloppy ways, and
�that's a good thing.� Graphics & Animation Compact Framework includes DirectX Mobile, a 2D programmable graphics engine that is not easily available to controls. The iPhone uses Quartz 2D,
which is available to controls. CF's Direct3D is extremely low level and not hardware accelerated. Developers must write their own game loop. There is "no compromise between static forms and
DirectX." In contrast, the iPhone uses OpenGL ES. As with Core Animation, everything is a view on OpenGL, and graphics are hardware accelerated on the iPhone. Different goals for WinCE and the
iPhone The differences between the two reflect different design goals at Apple and Microsoft, Hoffman pointed out. Compact Framework supports tall, wide, and small displays. Windows Mobile
devices typically use a stylus and hard buttons versus the iPhone's touch screen. CF controls don't even have a double-click handler, while the iPhone doesn't have or need menus. Layers of
abstraction Talking about hardware abstraction, Hoffman said, "people assume that low level is bad," but described that you "can be close to the metal and write little code." The iPhone presents
a choice of layers to develop at, based on developers' needs, while with Microsoft's Compact Framework, there's "often no choice in layer available." "If lower layers are bad, adding more layers
on top won't help," Hoffman said. "Compact Framework is built on Windows Mobile, and shares too much in common with Win32." He described the design as a "palace on a trash heap." Application
deployment Even once a project is finished, Hoffman pointed out that another big difference between the iPhone and Windows Mobile relates to how developers get their apps in the hands of users.
With Windows Mobile, you build an MSI (Microsoft Installer file) and distribute it to the customer yourself. They register the MSI with desktop ActiveSync, plug in the device and sync over the
app. In most cases, they also need to perform an SQL 2005 install, along with an Compact Framework 3.5 install, as that software may not be up to date on the device. Afterward, there are
additional steps on device itself required to install it. The scaled-down computer environment of Windows Mobile devices means users can easily delete components of your apps, breaking them, and
requiring extra support to figure out how to reinstall the missing components. On the iPhone, developers simply build their app and send it to Apple. The iPhone has "one source for deployment and
shopping," so users are far more likely to find your app. Apple handles the financials, presents users with automatic access to the App Store, provides piracy protection using FairPlay DRM, and
manages your marketing. "Best mobile development platform ever" Hoffman summed things up by contrasting Windows Mobile using a "crushed down version of Win32" with an "inconstant user
experience," while the "iPhone is the single best mobile development platform ever." He also noted that "writing Mac applications has made my Windows apps better."







No comments: