July 15, 2014

Better TDD: The AppCode Advantage

5  comments

AppCode is an alternative IDE for Objective-C development. When it comes to test-driven development, it’s superior to Xcode. But that’s not all. Check out the “inside-out” coding style it makes possible.

In general, AppCode lets me focus more quickly on semantics and less on fiddling with source code.

Are you interested in the AppCode templates I use?

Question: What other AppCode tricks do you like? Leave a comment below.

__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"62516":{"name":"Main Accent","parent":-1}},"gradients":[]},"palettes":[{"name":"Default Palette","value":{"colors":{"62516":{"val":"var(--tcb-skin-color-0)"}},"gradients":[]},"original":{"colors":{"62516":{"val":"rgb(19, 114, 211)","hsl":{"h":210,"s":0.83,"l":0.45}}},"gradients":[]}}]}__CONFIG_colors_palette__
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"49806":{"name":"Main Accent","parent":-1},"3a0f6":{"name":"Accent Light","parent":"49806","lock":{"saturation":1,"lightness":1}}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"49806":{"val":"var(--tcb-skin-color-0)"},"3a0f6":{"val":"rgb(238, 242, 247)","hsl_parent_dependency":{"h":209,"l":0.95,"s":0.36}}},"gradients":[]},"original":{"colors":{"49806":{"val":"rgb(19, 114, 211)","hsl":{"h":210,"s":0.83,"l":0.45,"a":1}},"3a0f6":{"val":"rgb(240, 244, 248)","hsl_parent_dependency":{"h":209,"s":0.36,"l":0.95,"a":1}}},"gradients":[]}}]}__CONFIG_colors_palette__
Previous
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"49806":{"name":"Main Accent","parent":-1},"3a0f6":{"name":"Accent Light","parent":"49806","lock":{"saturation":1,"lightness":1}}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"49806":{"val":"var(--tcb-skin-color-0)"},"3a0f6":{"val":"rgb(238, 242, 247)","hsl_parent_dependency":{"h":209,"l":0.95,"s":0.36}}},"gradients":[]},"original":{"colors":{"49806":{"val":"rgb(19, 114, 211)","hsl":{"h":210,"s":0.83,"l":0.45,"a":1}},"3a0f6":{"val":"rgb(240, 244, 248)","hsl_parent_dependency":{"h":209,"s":0.36,"l":0.95,"a":1}}},"gradients":[]}}]}__CONFIG_colors_palette__
Next

Jon Reid

About the author

Programming was fun when I was a kid. But working in Silicon Valley, I saw poor code lead to fear, with real human costs. Looking for ways to make my life better, I learned about Extreme Programming, including unit testing, test-driven development (TDD), and refactoring. Programming became fun again! I've now been doing TDD in Apple environments for 19 years. I'm committed to software crafting as a discipline, hoping we can all reach greater effectiveness and joy.

    • Anastasia,

      Yes, for Extract Variable, it would be awesome if the suggested names for mock([NSUserDefaults class]) included mockUserDefaults, or at least userDefaults.

  • Hi Jon –

    I’m returning to iOS dev after a year or so break.

    Anyhow, I’ve tried to follow along with this screencast & i’m getting errors. It seems that Appcode does not know how to link in classes from the main project.

    I follow right along with your video, but when I create the Example class & I do tell it to be part of the main target, not the test target…. then I get a linker error… app code doesn’t know where to link in Example from.

    I am using Appcode 3.0.4. I wish I could get an earlier version to try with.

    I thought rather than bang my head some more (was already banging my head on Xcode the past few days).. I’ll just hang on & hopefully you know an easy way out.

    Cheers & Thank you for all the great videos!
    Matt

    • As a quick fix, I’ve just included my SUT files into my Tests target.

      I hope Appcode fixes this in 3.0.5.. or anyone out there know a fix?

      Thank you!
      Matt

    • Yup, something broke in recent AppCode regarding project creation. My workaround is to use Xcode to create the project, then switch to AppCode.

      For an existing project, the real solution is to change your Tests target:

      BUNDLE_LOADER should be set to your app, like $(BUILT_PRODUCTS_DIR)/Foo.app/Foo

      TEST_HOST should be set to $(BUNDLE_LOADER)

      With this, you shouldn’t have to include any production files in your test target.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Never miss a good story!

    Want to make sure you get notified when I release my next article or video? Then sign up here to subscribe to my newsletter. Plus, you’ll get access to the test-oriented code snippets I use every day!

    >