A design for parameter passing# Java - 爪哇娇娃
g*y
1 楼
Parameter passing between classes always bother me a lot. Noramlly, you take
parameters at Main class, then spread it to controls, then to different
modules/classes. A typical flow is like:
Main -> A -> B -> ... -> Z
Headache part is: At the beginning of design, you think B need param1 and
param2; then Main pass both to A, next B. Later, you find B actually needs
param1 and param3. Now you need to change all parameter passing sequence of
Main -> A, and A -> B. If the chain gets longer, it will b
parameters at Main class, then spread it to controls, then to different
modules/classes. A typical flow is like:
Main -> A -> B -> ... -> Z
Headache part is: At the beginning of design, you think B need param1 and
param2; then Main pass both to A, next B. Later, you find B actually needs
param1 and param3. Now you need to change all parameter passing sequence of
Main -> A, and A -> B. If the chain gets longer, it will b