2019年3月13日 星期三

[Books] Programming Pearls (2nd Edition)


Bought a Chinese translation of Programming Pearls (2nd Edition).



Super recommend to read!



Quote from this book:

Q: It seems that most columns emphasize the design process. Can you summarize your advice on that topic?
  • Work on the right problem.
  • Explore the design space of solutions.
  • Look at the data.
  • Use the back of the envelope.
  • Exploit symmetry.
  • Design with components.
  • Build prototypes.
  • Make tradeoffs when you have to.
  • Keep it simple.
  • Strive for elegance.

Also check this for designing machine learning systems: Hidden Technical Debt in Machine Learning Systems [paper]. 

2019年3月4日 星期一

Notes on System Design

Warning: All materials are prepared for Facebook onsite interview but I failed.


Case Study:
  • Netflix (mysterious)
    • Learning a Personalized Homepage – Netflix TechBlog – Medium (2015): Article
    • The Netflix Recommender System: Algorithms, Business Value, and Innovation (2016): Paper
    • Benchmarking Cassandra Scalability on AWS — Over a million writes per second (2011): Article
    • A Multi-Armed Bandit Framework for Recommendations at Netflix | DataEngConf SF '18 (2018): YouTube
  • Google
    • Building Software Systems at Google and Lessons Learned (2010): Slide | YouTube
    • Google Production Environment (2018): YouTube
    • The Google File System - Research (2003): Paper
    • MapReduce: Simplified Data Processing on Large Clusters (2004): Paper
    • Bigtable: A Distributed Storage System for Structured Data (2006): Paper
    • Differential Synchronization (2009): Paper | YouTube
    • The Paxos Algorithm (2018): YouTube
  • Yahoo
    • The Hadoop Distributed File System (2010): Paper
    • Analyzing Google File System and Hadoop Distributed File System (2016): Article 
  • Youtube
    • Deep Neural Networks for YouTube Recommendations (2016): Paper
    • RecSys 2016: Paper Session 6 - Deep Neural Networks for YouTube Recommendations (2016): YouTube
  • Facebook
    • Balancing Multi-Tenancy and Isolation at 4 Billion QPS (2015): YouTube
    • TAO: Facebook's Distributed Data Store for the Social Graph - Usenix (2013): Paper
    • Finding a needle in Haystack: Facebook's photo storage - Usenix (2010): Paper
    • Cassandra - A Decentralized Structured Storage System (2009): Paper
  • Instagram
    • Scaling Instagram (QCon London 2017): YouTube
  • Amazon
    • Dynamo: Amazon's Highly Available Key-value Store (2007): Paper
  • Slack
    • How Slack Works (QCon San Francisco 2016): YouTube
  • Uber
    • Project Mezzanine: The Great Migration (2015): Article
    • Designing Schemaless, Uber Engineering’s Scalable Datastore Using MySQL (2016): Article Part 1 & Part2 & Part3
    • The Uber Engineering Tech Stack, Part I: The Foundation (2016): Article
    • The Uber Engineering Tech Stack, Part II: The Edge and Beyond (2016): Article
    • How Uber Scales Their Real-Time Market Platform (2015): Article


Interview Practices:
  • URL shortener system design | tinyurl system design | bitly system design (2018): YouTube
  • NETFLIX System design | software architecture for netflix (2018): YouTube
  • UBER System design | OLA system design | uber architecture | amazon interview question (2018): YouTube
  • Twitter system design | twitter Software architecture | twitter interview questions (2018): YouTube
  • Whatsapp System design or software architecture (2018): YouTube

2019年3月3日 星期日

Notes on Coding Interviews

  • Search on YouTube.
  • Practice. Practice. Practice.
  • Practice a lot of problems? Not so effective.
  • Effective way: build up your knowledge from Leetcode.
  • My 5 categories: (All-in-one)[doc]
    • Foundations: [doc]
      • Array
      • String
      • Math
    • Data Structure: [doc]
      • Stack
      • PriorityQueue
      • LinkedList
      • Binary Search Tree
    • Advanced Design: [doc]
      • Backtracking
      • Dynamic Programming (too many dissimilar problems, and hard to prepare)
      • Union Find
      • Trie
    • Graph Algorithms: [doc]
      • Graph
      • Tree
      • DFS & BFS
      • Topological Sort
    • Selected Topics: [doc]
      • System Design
      • Random
      • Matrix
      • Bit Manipulation
      • Computational Geometry
  • Read articles in the Discuss.
    • Identify all possible solutions
      • Different algorithms (from brute force to effective algorithms).
      • Same algorithm with different implementations (e.g., segment tree).
      • (My documents are not completed. Try to build up your own documents.)
    • Could analyze time complexity and space complexity of each solution.
      • Analyze line by line.
      • Understand all details of build-in libraries.
      • Know which solution is the best under certain assumption.
    • Official solutions are not always concise (and the best). But it must be correct.
    • Improve your code review ability.
  • Read codes in the Submission (if possible).
    • Not always correct.
    • Learn from undocumented solutions. Need more time to understand.
  • Write down your concise code in your style.
    • About 20 ~ 40 lines in Java.
      • Concise but not tricky. Tricky codes are not easy to remember.
      • Possible to reproduce in the real interview.
      • Lengthy codes might be regarded as messy codes. 
    • Just copy or imitate other's code. 
      • Not shame.
      • Save your time.
    • Align to your style (e.g., binary search, naming convention and so on).
    • Practice makes perfect.
    • Identify your weakness.
  • Could prove the correctness of your code.
    • Demonstrate your codes line by line.
    • Design meaningful test cases.