Quality Coding
Shares

Learning Kotlin Showed Me the Truth About Xcode

Shares

In my first-ever live stream, I used a TDD exercise to learn the basics of Kotlin. In this recording, you can watch as I let the IDE guide me, stumble through mistakes, and get help from viewers. You’ll get to see how much better a good IDE can be than what we experience with Xcode.

Aside from learning Kotlin itself, I experienced two big things. First, it showed me that with good tooling, Test-Driven Development is a nice way to learn a new language.

Second, I got to experience what it was like to do live coding on Twitch. This came about from talking with Ted Young, who broadcasts his test-driven coding nearly every day. Ted told why he does it and what he gets out of it. This gave me the courage to jump in and give it a whirl. With only a 5-minute warning that I was going live, I didn’t expect anyone to be watching. So it surprised me to have a couple of viewers jump in who helped guide me into Kotlin coding.

I don’t expect folks to watch the full 2 hours of me stumbling along. But let me give you some tips of ways this recording could be helpful to you. …Even if you’re a die-hard Swift programmer who would rather “be dead in a ditch” than learn Kotlin.

Continue reading

Kotlin icon

Kotlin! Got Any Interesting Language/Testing Tips for Me?

Shares

This week, I’m learning Kotlin. And what better way to learn a new language than by writing unit tests against the code?

What’s going on, you ask? Is the world coming to an end?

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: 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

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

1 2 3 12
>