Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Objective-C Vitamins

Objective-C Vitamins

This is a talk that I gave at Tech Talks TO about the three things that the Objective-C community needs to embrace to grow into a mature, stable platform: Accessibility, Unit Testing, and Open Source.

Ash Furrow

January 22, 2013
Tweet

More Decks by Ash Furrow

Other Decks in Technology

Transcript

  1. Objective-C Vitamins
    Ash Furrow, iOS Developer & Author

    View Slide

  2. Accessibility

    View Slide

  3. Matters
    Accessibility

    View Slide

  4. Ontario Citizens
    1 in 7

    View Slide

  5. Ontario Citizens
    Broader
    1 in 7
    Appeal
    Market

    View Slide

  6. Legislation
    Ontario Citizens
    Broader
    AODA
    1 in 7
    Appeal
    Market

    View Slide

  7. Legislation
    Ontario Citizens
    Broader
    Low Cost in iOS
    AODA
    Relatively
    1 in 7
    Appeal
    Market

    View Slide

  8. iOS is
    and
    visual
    aural

    View Slide

  9. You wouldn’t ship a
    bad visual interface
    Why would you ship a
    bad aural one?

    View Slide

  10. Accessibility is
    HARD

    View Slide

  11. WHY?

    View Slide

  12. TURN VoiceOver ON
    (seriously)

    View Slide

  13. Accessibility is
    EASY

    View Slide

  14. UIAccessibility

    View Slide

  15. Part of UIKit Built in
    UIAccessibility

    View Slide

  16. Part of UIKit Built in
    UIAccessibility
    Conformed to by UIView Built in

    View Slide

  17. Part of UIKit Built in
    UIAccessibility
    Conformed to by UIView Built in
    You can roll your own Built in

    View Slide

  18. UIAccessibilityTraits
    Causes
    Page
    Turn
    Starts
    Media
    Session
    None
    Button
    Link
    Search Field
    Image
    Plays Sound
    Keyboard Key
    Static Text
    Summary
    Element
    Not Enabled Updates Frequently
    Adjustable
    Allow Direct Interaction
    Header
    Selected

    View Slide

  19. invisible
    THE
    BUTTON

    View Slide

  20. Using
    as
    button
    labels

    View Slide

  21. drawRect:
    UITableViewCell

    View Slide

  22. Localization
    ຊ౔Խ
    ϩʔΧϥΠθʔγϣϯ
    !"#$%&ا
    локализация
    lokalisasyon
    lokalisatie
    εντοπισµός
    localisation
    localización
    lokalisering
    localização

    View Slide

  23. Honour
    Building quality software
    is a measure of
    Quality
    Building accessible software
    is a measure of

    View Slide

  24. Testing
    Unit

    View Slide

  25. WHAT IS
    UNIT TESTING?

    View Slide

  26. WHY UNIT TEST?

    View Slide

  27. MODEL
    CONTROLLER
    VIEW
    KVO
    OWNS OWNS
    USER
    INTERACTION

    View Slide

  28. MODEL
    CONTROLLER
    VIEW
    KVO
    OWNS OWNS
    USER
    INTERACTION
    EXTENSION EXTENSION

    View Slide

  29. “Common things are easy and
    uncommon things are possible.”

    View Slide

  30. Uncommon
    “Common things are easy and
    uncommon things are possible.”
    Unit Testing is

    View Slide

  31. Uh oh.

    View Slide

  32. Yes!
    In Objective-C?

    View Slide

  33. View Slide

  34. - (void)testExample
    {
    STFail(@"Unit tests are not implemented yet in
    My Sweet New AppTests");
    }

    View Slide

  35. And that’s it.

    View Slide

  36. OCMock
    Introducing

    View Slide

  37. Objects
    Mock

    View Slide

  38. NSURLRequest *dummyURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://
    example.com"]];
    PXRequest *requestUnderTest = [[PXRequest alloc] initWithURLRequest:dummyURLRequest completion:nil];
    id mockConnection = [OCMockObject niceMockForClass:[NSURLConnection class]];
    [[mockConnection expect] start];
    id partialRequestMock = (PXRequest *)[OCMockObject partialMockForObject:requestUnderTest];
    [[[partialRequestMock stub] andReturn:mockConnection] urlConnectionForURLRequest:OCMOCK_ANY];
    [partialRequestMock start];
    [mockConnection verify];
    A Simple Test
    A lot of Code

    View Slide

  39. Why?

    View Slide

  40. Because OCMock is
    OLD and BUSTED

    View Slide

  41. New Hotness
    Kiwi

    View Slide

  42. Integrates
    Xcode
    with

    View Slide

  43. View Slide

  44. describe(@"ClassName", ^{
    context(@"a state the component is in", ^{
    __block id variable = nil;
    it(@"should do something", ^{
    [[variable should] meetSomeExpectation];
    });
    specify(^{
    [variable shouldNotBeNil]
    });
    });
    });

    View Slide

  45. describe(@"ClassName", ^{
    context(@"a state the component is in", ^{
    __block id variable = nil;
    beforeAll(^{ // Occurs once
    });
    afterAll(^{ // Occurs once
    });
    beforeEach(^{ // Occurs before each enclosed "it"
    variable = [MyClass instance];
    });
    afterEach(^{ // Occurs after each enclosed "it"
    });
    });
    });

    View Slide

  46. VIOUR DRIVEN DEVELOPMENT
    BEHAVIOUR DRIVEN DEVELOPMENT
    R DRIVEN DEVELOPMENTBEHAVIOUR D
    BEHAVIOU
    BEHAVIOUR DRIVEN DEVEL
    BEHAVIOUR DRIVEN DEVELOPMENT
    VELOPMENT
    NT
    DEVELOPMENT
    NT
    BEHAVIOUR DRIVEN DEV
    UR DRIVEN DEVELOPMENTBEHAVIOUR
    BEHAVIOUR DRIVEN DEVELOPMENTBEH

    View Slide

  47. GTFO.
    UAT?

    View Slide

  48. SOURCE
    OPEN

    View Slide

  49. INSULAR
    Objective-C Developers Tend to be
    (probably historical)

    View Slide

  50. WITHOUT
    IMAGINE A WORLD
    RubyGems

    View Slide

  51. Copy Files Ugh.
    OPTIONS

    View Slide

  52. Copy Files Ugh.
    OPTIONS
    Git Submodules Complicated.

    View Slide

  53. Copy Files Ugh.
    OPTIONS
    Git Submodules Complicated.
    CocoaPods DAZZLINGLY AMAZING.

    View Slide

  54. Dependency Management
    CocoaPods
    Versioning
    GitHub

    View Slide

  55. DEVELOPERS
    STUBBORN
    are

    View Slide

  56. DEVELOPERS
    DON’T KNOW

    View Slide

  57. THE TOOLS
    SUCK

    View Slide

  58. Let’s
    LEARN

    View Slide

  59. Let’s
    TEACH

    View Slide

  60. Let’s
    BLOG

    View Slide

  61. http://ashfurrow.com/book

    View Slide

  62. @ashfurrow
    ashfurrow.com

    View Slide