I originally wrote this post in August 2010 as part of series concept: “Developing on iOS for the .Net developer.”  If anything, the topic is even more relevant today and I plan on expanding the series so I’m including it here – with a few updates - in the new site.


s mentioned in the
previous entry of this series, I
'm currently surveying offerings from the "other side". That is, when I recently awoke to find myself owning (unintentionally and completely by accident) an iPhone, iPad, and Mac, I resigned myself to making the best of it and cracked the boxes open to see what was inside.

Yeah. That's how I'm telling the story.

The truth is, beneath it all I like new, cool technology. And the iPad is definitely new and cool. So to pacify that inner techie, and to try my hand at iPad development, I bought a Mac, without which there can be no iPad development to speak of. While I bumble my way around this new and somewhat foreign Apple landscape, I'm recording my experiences for the benefit of other Windows developers looking to do the same.

The Hardware

The act of buying the Mac was painless if not terribly unique. I walked into my local Best Buy store, grabbed the Mac mini box off the shelf (I swear, I have books that are larger) and headed home (stopping briefly at the register to pay). The mini is pretty basic. It comes with no monitor, no keyboard, no mouse. And I was mostly content with this since I have these already.

I say "mostly" because there's a part of me that really wanted to go native, to follow the spirit of Saint Ambrose's advice: when in Apple land, do as the Appleonians do. But that part of me, which clung to the ideal of Apple peripherals on Apple devices, was very much at odds with the beautiful, fulfilling, symbiotic relationship I have with my keyboard.

Don't look at me like that. Lots of people who type for a living develop a dependency on their keyboards. It is not something to be trifled with.

So I was a little concerned, since Apple peripherals are of a different breed than my precious Microsoft natural keyboard and Explorer mouse combo, but as it turns out I needn't have worried. I just plugged the USB cable in alongside my monitor cable and sound input using a generic USB switch and was up and running in seconds. The Mac detected my wireless network too. Nothing sinister surfacing for Windows users so far.

The Operating System

OSX is fine. Really. It's been a few weeks now and I've grown comfortable with it. I know where things are, it comes with Dock and Spaces, both tools that require installing 3rd party downloads for similar functionality in Windows. And it has all the familiar Unix terminal tools and directory structure, which is familiar to me. But on balance, I have to say that Windows 7 kicks its butt.

Now, now. Unball your fists and take your seats Apple fan boys. My blog, my opinions. I just call 'em like I see 'em.

To be fair, OSX stomps on XP with regard to aesthetics, and Vista's stability issues make it a non-contender. But next to Windows 7, OSX feels... I dunno, outdated. I'm sure OS11 (or OSY, or whatever the next major OS for the Mac is called) will fare better against my subjective and admittedly biased comparison, but OSX is still pretty okay. It's nothing to be ashamed of, and at the moment I see no reason to cover it deeper as the specifics aren't relevant to developing for the iPad.

Other than you have to have it to do so, of course.

The Development Environment

Which brings me to XCode.

XCode is Apple's standard development environment. If you want to develop for the Mac, the iPhone, or the iPad, you'll want to install it and the appropriate SDKs. They're available from Apple's developer site and they're “free” with the purchase of a $99.00 per year Apple developer’s license.

If you're an experienced Visual Studio developer, you're in for an adjustment. I'm not here to slam XCode. After all, I'm all about diversifying skill sets. I've dabbled in Delphi, played with Power Builder, and exercised with Eclipse. I have tinkered around with my share of IDEs on various OSs and I can honestly say that I have never found a serious development environment that made me miss Dev Studio more than Apple's XCode and its partner in crime, Interface Builder.

Each session, my blood pressure would begin to rise almost immediately. Within a few minutes I would begin reflecting on how much my Mac mini resembled an oversized hockey puck. Soon I would consider how it might be satisfying to see it serve in that capacity. Invariably I would stomp away in disgust, fuming. "How can anyone make a decent application with such a crummy tool?"

Of course, a bizzillion apps in the app store paint a different story. Clearly people can and do write apps, some of them quite good, using XCode. I knew I must be missing something.

When I actually stopped to analyze myself I found that the peculiar workings of the IDE, the seemingly unstable interactions between XCode and Interface Builder, and my general unfamiliarity of the environment itself were not solely to blame for my aggravation. I've used some really rough development tools in the past and I've certainly seen worse. But what really bothered me the most, the difference that made writing a simple application unbearable, was typing. Yes, even on my glorious keyboard, typing was a problem.

At first I thought it was my keyboard itself and this issue stemmed from the bad mojo begot from connecting a Windows keyboard to a Mac. But no. It turns out that Macs handle a few key navigation strokes differently than nearly every other operating system known to man. Keys like Home, End, Page Up, Page Down, the arrows keys, and the combinations of these with Control and Shift behave differently in ways that seem innocuous but have vile implications to those immersed in the autonomic process of translating thought into keystrokes.

Remapping Your Keys

Google reveals that a lot of people have this complaint about the Mac and in retrospect I've come to the conclusion that if Saint Ambrose had to contend with the muscle memory associated with touch typing, the "when in Rome" saying would never have been coined. So making keys work in XCode in a more familiar fashion is my number one recommendation those developers with a Windows background. It's easy, requires only a couple of minutes, and will have a major impact on your productivity.

1. Remapping "Mission Control"

"Mission Control" Screen Shot 2013-07-16 at 9.24.20 PMis Apple's replacement to their previous virtual desktop manager “Spaces”.  By default, Mission Control uses the Control + arrow key combinations by to switch between desktops. This, unfortunately, interferes with the Windows system default for skipping forward and backward between words in text editors. You can free up this behavior in OSX from the system preferences under “Keyboard Shortcuts”. I chose the "Control + clip_image002+ Arrow Keys" option as shown to the left. The non-Windows clip_image002[5] symbol signifies the "command" key which, incidentally, is just another name for the Apple key. If you're using an Apple keyboard, it possibly looks like a variation of this: clip_image002[7]. In my case the Windows key, which is positioned in the same place, serves this purpose.

This frees us up to define the Control + arrow combinations when we remap XCode.

So, note to the Windows man: for future reference, clip_image002 equals clip_image002[14].

2. Remapping XCode

For OSX in general, you can remap the keyboard by modifying the DefaultKeyBindings.dict file either directly or indirectly. XCode itself doesn't honor this file, however. Instead XCode has its own key binding mechanism which is quite a bit easier than doing it by hand. You can access this functionality from the main menu by selecting "XCode", then "Preferences". From the preferences dialog, choose the "Key Bindings" icon. The resulting dialog state is shown here.

If you want, you can change the default bindings, but I chose to create a new set, a copy of the defaults to work with. Do this by clicking on the "plus" symbol on the bottom, left hand corner of the window, and name it however you see fit.

Screen Shot 2013-07-16 at 10.05.25 PM

To change a binding, select the appropriate list item by description and double click on the second field, the column entitled "Key", putting the dialog in key capture mode. This mode hosts two more "+" and "-" buttons next to the selected list of key combinations (not shown here). You can either replace an existing combination or hit the "+" button to add a new one. Type the key combination you want to assign.

        

Below is a list of key bindings which have been most useful to me. You may find others. There are definitely Windows keystrokes that are not covered here, but even these few adjustments will significantly enhance your coding experience.

 

Command

Key Combination

 

Description

Move Word Backward

^ image

Control + Left arrow

Move Word Backward Extending Selection

^imageimage

Control + Shift + Left arrow

Move Word Forward

^ image

Control + Right arrow

Move Word Forward Extending Selection

^imageimage

Control + Shift + Right arrow

Move to Beginning of Document

^image

Control + Home

Move to Beginning of Document Extending Selection

^imageimage

Control + Shift + Home

Move to Beginning of Line

image

Home

Move to Beginning of Line Extending Selection

imageimage

Shift + Home

Move to End of Document

^image

Control + End

Move to End of Document Extending Selection

^imageimage

Control + Shift + End

Move to End of Line

image

End

Move to End of Line Extending Selection

imageimage

Shift + End

Page Up

image

Page Up

Page Down

image

Page Down

Copy

^C

Control + C

Cut

^X

Control + X

Paste

^V

Control + V

Undo

^Z, imageimage

Control + Z or Alt + Backspace

Redo

^Y

Control + Y

 

Next article we'll fast-forward to 2013 and start looking into some of the changes in technology that can make living on a Mac easier and boost your productivity immensely.


Next page:
"Postcards from Apple Land: 21 Dog-Years and Counting. Virtually."
Also in this Series:
2. Postcards from Apple Land: Muscle Memory Trumps Saint Ambrose