Redian新闻
>
What's good way to pass intermediate results?
avatar
What's good way to pass intermediate results?# Java - 爪哇娇娃
g*y
1
In a sequential computing program, what is the best way to pass intermediate
result among classes?
For example, component A generates by-product O, which will be used by
component B and C.
Make by-product O global is one-way, but not good choice.
Pass O from A to B, C is another way, but I don't like that idea either. A
becomes depending on B and C.
avatar
g*g
2
How about keep 0 as a field of A, and make a getter for it.
Pass A to B and C.

【在 g**********y 的大作中提到】
: In a sequential computing program, what is the best way to pass intermediate
: result among classes?
: For example, component A generates by-product O, which will be used by
: component B and C.
: Make by-product O global is one-way, but not good choice.
: Pass O from A to B, C is another way, but I don't like that idea either. A
: becomes depending on B and C.

avatar
g*y
3

That makes B and C depends on A. I really want to cut this dependency. Problem
is, B and C doesn't know A instance. My central controller is configured in
very general way, even controller doesn't know there is an A instance. It
generates objects from XML and execute method as specified.

【在 g*****g 的大作中提到】
: How about keep 0 as a field of A, and make a getter for it.
: Pass A to B and C.

avatar
c*r
4
Create a new component to interact with A, B, and C.
See mediator pattern.

Problem

【在 g**********y 的大作中提到】
:
: That makes B and C depends on A. I really want to cut this dependency. Problem
: is, B and C doesn't know A instance. My central controller is configured in
: very general way, even controller doesn't know there is an A instance. It
: generates objects from XML and execute method as specified.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。