30
LinkedIn Mobile Search iPhone Architecture Dennis Byrne

LinkedIn Mobile Search iPhone Architecture

Embed Size (px)

DESCRIPTION

This is a high level presentation of the LinkedIn mobile search page.

Citation preview

Page 1: LinkedIn Mobile Search iPhone Architecture

LinkedIn Mobile Search iPhone Architecture

Dennis Byrne

Page 2: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 3: LinkedIn Mobile Search iPhone Architecture

The Model - “if you can’t see it”

● Think nouns, not verbs● LISearchV3Model.m

o SearchData.mo NSArrayo NSDictionary

● Ridiculously Good Looking

Page 4: LinkedIn Mobile Search iPhone Architecture

The View - “if you can see it”

● LISearchV3ViewController.xib● LISearchT1Cell.xib● LISearchT1CellHigh.xib● LISearchT1CellUltraHigh.xib● LISearchT2Cell.xib● LISearchT2CellHigh.xib● LISearchV2FilterButton.xib

Page 5: LinkedIn Mobile Search iPhone Architecture

The Controller● LISearchV3ViewController.m● Think verbs, not nouns● Delegate Pattern● Event Listeners● Glue code● Logic

Page 6: LinkedIn Mobile Search iPhone Architecture

MVC … try to think of it as VCM

10100101001010100101010010100101001110111111010100110100101001010100101010010100

TM

Page 7: LinkedIn Mobile Search iPhone Architecture
Page 8: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 9: LinkedIn Mobile Search iPhone Architecture

Retrieval Data Sources● Local Cache

o Core Datao SQLite

● Typeaheado phone-feo Typeahead Restli server

● Federated Searcho phone-feo Federated Search Restli server

Page 10: LinkedIn Mobile Search iPhone Architecture

Retrieval - Core Data

Page 11: LinkedIn Mobile Search iPhone Architecture

Retrieval - Remote Results

?

?

Page 12: LinkedIn Mobile Search iPhone Architecture

Retrieval - Threading Model

● Everything is on the main thread● Except …

o Core Data retrievalo Core Data callbackso HTTP requests

Page 13: LinkedIn Mobile Search iPhone Architecture

Retrieval Controller

phone-fe

Page 14: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 15: LinkedIn Mobile Search iPhone Architecture

Cell Construction - Builder Pattern

● LISearchV3UITableViewCellBuilder.m

Page 16: LinkedIn Mobile Search iPhone Architecture

Cell Builder

Retrieval Controller

phone-fe

Page 17: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 18: LinkedIn Mobile Search iPhone Architecture

Metrics● LISearchV3Metrics.m● Page Views & Actions● Performance

o Firsto Secondo Thirdo Platform

iPhone android touch web

Page 19: LinkedIn Mobile Search iPhone Architecture

Cell Builder

Metrics LPTimer

Retrieval Controller

Perf

phone-fe

Page 20: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 21: LinkedIn Mobile Search iPhone Architecture

Full Screen Scrolling

Page 22: LinkedIn Mobile Search iPhone Architecture

Cell Builder

Full ScreenScrolling

Metrics LPTimer

Retrieval Controller

Perf

phone-fe

Page 23: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing

Page 24: LinkedIn Mobile Search iPhone Architecture

Unit Testing

● SenTestCase● LISearchV3JobScheduler

o LISearchV3ProductionJobScheduler.mo LISearchV3TestJobScheduler.m

● OCMock

Page 25: LinkedIn Mobile Search iPhone Architecture

SenTest … similar to JUnit < 4.0

-(void)setUp {}-(void)testSomething {

STAssertEquals(YES, NO, @"msg here");STAssertEqualsWithAccuracy(1.0, 1.2, 0.1, @””);STFail(@”msg here”);}

Page 26: LinkedIn Mobile Search iPhone Architecture

Dependency Injection

// similar to an interface in Java@protocol LISearchV3JobScheduler <NSObject>

- (void)enqueueOnMainThread:(void(^)())block;

@end

Page 27: LinkedIn Mobile Search iPhone Architecture

OCMock

#import "OCMock.h"

id op = [OCMockObject mockForClass:[LINetworkOperation class]];

NSDictionary *tag = @{@”key”: @”value”};

[(LINetworkOperation *)[[op stub] andReturnValue:OCMOCK_VALUE(tag)] tag];

Page 28: LinkedIn Mobile Search iPhone Architecture

Cell Builder

Full ScreenScrolling

Metrics LPTimer

Retrieval Controller

Perf

phone-fe

Job Scheduler

Page 29: LinkedIn Mobile Search iPhone Architecture

The Napkin Test

Page 30: LinkedIn Mobile Search iPhone Architecture

Agenda

● Model View Controller Pattern● Retrieval

o Core Datao Typeaheado Federated Search

● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing