avatar
版主请进.# ChineseMed - 中医
g*g
1
讨论一下这个问题,用一个singleton和用一个所有成员都是静态的类,
有哪些pros/cons。感觉上singleton可以实现interface,而静态类不行,
所以singleton在decouple和dyna binding上可能灵活一些。但如果我
只有一个实现呢?
比如我要做一个web service, 这个service接口很简单。类似于
Object process(int ID, Object input)
给个ID,去数据库里去取点相应数据,对input做处理然后输出。
我可以写一个bean实现这个方法, 用spring让它成为singleton来干这个活。
我也可以写一个bean,套接调用一个静态方法来干这个活。
有什么区别吗?
avatar
d*e
2
版主你好.
请问这里可以做广告吗?我父亲是专治颈肩腰腿疼的.3月16号-4月6号会在纽约
坐诊.能借这里宣传下吗?
avatar
m*t
3
I would not go with static. If you make it static, the coupling is permanent
. On the other hand, Spring keeps the wiring cost minimal, why not leverage
it?
In my OO fundamentalist opinion, Java should not have had static methods in
the first place. But then that's just me. 8-)
avatar
L*D
4
网上有你父亲的资料吗?或他写的文章的链接,可以贴在这里大家看一看先。关于广告
,你可以去世界日报登个广告宣传一下,可能效果更好些。另外,你父亲在纽约坐诊是
有相关机构邀请吗?
avatar
c*t
5
I think that We just had this discussion war a while ago :)

permanent
leverage
in

【在 m******t 的大作中提到】
: I would not go with static. If you make it static, the coupling is permanent
: . On the other hand, Spring keeps the wiring cost minimal, why not leverage
: it?
: In my OO fundamentalist opinion, Java should not have had static methods in
: the first place. But then that's just me. 8-)

avatar
d*e
6
我爸没有文章,也没有网上资料.这次来只是看看美国有没有发展前景.不是有关机构
邀请.说白了,如果在美国行医完全是非法行医.他在国内是正规医院中医,专长理疗
,小针刀.这次来如果给别人看病的话是不收钱的,完全免费的(当然也不卖药品).
只是为了调查下市场顺便玩玩.有需要帮助的,且信的过黑医的朋友可以联系下我.我
手机是248-767-7256.
(我最近研究了下美国的医学法规.好像开中药不需要执照.所以如果不动小针刀,光
开中药方至少在法律上没什么问题.询问下版主是不是这么回事)
avatar
g*g
7

permanent
leverage
in
I can't agree on this last one. Class like Math are just some static methods
using a namespace. No configuration, no inheritance whatsoever. Make them
static is space efficient and faster (for static binding)

【在 m******t 的大作中提到】
: I would not go with static. If you make it static, the coupling is permanent
: . On the other hand, Spring keeps the wiring cost minimal, why not leverage
: it?
: In my OO fundamentalist opinion, Java should not have had static methods in
: the first place. But then that's just me. 8-)

avatar
h*i
8
广告归站方管理。
很佩服你自学医学法律,建议你也学习商业法律和其它法律。不然做好事也好,赚钱也
好。不怕一万就
怕万一。美国的病人是知道保护自己的。一旦出了问题,你的一生呀。
美国妇科医生大部分收入用来买保险是有原因的。

【在 d***e 的大作中提到】
: 我爸没有文章,也没有网上资料.这次来只是看看美国有没有发展前景.不是有关机构
: 邀请.说白了,如果在美国行医完全是非法行医.他在国内是正规医院中医,专长理疗
: ,小针刀.这次来如果给别人看病的话是不收钱的,完全免费的(当然也不卖药品).
: 只是为了调查下市场顺便玩玩.有需要帮助的,且信的过黑医的朋友可以联系下我.我
: 手机是248-767-7256.
: (我最近研究了下美国的医学法规.好像开中药不需要执照.所以如果不动小针刀,光
: 开中药方至少在法律上没什么问题.询问下版主是不是这么回事)

avatar
m*t
9
(for coconut, too)
See, I quoted the statement with "OO fundamentalist opinion" and "that's
just me." and we are still looking at a looming flame war. 8-)
But seriously, yes, static methods are convenient. I just thought that with
so many bad programmers out there, static methods have been so abused to the
point of causing way more damage than the benefits the convenience brings.

methods

【在 g*****g 的大作中提到】
:
: permanent
: leverage
: in
: I can't agree on this last one. Class like Math are just some static methods
: using a namespace. No configuration, no inheritance whatsoever. Make them
: static is space efficient and faster (for static binding)

avatar
L*D
10
在纽约针灸和按摩都是要有执照才能做的。在美国针灸师只能用一次性的针灸针。你父
亲擅长的小针刀,用的是专门的工具,也不是一次性的。如果被告了,很麻烦的。
如果你父亲想在美国发展,最好能考一下美国的针灸执照。
http://www.mitbbs.com/bbsdoc3/scitech.faq/ChineseMed/Advice4/5
如果你父亲只想在纽约行医,就只要看纽约州的法规就好。美国各个州的立法都有不同
,纽约州有专门的认证程序。
中药在美国是归到保健品一类的,不需要执照。

【在 d***e 的大作中提到】
: 我爸没有文章,也没有网上资料.这次来只是看看美国有没有发展前景.不是有关机构
: 邀请.说白了,如果在美国行医完全是非法行医.他在国内是正规医院中医,专长理疗
: ,小针刀.这次来如果给别人看病的话是不收钱的,完全免费的(当然也不卖药品).
: 只是为了调查下市场顺便玩玩.有需要帮助的,且信的过黑医的朋友可以联系下我.我
: 手机是248-767-7256.
: (我最近研究了下美国的医学法规.好像开中药不需要执照.所以如果不动小针刀,光
: 开中药方至少在法律上没什么问题.询问下版主是不是这么回事)

avatar
c*t
11
我觉得因噎废食不好。什么东西都可以被 abused 。争这挺无聊的。
就比如说,为什么 SQL driver manager 用的是 static method ?
static method 很多情况下是必须的。
至于靠 object serialization 工作的 API,如果这时候争 static vs
object ,简直是没事找事。
真正懂得编程的,都不会在这种小地方浪费时间。控制好那些 API 是
要给 exposed,那些是 hidden,考虑 extensibility 和 modulization
才是王道。具体你是用什么方法实现,who cares?说难听点,也就是
底层的 programmer 争这玩意儿。

with
the

【在 m******t 的大作中提到】
: (for coconut, too)
: See, I quoted the statement with "OO fundamentalist opinion" and "that's
: just me." and we are still looking at a looming flame war. 8-)
: But seriously, yes, static methods are convenient. I just thought that with
: so many bad programmers out there, static methods have been so abused to the
: point of causing way more damage than the benefits the convenience brings.
:
: methods

avatar
s*e
12
my $0.02.
If you are going to use spring anyway in ur project, you might want to think
tow things:
1. Do you see any chances in the future that the method/class is replaced or
reimplemented for any reasons (testing, production, etc)?
2. are the calls to the class/mothod scattered in ur code?
If either of them is true, I will go for the spring way.
Otherwise if it is just a generic utility class/method used in one or two
places, static might be good enough. I believe one benefit of static method
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。