Asynchronous programming and continuation-passing style in JavaScript
E篇文主要講Continuation passing style (CPS)。
- 由synchronus function 係javascript改寫成 asynchronus function,其實姐係改寫成 CPS
- 理解左CPS,就可以人手寫一D async function去處理loop,recursion,同tree iteration
- 將E個技巧generize,就係Promise嘅implementation。
- Generator 係另一種async programming嘅寫法,其實背後都係用CPS implement出黎
- CPS 將nested嘅function拆開左做chain pattern,其實係一種inversion of control,令到D logic 好maintain左
- CPS similar to function implement with goto, does not use stack to hold variable
- All true CPS function calls are tail calls and can be optimized
- As we mentioned that CPS does not use stack
- Trampolining,姐係一種對tail recursion,以array 做 implementation嘅handling
- 條array其實係一條queue
- Browser 用event queue去處理trampolining,成個CPS嘅overview就係js async programming model
Crafting beautiful UX with API requests
Handling API call in web app, to provide better UX to user
- Timeouts
- Cancel my request if you’re slower to respond than I want
- Shouldn’t let user wait too long
- Use API client timeout config, instead of writing your own
- Minimum wait time
- Protect your app from fast API response
- If you have a loading state, and don’t want the data pop up suddenly
- Don’t use when user expect a very fast response
- Avoid unnecessory wait time
- Retry
- As an hotfix of some infrastructure problem
- Use exponential backoff, increase the retry interval exponentially
17 Jan 2019
Can read the implementation
Eagles Don’t Fly With Turkeys
- Manager prefer not to deal with underperformer in the team
- They believe that having someone in the position is better than an empty seat
- They know that hiring is a lot of work and they don’t want to do it
- They hope things will get better magically
- This will demoralize high performaning member
- B-players hire C-players because they want to make themselves look good
- The team will fill with lower-performing team member soon
12 common mistakes made when using Story Points
- Story point is a rough indication of how much time an item will take to complete
- Benefits
- Quick estimation
- Estimation without giving a specific time commitment
- Embrace uncertainty that comes with estimation
- Common mistakes
- Equating Story Points to just complexity, uncertainty or value
- Story points are about effort, we can take complexity and uncertainty into consideration
- Story is not simply equal to complexity or risk
- Translate story points to hours
- Averaging the story point
- If half of the team give 3 points and the other half give 5, pick either 3 or 5 story point to the item
- Adjusting Story Point estimates of issues during sprint.
- Change the story point lose the information of inaccurate estimation
- Keep inaccurate estimation as part of the historical velocity of a team
- Story pointing bugs, unless the bug is unrelated to the current sprint
- Bugs of feature to be implemented in this sprint is part of the feature story, we should not consider it is an extra task
- Adding Story Points to small tasks
- We should timebox the small task
- Tasks required a fixed amount of time to complete do not need story point
- Adjusting reference of one story point
- Velocity of different sprints is no longer comperable
- Story pointing unfinished issues again
- Adjusting Story Point estimate because a specific developer will work on it
- The same task will be assign to different people in some situation
- e.g senior engineer fixing emergency bugs, junior engineer need to pick up the tasks
- The same task will be assign to different people in some situation
- Never adjusting story point’s reference
- We should tune the reference when the team become mature
- or new junior members join the team
- Conforming to the expert in the room
- Let the rest of the team estimate without the expert
- Not discussing incorrectly Story-Pointed issues in retrospective
- We need to improve our estimation
- Equating Story Points to just complexity, uncertainty or value
History through the eyes of a chicken
- Chicken orgin from India
- Chicken is cross breed of 4 species
- Chicken lay egg daily
Intro to Chaos Engineering
- Chaos Engineering is to break things in purpose
- Don’t do it in production
- Call leader
- Responsible for any type of incidents
- Requirements:
- Good understanding on all services
- Know who are the different people that own the services
- Incident downstream and upstream impact
- Know who are the people you need to get online to fix the issue
- Which system to start chaos engineering
- Critical service
- System serve critical function or store critical data
- Because
- Better monitory and recovery tool set up already
- Better knowledge on the system
- Huge team which works on the system
- Critical service
- Prerequisities for Chaso Engineering
- High Severity Incident (SEV) Management including SEV levels and definitions
- Availability monitoring, including a high level health dashboard for WWW and API
- Alerts and paging that call a human and wake them up for SEVs
- Random error injection help less
- It cannot provide much information
- Don’t do it unless you are very confident on the recovery systems
- Give names to severe incidents
- Easier to refer SEV back to the name
- Easier to remember the SEV
以下無需重讀
AARRR 指標能評判設計成效?UX 更需要的是分析使用者的行為數據 (上) (下)
- AARRR 比較適用電商和內容網站,唔太適合有功能嘅產品
- AARRR嘅數據係睇有幾多個user用,有幾多個user肯俾錢,唔可以直接了解到user嘅行為
- 用AARRR去tune UX,好可能俾D細節騎劫左,最重要嘅使用者特性、行為同內在需求係冇調查到
- 直接測量關鍵行為的數據會好D
- 睇行為事件間的流量轉移
- 如果user嘅行動流程同我地預計嘅唔同,表示我地要重新認識user
- 透過觀察而去揾出insight
Behavior-Driven Development (BDD) Crash Course
- BDD steps
- Writing feature doc with customer
- Everyone agree with the feature
- Automated test will be generated from feature doc
- It becomes TDD after test is generated
- 3 section of a feature doc
- Context
- Event
- Outcome
- Having a clear definition on expected behaviour, can avoid overkill
- BDD test is slower than unit test
- It is integration test or end to end test
- BDD cannot help you locate the root of cause
- Use unit test if you want it
Increase your self-awareness with one simple fix
- People who introspected were more stressed and depressed, less satisfied with their jobs and their relationships, less in control of their lives
- Thinking about ourselves isn’t related to knowing ourselves
- Don’t ask “Why”, ask “What”
- Human cannot remove their unconscious thoughts, feelings and motives
- We end up inventing answers that feel true but are often very wrong
- Our feeling and thought easily affect by the event happened recently
- We cannot answer “Why” rationally
- Answer of “Why” leads us away from our true nature
- Human cannot remove their unconscious thoughts, feelings and motives
- Think about what you can do
速讀的殘酷真相
學野係要吸收要思考,好多位係快唔到。
速讀可以用係資訊含量低嘅文章到,高質嘅書始終要慢讀。
比起睇得快,㨂高質嘅書睇係更重要
Why do Americans and Canadians celebrate Labor Day?
七月到十一月冇假,所以係九月放一日勞動節假。之後爆發一次嚴重嘅勞工運動,做成多人死亡。五月一日嘅國際勞動節就係記念E件事。