@jtong
2016-12-12T13:16:45.000000Z
字数 1029
阅读 1378
未分类
task list的初学者版
#1 生成Entity
输入:
scoreArray: [String]
输出:
scoreInputList: [{
math: Number,
chinese: Number,
english: Number,
programing: Number
}]
#2 计算并生成ViewModel
输入:
scoreInputList
输出:
scoreSheet: {
scoreList: [{
math: String,
chinese: String,
english: String,
programing: String,
average: String,
total: String
}],
summary: {
totalAverage: String
totalMid: String
}
}
#3 打印
输入:
scoreSheet
输出:
result: String
task list的完整版
#1 生成Entity(结构化)
输入:
scoreArray: [String]
输出:
scoreInputList: [{
math: Number,
chinese: Number,
english: Number,
programing: Number
}]
#2 计算个人成绩(计算 1/2)
输入:
scoreInputList
输出:
scoreList: [{
math: Number,
chinese: Number,
english: Number,
programing: Number,
average: Number,
total: Number
}] //结构可以不这样做,如果有别的Entity设计也是可以的,不要在结构上过度追求,清晰易懂是最重要的。哪种设计更贴切是很风格化的东西,很容易引战,还没什么价值。
#3 计算总成绩(计算 2/2)
输入:
scoreList
输出:
summary: {
totalAverage: String
totalMid: String
}
#4 生成ViewModel(为ViewModel做转换)
输入:
scoreList
summary
输出:
scoreSheet: {
scoreList: [{
math: String,
chinese: String,
english: String,
programing: String,
average: String,
total: String
}],
summary: {
totalAverage: String
totalMid: String
}
}
#5 打印(输出)
输入:
scoreSheet
输出:
result: String