LinkedIn Mobile Search iPhone Architecture
-
Upload
dennis-byrne -
Category
Internet
-
view
344 -
download
3
description
Transcript of LinkedIn Mobile Search iPhone Architecture
LinkedIn Mobile Search iPhone Architecture
Dennis Byrne
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
The Model - “if you can’t see it”
● Think nouns, not verbs● LISearchV3Model.m
o SearchData.mo NSArrayo NSDictionary
● Ridiculously Good Looking
The View - “if you can see it”
● LISearchV3ViewController.xib● LISearchT1Cell.xib● LISearchT1CellHigh.xib● LISearchT1CellUltraHigh.xib● LISearchT2Cell.xib● LISearchT2CellHigh.xib● LISearchV2FilterButton.xib
The Controller● LISearchV3ViewController.m● Think verbs, not nouns● Delegate Pattern● Event Listeners● Glue code● Logic
MVC … try to think of it as VCM
10100101001010100101010010100101001110111111010100110100101001010100101010010100
TM
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
Retrieval Data Sources● Local Cache
o Core Datao SQLite
● Typeaheado phone-feo Typeahead Restli server
● Federated Searcho phone-feo Federated Search Restli server
Retrieval - Core Data
Retrieval - Remote Results
?
?
Retrieval - Threading Model
● Everything is on the main thread● Except …
o Core Data retrievalo Core Data callbackso HTTP requests
Retrieval Controller
phone-fe
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
Cell Construction - Builder Pattern
● LISearchV3UITableViewCellBuilder.m
Cell Builder
Retrieval Controller
phone-fe
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
Metrics● LISearchV3Metrics.m● Page Views & Actions● Performance
o Firsto Secondo Thirdo Platform
iPhone android touch web
Cell Builder
Metrics LPTimer
Retrieval Controller
Perf
phone-fe
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
Full Screen Scrolling
Cell Builder
Full ScreenScrolling
Metrics LPTimer
Retrieval Controller
Perf
phone-fe
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing
Unit Testing
● SenTestCase● LISearchV3JobScheduler
o LISearchV3ProductionJobScheduler.mo LISearchV3TestJobScheduler.m
● OCMock
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”);}
Dependency Injection
// similar to an interface in Java@protocol LISearchV3JobScheduler <NSObject>
- (void)enqueueOnMainThread:(void(^)())block;
@end
OCMock
#import "OCMock.h"
id op = [OCMockObject mockForClass:[LINetworkOperation class]];
NSDictionary *tag = @{@”key”: @”value”};
[(LINetworkOperation *)[[op stub] andReturnValue:OCMOCK_VALUE(tag)] tag];
Cell Builder
Full ScreenScrolling
Metrics LPTimer
Retrieval Controller
Perf
phone-fe
Job Scheduler
The Napkin Test
Agenda
● Model View Controller Pattern● Retrieval
o Core Datao Typeaheado Federated Search
● Cell construction & the Builder pattern● Metrics● Full Screen Scrolling● Unit Testing