Design Lesson 1
Copyright © 直通硅谷
http://www.zhitongguigu.com

Design
-
Database Design
-
System Design
-
Object Oriented Design
Copyright © 直通硅谷
http://www.zhitongguigu.com
What is design?
give a higher level architecture and design an entire system rather than some individual components
Copyright © 直通硅谷
http://www.zhitongguigu.com
What can we tell?
- an entire system
- a higher level architecture
- some individual components
Copyright © 直通硅谷
http://www.zhitongguigu.com
What should we do?
- Ask about details that you care
- Give yourself one minute, do not hurry
- Begin with the blueprint (whole architecture)
- fulfill each individual part but not minor details
Copyright © 直通硅谷
http://www.zhitongguigu.com
What are the most important things for a system?
Copyright © 直通硅谷
http://www.zhitongguigu.com
Accuracy?
Should we pursue 100% accuracy?
Copyright © 直通硅谷
http://www.zhitongguigu.com
Example:
Billing Information,
Bank Transaction,
Google Search Results
Performance?
Could we let users wait too long to get what they want?
Copyright © 直通硅谷
http://www.zhitongguigu.com
Trade off: Accuracy
Robustness?
How to deal with edge case?
How to deal with attacks and scrapers?
Copyright © 直通硅谷
http://www.zhitongguigu.com
Accuracy
- Database Read and Write: race condition
- Throw Exception at proper time: good exception supress
- Conditional check: prevent NPE
Copyright © 直通硅谷
http://www.zhitongguigu.com
Performace
- What database? Cache layer?
- Scalability & Distributed System
- Site speed: TTFB, Async call, make effort alap
Copyright © 直通硅谷
http://www.zhitongguigu.com
make effort as little as possible? Generic
Robustness
- Scalability & High QPS
- Backup System
- Network Security
Copyright © 直通硅谷
http://www.zhitongguigu.com
Knowledge pieces
- Database
- Network,Server,TCP/IP
- Security, Encryption/Decryption
- Distributed System
- Backup System
- *Hadoop
Copyright © 直通硅谷
http://www.zhitongguigu.com
Design pieces
- Accuracy
- Performance
- Robustness
- Scalability
- Test
Copyright © 直通硅谷
http://www.zhitongguigu.com
Google Calendar
Copyright © 直通硅谷
http://www.zhitongguigu.com
Google Calendar
Design a simple google calendar. It has following requests:
1. The user could register himself using email address
2. The user could have some personal profiles
3. The user can be an organizer and create events and add some detail information for the event
4. The user could add/remove some users to/from his events and send invitation via email
5. The user could know if the people they add is busy or free during the time he sets up for the event.
Copyright © 直通硅谷
http://www.zhitongguigu.com
How to choose and design a database?
Copyright © 直通硅谷
http://www.zhitongguigu.com
- Entity: user, event
- Relationship: create, invite
Copyright © 直通硅谷
http://www.zhitongguigu.com
- Entity: user, event
- Relationship: create, invite

Copyright © 直通硅谷
http://www.zhitongguigu.com

Copyright © 直通硅谷
http://www.zhitongguigu.com
Can we make the table cleaner?
More tables: Good or bad?
Copyright © 直通硅谷
http://www.zhitongguigu.com

Follow up questions
- How to tell if someone is busy or not during this time of the event?
- How to deal with so many emails sending? And what if some of them fails?
- How to evaluate the performance? How to improve it?
Copyright © 直通硅谷
http://www.zhitongguigu.com
[GoValley-201612] Design Lesson 1
By govalley201612
[GoValley-201612] Design Lesson 1
- 956