Emerging Best Practices • Ash Furrow -Notes

Watch video here: https://youtu.be/YsUTuwpbURA

It’s much clear to understand what’s the Ash talk about by list the outlines

1. Agenda

  • We’ve been here before
  • Learning is forever, deal with it
  • Never throw ideas away
  • How to force yourself to think
  • Always be abstracting

2. Ideas vs Syntax

Object Literals/Blocks & GCD/Swift 2: Guard/Currying/Enums

New syntax lets us do new things
However! Syntax is only a tool
Like blocks, Swift 2 syntax is most useful when it enables new ideas

That’s all just syntax. What matters are ideas.

3. Benefits of Testing

  • Limited object scope is good
    • High cohesion, low coupling
  • How to limit scope?
    • Controlling public interface and dependencies

Things to never throw away:Code & Ideas

Changing a unit test?

  • No -> Refactoring
  • Yes -> Rewriting

4. Dependency Injection

Your things shouldn’t create the things they need

1
class ViewController: UIViewController {
let networkController = NetworkController()
    func viewDidLoad() {
        super.viewDidLoad()
        networkController.fetchStuff {
            self.showStuff()
        }
} }
1
class ViewController: UIViewController {
var networkController: NetworkController?
    func viewDidLoad() {
        super.viewDidLoad()
        networkController?.fetchStuff {
            self.showStuff()
        }
} }

5. Unit Testing

  • Don’t test private functions
    • Also, start marking functions as private
  • Remember, we want to avoid rewriting
  • Don’t test the implementation
  • Don’t use “partial mocks”
    • See @searls post on partial mocks

6. Wrap Up

  • We have a history of being awesome, let’s keep it up
  • Learning isn’t just for when Xcode is in beta
  • Ideas are more valuable than code, but throwing away either is dangerous
  • Effective unit tests make it easy to change code
  • Operate at the highest level of abstraction you can at any given time