The other day on reddit I found this gem:
What are common mistakes self taught programmers make when coding in objective c?
This is an excellent question. A developer who goes out of their way to ask what mistakes they might be making is a developer who cares about getting better at coding. And if you care, you’ll get better. Guaranteed.
So, what’s the biggest mistake new iOS developers make when coding?
Not writing unit tests.
And if you’re a new iOS developer who doesn’t write unit tests, you’re not alone — I’ve worked on projects with dozens of iOS developers, and I can count on one hand the number who wrote unit tests before I joined the project. (Those who wrote unit tests also happen to be, not coincidentally, the best developers I’ve worked with.)
But why? Why don’t even experienced iOS developers write unit tests? (I’m often guilty of this, too.) There are plenty of excuses:
- “it takes too long”
- “I’m not sure how to test this”
- “my client doesn’t want to pay for tests”
…and I’ve heard a boatload of others.
But what about the benefits? Have you considered how useful unit tests are?
They’re insanely valuable for verifying that code…
- does what it should
- doesn’t break later when someone makes changes to it
…and that we can refactor it later without worrying about introducing new bugs. (We’re always refactoring code.)
There are a thousand other reasons to write unit tests, but those are the big ones. They ensure code does what it should, that it doesn’t break later, and that we can refactor. They’re so valuable, so underrated, and so overlooked.
You don’t need permission to write quality code. Clients pay you to build software that works, and unit tests are proof that it does.