Quality Coding
Shares
Emoji: Graduation Cap

Advanced TDD Workshop for iOS Developers — On Sale Now

Shares

Have you done a few TDD exercises, but wonder how to bring it to your actual production code? Are you doing TDD in production code, but only for the simplest business rules? Did you TDD something only to feel it went poorly, and left your code worse off? Then it sounds like you’re ready for an Advanced TDD class.

Continue reading

iPhone above hand

How to Localize a Mobile App for International Markets

Share

(While I’m busy writing my book, here’s a guest post on a topic close to me. I grew up in Japan as an American citizen, so I know how tricky it can be to cross cultures. Elisa Abbott gives us an overview of how localization is more than translating strings. —Jon)

As the world’s population is entering a phase of unprecedented growth, it’s essential to recognize that more and more people will own a smartphone. Billions of people don’t speak English as their native tongue, and maybe don’t know it at the most elementary level. This brings us to the idea that a high-quality localization (abbreviated l10n) of your app isn’t just an advantage — it will eventually become an indispensable part of app development.

Localization  is the process of integrally translating your app content, yet also taking into account the linguistic peculiarities of a particular region. While this appears to be a very lengthy and strenuous process, research suggests that it has astonishing returns on investment. In this article, we’d like to look into the technicalities of localizing your app. Let’s dive right in, shall we?

Continue reading

Don't Lose Your “Flow”… Quickly Generate Test Code!

Subscribe to Download these FREE Code Snippets
Languages: Swift and Objective-C
IDEs: Xcode and AppCode

You’ll get our newsletter on Clean Code techniques for iOS developers. And you’ll get instant access to these code snippets!
We take your privacy seriously. See our privacy policy here.

Emoji: Fearful Face

Don’t Give Up on TDD Before Reaching Your Breakthrough

Shares

Dan Abramov recently tweeted:

That’s the beginning of a thread, so there’s more to it. But it gives me a chance to say to Dan, and the many folks who’ve shared this: You can still grow in Test-Driven Development. (Heck, I’m still growing.)

But instead of short tweets commenting on other short tweets, I thought I’d reply here. There’s room to discuss the gray areas.

Continue reading

Emoji: Two Magnifying Glasses

Refactoring: How Do You Clean a Mess?

Shares

Refactoring is moving in small steps, with each step verified by unit tests. As I demonstrated last time, these steps are much smaller than most people are used to. Let’s continue the same example to learn some new things about refactoring.

Reading is not as good as doing. I learned from the folks at Big Nerd Ranch that our brains make important connections when we type code. Download my code and walk through the refactoring steps yourself.

Continue reading

Emoji: Magnifying Glass

When You Refactor, Are You Using Small Steps?

Refactoring remains a much-misunderstood discipline. Even when folks do have unit tests to back their changes, how long does the code stay broken? Let’s return to the idea that refactoring happens in very small steps.

No, even smaller than that.

Continue reading

Emoji: Dice

Why Is Random Order a Big Deal for Test Quality?

Shares

Have you ever seen a unit test pass in isolation, but fail when run in a suite? Or vice versa, pass in a suite, but fail when run in isolation?

Besides the other improvements for test-centric workflows, Xcode 10 brought a rarity: a new XCTest feature for unit tests! Randomizing test order will help us flush out mistakes in the design of our tests.

Let’s start by examining a symptom… Have you ever seen naming like this in a test suite?

func test01RunThisTestFirst() { … }

func testCheckSomethingElse() { … }

This is a dirty trick to get the top test to run first, before any other tests in the suite. It relies on the fact that currently, tests within a suite run in lexicographic order. 01 comes early in ASCII, so test01RunThisTestFirst will run first.

Continue reading

Xcode beta

Joy! Xcode 10 Promises to Improve Test-Centric Workflows

Shares

Every WWDC, I hope for improvements to unit testing — but have learned to expect disappointment. So at WWDC 2018, I was surprised to have my low expectations thwarted! Xcode 10 brings changes that will improve my test-centric workflow.

For several years, Apple’s changes for test support have underwhelmed me. They focused on:

  • Xcode Bots (…I tried them. I gave up.)
  • Performance tests (…My code is not performance-critical.)
  • UI tests (…I don’t write any.)

With Test-Driven Development, unit tests run locally are my primary tool. The features above may have helped some people, but I wasn’t one of them.

So what did WWDC 2018 bring me? Here’s what I see on the horizon with Xcode 10.

Continue reading

Emoji: Rescue Worker’s Helmet

Do You Refactor without Tests? It’s Time for Safety

When you refactor, do you have unit tests covering you? …If not, why not? …If so, how do you know?

To me, it seems that the state of refactoring has gotten worse across the industry. Both managers and programmers and managers say the word “refactoring” more than ever. But they almost always mean, “I’m going to change a bunch of stuff. Then at the end, we need to make sure I didn’t break anything.”

But that’s not refactoring. That’s rewriting.

Continue reading

Emoji: Speech Balloon

How to Improve Code Comments with Little Refactorings

Does your code have comments? Sometimes they’re helpful. But most of the time…

Disclosure: The book links below are affiliate links. If you buy anything, I earn a commission, at no extra cost to you.

As Jeff Atwood explains, code tells you how, comments tell you why. A well-placed code comment is a level above the code itself, explaining why something is written the way it is. But! We can express most comments as code, using well-named identifiers. The Refactoring book calls this Introduce Explaining Variable. Martin Fowler has since renamed that refactoring to Extract Variable to help folks find it in their IDEs.

Continue reading

Emoji: Nose

How Many Code Smells Can You See in This Short Method?

It’s time for a quick exercise in code smells!

How many code smells do you see below?

Continue reading

1 2 3 12
>