Category: Development

PopClip + Dash = Xcode Love

I’ve written about PopClip and the Dash documentation browser, in particular how I found an issue using the PopClip Dash extension and provided a fix.

Here’s why I love the combination of PopClip with its myriad extensions and Dash while using Xcode. My standard development application launch comprises:

On my iMac, I additionally launch Kaleidoscope for file comparisons.

I always have PopClip running in the background, with the Dash Extension installed. When I select text in Xcode, the familiar PopClip menu comes up and includes the “cat” icon for Dash. Selecting that Dash icon switches over to Dash and looks up the selected text. I find Dash a whole lot more useful, easier to navigate, and quicker compared to Xcode’s Organiser.

The usefulness of Dash comes from clicking on the method declaration (it has a grey background) which copies the entire method text. Switching back to Xcode via command-tab, I do a paste and voilà, I have the method declaration in place. You could also select and copy portions of the text in Dash, if you so desire.

The best part is you’re not restricted to only the documentation which Apple provides. You can populate Dash with a whole slew of documentation, including PHP, Ruby, Python, and even man pages! And you don’t have to be tied in to Xcode – go on, be different and use BBEdit, TextWrangler, or TextMate!

As for PopClip, it’s a pity that I can only have 22 PopClip extensions… Fortunately I don’t need that many!

One more thing… I don’t use the dock to launch applications – I use Alfred instead. The dock only contains currently running applications (thanks Elaine and MacBites!). The nice thing about the Alfred Powerpack (extra cost, not much but worth it!) is that it can launch a set of applications when a short string is typed in its search field. I open Alfred (control-space in my case) and type in dev, press return and my standard suite of development applications launches.

Share and Enjoy!

Where’s Subversion gone in Mountain Lion?

I tried to use the command line Subversion application svn in my recently updated installation of OS X 10.8 Mountain Lion. Couldn’t find the command at all. Hmm… used to be pre-installed in Lion and previous versions. Looked around the interwebs and found this reference: Where is SVN on OS X Mountain Lion?. You have to install Xcode from the App Store and then download the command line utilities. svn will get installed in /usr/bin and thus appears in the default PATH.

Unit Testing in Xcode 4

One of the nice things in Xcode 4 is the integration of the OCUnit, or SenTestKit, Unit Test suite into the environment. My last foray into unit testing was with JUnit in Eclipse. I’m currently working on an Objective-C library using JSON for data transmission and needed to test its methods.

Here’s a good guide on setting up a project to use OCUnit and OCMock for mock objects – Unit Testing in Xcode 4 Quick Start Guide | Ray Wenderlich. The article also mentions GHUnit which has some additional features over OCUnit – will have to look at that too!

So I’ve written my test cases and run them. I then see several test failures which seemed out of the ordinary. Now, the test cases are written in the order I expect them to run in the file, and I noticed that they were being run in an order other than the sequence in the file, which is what I was used to in JUnit. The Unit Test documentation on the Apple developer site Xcode Unit Testing Guide doesn’t mention anything about the order of test case execution, and I could not find anything relevant on the ‘net.

After scrutinising the test case run order, I came to the conclusion that it was in alphabetical order! And now I’ve taken to numbering the test cases thusly – test_0010_xxx and so forth – shades of BASIC line numbers!

And there’s more – unit tests are by their intent, tests for a unit. Each is a single entity which performs a set of operations as an independent standalone code segment. I had instead written test methods which were dependent on the previous method’s results – not a real unit test at all, and therefore a new lesson learnt! In fact, Apple documentation states: “When Xcode runs unit tests, it invokes each test case method independently.” Might not need those line numbers after all…

So chalk this one up to experience, and blog it for all to find out!

At Iowa Code Camp

Waiting for Keith Dahlby’s talk to start on GitHub at Iowa Code Camp.

Iowa Code Camp 9

I’m presenting at the Iowa Code Camp Spring 2012 event. This year I’m speaking on Design Patterns – as it’s my belief that software developers who understand the essential principles of their art will transcend languages, libraries, and development environments.

PDF of the slides are here. Enjoy!