engineering real world problems - at toki alumni meeting

34
Software Engineering: The Real World Derianto Kusuma traveloka.com

Upload: derianto-kusuma

Post on 19-Nov-2014

916 views

Category:

Technology


2 download

DESCRIPTION

Presentation was given to TOKI (Indonesian Computing Olympiad Team) alumni meeting on September 2, 2012 at Hotel Cozy Amos, Melawai, Jakarta. The presentation aimed to highlight the difference between competitive programming and real world software engineering through constructed problems based on real problems at Traveloka.com.

TRANSCRIPT

Page 1: Engineering Real World Problems - at TOKI Alumni meeting

Software Engineering:

The Real WorldDerianto Kusuma

traveloka.com

Page 2: Engineering Real World Problems - at TOKI Alumni meeting

Flight graph

Page 3: Engineering Real World Problems - at TOKI Alumni meeting

Shortest path from MES to AMQ?

Page 4: Engineering Real World Problems - at TOKI Alumni meeting

K shortest routes from MES to AMQ?GA 123 MES-CGK 14.40-16.20JT 124 CGK-UPG 19.00-22.15JT 125 UPG-AMQ 23.45-02.00

JT 50 MES-SUB 07.50-10.05JT 52 SUB-AMQ 16.30-19.30

Page 5: Engineering Real World Problems - at TOKI Alumni meeting

? ≤ N ≤ ?? ≤ V ≤ ? ? ≤ E ≤ ? Time limit: ? sec

Max memory?Number of test cases?

Page 6: Engineering Real World Problems - at TOKI Alumni meeting

80 airports, 1,000 daily flight100,000 queries / day, peak at 5-9 pm(10 queries / sec)20% CPU time 20 ms / query

Page 7: Engineering Real World Problems - at TOKI Alumni meeting

Some routes change schedule by dayIn the long term, routes changePrice changes every ???Data sources for routes & prices?

Page 8: Engineering Real World Problems - at TOKI Alumni meeting

Data source unreliable Route search must still be reliablePrice always changing reasonable accuracy

Page 9: Engineering Real World Problems - at TOKI Alumni meeting

What is K shortest routes from A to B at date D, with reasonable price accuracy?

(Constraints: all above)

Page 10: Engineering Real World Problems - at TOKI Alumni meeting

New problems

Lesson 1

- Functional - Real-time correctness- Architectural - Load / performance - Reliability - Scalability, etc.

Page 11: Engineering Real World Problems - at TOKI Alumni meeting

1. Web scraping2. Route search

Page 12: Engineering Real World Problems - at TOKI Alumni meeting

Web scraping10-20 airport pairs / query 5-15 sec / airport pair !!!

Page 13: Engineering Real World Problems - at TOKI Alumni meeting

Multithreading10 query / sec x 20 scrape / query x 5 sec / scrape = 1000 concurrent threads!Run out of RAM

Page 14: Engineering Real World Problems - at TOKI Alumni meeting

AsynchronouscallAsync(param1, param2, param3, Callback<T> callback)Backed by selector-based HttpClient

Page 15: Engineering Real World Problems - at TOKI Alumni meeting

Cachingttl = ? on failure? on timeout?Fetching synchronization?

Page 16: Engineering Real World Problems - at TOKI Alumni meeting

Route searchPruning?Caching at airport pair level?

Page 17: Engineering Real World Problems - at TOKI Alumni meeting

New solutions

Lesson 2

Page 18: Engineering Real World Problems - at TOKI Alumni meeting

User:“Just give me cheap tickets, b*tch”“And don’t make me wait too long”

Page 19: Engineering Real World Problems - at TOKI Alumni meeting

Am I answering the right question?

“Wrong Question”

Page 20: Engineering Real World Problems - at TOKI Alumni meeting

Cheap price- reasonable coverage- limited precomputed routes

Page 21: Engineering Real World Problems - at TOKI Alumni meeting

Speed / “perception of speed”- Aggressive pruning- Polling- Prefetching- UI tricks

Source: hipmunk.com

Page 22: Engineering Real World Problems - at TOKI Alumni meeting

What user really wants- Tomorrow is cheaper?- Don’t give me that X airlines!- I can’t wake up that early!

Page 23: Engineering Real World Problems - at TOKI Alumni meeting

What user really wants- I’m actually looking for trains!

Page 24: Engineering Real World Problems - at TOKI Alumni meeting

Business contexts matter

Lesson 3

Page 25: Engineering Real World Problems - at TOKI Alumni meeting

Flight search component

Flight searchFlight search

Direct route search

Direct route search

Indirect route search

Indirect route search

ScrapingScrapingRoute

predictorRoute

predictor

Airlines websitesAirlines

websites

Per airline cache

Per airline cache

Per route cache

Per route cache

FeatureFeature FeatureFeature FeatureFeature

Other data sources

Other data sources

......

Route DB

Route DB

Page 26: Engineering Real World Problems - at TOKI Alumni meeting

Component diagram

Flight searchFlight search

Backend common libBackend common lib

Frontend common libFrontend common lib

FrontendFrontend Control dashboard

Control dashboard

3rd party libraries3rd party libraries

User accountsUser accounts

Common dataCommon data

BackendBackend

FrontendFrontend

BackendBackend

FrontendFrontend

Scraping library

Scraping library

Page 27: Engineering Real World Problems - at TOKI Alumni meeting

Deployment diagram

Frontend nodesFrontend nodes Backend nodesBackend nodesVIPVIP

Misc serviceMisc service

DBDBDistributed

cacheDistributed

cache

VIPVIPClientsClients

CDNCDN

Page 28: Engineering Real World Problems - at TOKI Alumni meeting

System builder, not only coder

Lesson 4

Page 29: Engineering Real World Problems - at TOKI Alumni meeting

Site operationsCode push? Maintenance mode?Configuration? Control? Monitoring?

Page 30: Engineering Real World Problems - at TOKI Alumni meeting

Dev operationsSource control? Build system? Testing? Staging? Release process?

Page 31: Engineering Real World Problems - at TOKI Alumni meeting

MaintainabilityCode quality? Loose coupling? Portability? Backward compatibility?

Page 32: Engineering Real World Problems - at TOKI Alumni meeting

The real world needs to operate

Lesson 5

Page 33: Engineering Real World Problems - at TOKI Alumni meeting

Software Engineering:

The real world

1. New problems

2. New solutions

3. Business context

4. System design

5. Operation

Page 34: Engineering Real World Problems - at TOKI Alumni meeting

Thanks for listening!Q & A