From 1c9f2403ec28a758ccb52e0e65bed5cc0d52897c Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Wed, 24 Jan 2024 10:32:12 +0700 Subject: [PATCH] feat: draft be --- docs/2024-01-20-backend-thinking.html | 50 +++++++++++++++++++++++++-- posts/2024-01-20-backend-thinking.md | 26 ++++++++++++-- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/docs/2024-01-20-backend-thinking.html b/docs/2024-01-20-backend-thinking.html index 5a6218e..d74b89e 100644 --- a/docs/2024-01-20-backend-thinking.html +++ b/docs/2024-01-20-backend-thinking.html @@ -100,7 +100,7 @@

- In ZaloPay, each team has its own responsibilites/domains, aka many + In ZaloPay, each team has its own responsibilities/domains, aka many different services.

@@ -292,6 +292,16 @@ knowing when to use and when to not.

All of these above are industry standard.

+

+ Write code to delete +

The way business moving is fast, so a feature is maybe implemented today, but gets thrown out of window tomorrow (Like A/B testing, one of them is @@ -326,7 +336,7 @@ can be deleted without breaking the other.

- For example, we can send noti to users using SMS, Zalo, or Noti in app (3 + For example, we can send noti to users using SMS, Zalo, or noti-in-app (3 providers). They are all independently feature which serves same purpose: alert user about something. What happen if we add providers or remove some? Existing providers keep working as usual, new providers should @@ -341,6 +351,35 @@ And when we do not need send noti anymore, we can delete whole of it which includes all providers and still not affecting main flow.

+

+ Write code to test +

+

+ Test is not a way to find bug, test is a way for us to make sure what we + code is actually what we think. +

+

+ Best case scenerio is test with real dependencies (real servives, real + Redis, real MySQL, real Kafka, ...). But it's not easy way to setup + yourself. +

+

+ The easier way is to use mocks. Mock all dependencies to test all possible + edge cases you can think of. +

+

TODO: Show example

+

+ Same solution is to keep our code loosely coupled as much as possible. +

+

Each function/ should be contained.

+

Not all

Imaginary Problems Are the Root of Bad Software +
  • + Speed up writing Go test ASAP +