r****m 发帖数: 70 | 1 自己总结的一些思路,欢迎讨论
1. 需求分析,问问题,列出input, output,可以根据input, output设计API /
interface
2. 分析流程,设计use scenario, 可以用(Given, When, Then)关键词描述
eg: 取款流程
Give a person has a bank account with balance 100
When the person withdraw 30
Then the balance will be changed to 70
3. 根据use scenario设计data model
将上面例子中的名词抽取出来作为对象或属性,动作抽取作为方法
class Person{
long personId;
List accounts;
}
class BankAccount{
long accountId
double balance;
}
class AccountService{
boolean withdraw(long personId, long accountId, double amount){}
double deposits(long personId, long accountId, double amount){}
double getBalance(long personId, long accountId)
}
4. 然后考虑高并发情况下,如何提升Scalability. 可以往LoadBalance, Partition/
Shading,cache等方面考虑 |
|