Livoa LogoLivoa
PTUI (plain-text UI)
WeightGoalPlanner «Context»
UserProfile
CalorieLedger
MaintainWeightTargetRule «Concrete Strategy»
LoseWeightTargetRule «Concrete Strategy»
GainWeightTargetRule «Concrete Strategy»
User picks a goal in the UI
setGoal(goalType)
rule = selectStrategy(goalType) (MW | LW | GW)
Gather minimal stats
getCurrentWeight()
weightLb
getBirthdate()
birthdate
age = calcAge(birthdate, today)
Delegate to the chosen strategy
alt [goalType == "Maintain"] computeDailyTarget(user=UP) → MaintainWeightTargetRule kcalTarget ← MaintainWeightTargetRule [goalType == "Lose"] computeDailyTarget(user=UP) → LoseWeightTargetRule kcalTarget ← LoseWeightTargetRule [goalType == "Gain"] computeDailyTarget(user=UP) → GainWeightTargetRule kcalTarget ← GainWeightTargetRule
Persist and confirm
setTarget(date=today, target=kcalTarget)
DayEntry{id, target}
kcalTarget (display to user)

image to sequence diagram

by nick

0
0 uses