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, but comments tell you why. A well-placed code comment is a level above the

Read More

It’s time for a quick exercise in code smells!How many code smells do you see below?override func viewDidLoad() { super.viewDidLoad() if viewModel.isAlternateStyle { // Alternate style needs different placeholder text.   textField1.placeholder = strings.field1Hint  textField2.placeholder = strings.field2Hint setUpAlternateView() } else { textField1.placeholder = strings.field1Placeholder textField2.placeholder = strings.field2Placeholder setUpNormalView() } } (This example is much shorter

Read More

The “Single Responsibility Principle” (SRP) sounds so noble. But I’m afraid it’s misunderstood and misapplied. Ask your teammates: “What is the Single Responsibility Principle?” Go ahead, ask them. Then ask if the SRP is a good thing or a bad thing. I’d bet many of them will say something like this: “In principle, it’s a

Read More

Refactoring. It’s a word I hear quite a bit. Usually, in the context of conversations with management, it means, “Rewriting that thing. Hopefully without introducing bugs.” Often, among developers, it means, “One of the options in the Refactoring menu in my IDE.”

Read More

Code that’s easier to understand, maintain, and extend—that’s the promise of Object-Oriented Programming. But the reality for many iOS developers is that our objects are bloated. They know too much, and do too much. …What if our code has hidden objects, waiting to be found? Each hidden object could provide a new abstraction, a new tool.

Read More