Topic: 探讨Spring框架使用真相 |
Print this page |
1.探讨Spring框架使用真相 | Copy to clipboard |
Posted by: nothing Posted on: 2004-08-27 21:41 http://www.jdon.com/jive/thread.jsp?forum=91&thread=16142 探讨Spring框架使用真相 |
2.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-08-27 23:10 Sigh, I just don't have time to comment these posts, but I guess I just have to do this. code is one thing, the reason behind it is another, the concept underneath it is a third. We need a little bit comprehension. Spring真正的精华是它的Ioc模式实现的BeanFactory和AOP,它自己在这个基础上延伸的功能有些画蛇添足。 The core package(bean factories) and aop are foundations for others(context, dao, orm, transactions, web, etc). These others are not 画蛇添足, they solve particular problems, most stated in the expert 1-1 book. I guess this 板桥里人 doesn't understand what those problems are and thus have these comments.
Yes, this is the behavior. The real reason is the code dependency. Every line of code we write introduces dependency. This dependency creates all sorts of trouble and inconvenience for us and thus we want to isolate them desperately. When you have millions of lines of code and hundreds of applications, this is a very serious problem. Other benefits are reusable code, uniform resource handling, easy testing, flexibility, etc.
This is undeniably true, so we need a tool for compile time rather than runtime. I consider this a minor side effect of the surgery. Every solution to any problem will have some side effect. If it's a minor, we can live with it, then it's a good solution. I consider Struts' side effect as major.
This 板桥里人 indeed doesn't understand what the problems are. Spring is not trying to replace EJB, it only replace it where it's broken, although EJB is broken in a lot of areas. Still that old saying, if it's not broken, don't fix it. The books have this, read them - when you need distribution(imposed by the business requirements, not others, like developers want to use it). So it's a compliment, and it's a very nice one because we don't need to pay for something we don't need.
Spring simplifies EJB programming a little bit, to the extent it can handle. Without Spring, if you have to use EJB, that's fine. With Spring, it helps a lot, e.g., the factory bean from spring, etc. It's your choice. But I would go with Spring. If you write 10 EJB beans, you would realize there are some common code in these beans and callers. Spring just puts these common code into libs and so makes your lives easier.
It's up to requirements, we just want to do minimal work.
I said it in 黑与白's comment. Another benefit the hookups between EJB and other components, integration. This is more on the EJB client side. The rest of the comments about transactions are due to historic reasons and compatibility. EJB's transactions are heavyweight. If you don't need distribution, you should use Spring's transactions, it's simpler and easy to test. However, if you have some code already in production, you can use Spring in conjunction with EJB, that's why there is 还要套上EJB. Actually, I think the nested transaction is a new feature in 1.1, required by some users, as I read bbs.
This is precisely that Spring didn't plan to do. If EJB can do the job in the distribution, why bother to reinvent the wheel? Let EJB do the job, and use Spring to hook EJB with others.
rod johnson clearly said in the book and on the bbs that use it when it's appropriate, when you need distribution. I don't know wherethis guy got this idea.
I don't even know this is a popular book or not, do I need to care, hell no. As long as it's useful for me. Harry pot and lord of the ring are more popular, I have them setting on my harddrive for a long time and never touched them. We need experience and background to understand the logic behind the superfacial behaviors. The logic deduction solely based on the behaviors could be off the right track, if we don't understand what the problems we are facing. Rod's two books are the most comprehensive to state these problems, as far as I know. Get the logic right first, and then see how they do it, not the other way around(unless we are at the code level). |
3.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: lcwling Posted on: 2004-08-28 00:25 鼓掌... |
4.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: hncszy Posted on: 2004-08-28 09:08 由此可看出“ this 板桥里人” 对Spring某些方面的理解还比较肤浅啊!有些还是错误理解,呵呵…… |
5.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: wes109 Posted on: 2004-08-30 17:38 中午敲了半天,突然停电,真郁闷 偶觉得spring真正的精华并不是什么ioc和aop,这东西是实现的不错,但只是基础,对偶比较重要、比较欣赏的是那些“画蛇添足”的东东,很多都是非常实用的,解决了许多以前想要解决的问题 我觉得ioc很大程度上是一种思维方式的颠覆,而不是改进 从代码上说,在对以前的程序采用spring进行重构的时候,dao的facotory被干掉了,自己写的那个自以为不错的“可配置、多种方式自由切换、连接多数据库”的组件也派不上用场了, 很是心痛的说。。。。hoho~~~~ 感觉banq在大的采用ejb的集群系统关注的多些,与spring这种轻量级解决方案存在一些想法上的冲突吧 偶现在对spring的态度就是:enjoy 。。。。。。。。。。。。 |
6.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: wes109 Posted on: 2004-08-30 17:42 spring的配置文件并不复杂,犯错的几率还是比较小的 同时也期待一种可视化的编辑器出现,可视化的生成xml,显示相互之间的关系,主要是引用关系 |
7.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: dissip Posted on: 2004-08-31 19:26 As i think, dependency injection(ioc) is the core of spring. (but some other projects also have similiar ideas, e.g. picocontainer) Another good thing is its MVC implemtentation of the web framework. It seems it is seperate the responsibility more clearly than struts(And it also seems more complex) and make those web application more pure. And it also provides some useful utils for projects such as its jdbc lib. But as for aop, I don't agree with Rod. As I think, becuase there are some crosscutting concerns which he has to face in his lib (e.g. the dao lib which requires to manipulate transaction demarcation-- a common candidate for aop), he includes the aop as part of spring. But tiing the spring to a single implementation of an aop implementation will hinter itself. |
8.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: holyadai Posted on: 2004-09-02 09:07 看了Expert.One.on.one.J2EE.Development.Without.EJB这本书的一部分后,觉得banq对Spring的了解太浅薄了或者根本就不了解,看来这个人是被金钱冲混了头脑,不再研究学问了,只是故弄玄虚。 |
9.Re:探讨Spring框架使用真相 [Re: holyadai] | Copy to clipboard |
Posted by: helloworld Posted on: 2004-09-02 11:15 眼花了,一堆一堆的framework 其实都是弄几个.jar,.dtd,再写几个xml, just so so !! |
10.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: wes109 Posted on: 2004-09-02 11:46 嗯,最近把以前的一些组件用spring重新写 代码少了,扩展性好了,耦合度低了 就是有点感觉像在用xml编程似di |
11.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-09-02 12:09 comments on aop, I tend to agree with rod. AOP is still evolving, far from mature. It's a two-edge sword. We could benefit from it, and get hurt too. that's why I tend to agree with Rod in his book, do it on a bigger scale, rather than on every object. I am not sure, yet, whether my concerns are aop implementation related. Rod mentioned spring aop is working on the aopalliance interfaces, not on particular implementations, could be used seperately too. Of course, these interfaces are likely to change too over the time. But I think dissip raised a very good point, worth keeping an eye on it. Spring framework is, by far, in my view, the simplest framework(You just can't beat an one-method interface(Controller)). So, at first sight, one could get lost in the forest; in fact, there is only one logic of thread. And I think not only Spring reaches this simplicity, but also this should be the way to go. From my experience in the last few years, I had this plan to develop a framework, pretty much the same as Spring web, but when I saw the spring one, I rest my case because it covers more than I planned, the IoC part. The only thing I added was the chain action portion in my tutorial, that was in my original plan, to further seperate actions from controllers(besides seperating views from controllers). The only thread in Spring web is Controller-SimpleFormController, this should be the start point for new comers. Then one can expand this thread horizontally to others, as shown in the charts in my tutorial. Spring web is better than struts in many ways, some of them are very fundamental, like view seperation, model seperation, interface driven, etc. I view struts as at least 4-year old technologies, the fact that it's popular doesn't mean it's a good choice. In my environment, it's popular among cobol converted java developers, no coding exp managers/architects. I don't even feel it's worth my time to convince those folks going Spring. I just leverage the power I have and put Spring in, my core team is convinced by the amount of code(With Spring, the code is really really small, easy to read). I just hope the folks here don't miss this piece. I used Spring and ibatis on one of my projects, most of the classes are less than 10 lines. Most of the config files are one page, even if it's more than one page, the entries are pretty much isolated, so there is no difficulty to read through. expert 1-1 WEJB has some good network stuff. The major issues with Spring in my practice are: Hard to see all the config files, need a tool here. dynamically change the config settings and save back to files. like wes109 said, enjoy it, it's a pearl. |
12.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: dissip Posted on: 2004-09-03 12:37 dynamically change the config settings and save back to files. I still think that dynamic configuration fall in the domain of jmx. (I have posted my concern for difference between spring and jmx before) Although I wish it will, to make spring to implement this is difficult because currently spring (as a container) that only manage the creation and detroy(only for singleton) at startup/shutdown phase. it doesn't provide any management at runtime. To make it dynamic configuration in concurrent system need a lot more work. |
13.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: jeffrey_he Posted on: 2004-09-07 09:17 banq是一个EJB的狂热拥护者,不管是非黑白,总之一句话“EJB就是最好的解决方案”。这不是一个技术人员应有的态度,在此表示遗憾。 |
14.Re:探讨Spring框架使用真相 [Re: wes109] | Copy to clipboard |
Posted by: juweiping Posted on: 2004-09-07 11:39 wes109 wrote: 我正在做这方面的工作,我做了其在JBuilder下的OpenTools,现在具备Struts/JSF类似的可视化编辑配置文件功能,但是Spring的Web框架/Client框架是以来Bean的名称/或者说类型来分类的,所以还需要对不同类型的Bean进行分类处理,有些麻烦,还需要些时日。 技术的评论不能只从理论上进行,只有自己亲手去实践才能够真正的认识到问题的关键,从我使用的经验来看,Spring从思想上目前来说绝对是Best,不过其目前缺点在于使用的复杂性,开发的效率,所以就要加强辅助工具的开发。 |
15.Re:探讨Spring框架使用真相 [Re: floater] | Copy to clipboard |
Posted by: tier3 Posted on: 2004-09-14 17:40 how about paste the comments from floater here to http://www.jdon.com/jive/thread.jsp?forum=91&thread=16142? maybe it will be funny if there are more people joining the discussion. |
16.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-09-14 21:25 Hehe, I didn't intend to target anyone, just feel we should be a little bit objective. If my comment is good for more healthy discussion, feel free to do so. |
17.Re:探讨Spring框架使用真相 [Re: juweiping] | Copy to clipboard |
Posted by: wes109 Posted on: 2004-09-15 08:37 juweiping wrote: 期待:) |
18.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: supertoy Posted on: 2004-09-19 20:11 banq这个人是名人了,在那个垃圾的程序员杂志上还当上了专家,每期都发表一些高论。 不谈技术,‘我对该人有些反感, 顺便说2个 该人曾经和写java和模式的作者有次论战。Dr. Yan声称banq的书里面借用了yan的一幅图,和若干比喻。banq没有承认,只是说什么百条道路通罗马云云。最后来了一句,他研究模式的时间短,但是人nb,现在在模式的上造纸已经超过yan云云。Dr yan写的东西,我是觉得有些啰嗦,简单事情复杂化,但是他莫名其妙的比喻,banq如果不是抄的,岂不是说明他和Dr yan也是一路水准,怎么又变得领先云云? 人品很是有点问题。 该人曾经和某位牛人论战,最后耍赖要求人家去好好看看的鼠标绘画作品,说一个想这样热爱生活的人,努力钻研的达到如此绘画境界的人,怎么可能技术会xxxxx云云。 绘花画鸟本来就讲的是一个性情,如此火爆性格,容不得人的态度,画出来的东西怎么也好不了了。在jdon上经常可以看到他痛贬某人的言论。还画什么画呀,简直是侮辱中国文化 动则以道友称呼,弄得我总觉得他是不是李师傅一样的人物。不懂装懂的言论甚多,成了名人以后愈发膨胀。最近又开始贬web service了。他贬的都是他从来没怎么做过的东西,真是牛人一个。 |
19.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: tommy_kin Posted on: 2004-09-30 15:17 有话为什么不好好说,有汉字为什么不好好写,要体现一下自己英文水平之高深??? |
20.Re:探讨Spring框架使用真相 [Re: tommy_kin] | Copy to clipboard |
Posted by: davidself Posted on: 2004-09-30 15:21 tommy_kin wrote: 习惯而已,没什么可说的。 |
21.Re:探讨Spring框架使用真相 [Re: tommy_kin] | Copy to clipboard |
Posted by: ww1ww1 Posted on: 2004-09-30 20:12 tommy_kin wrote: 练习英语水平啊,整天都是和汉字打交道,想换换口味,如何? |
22.Re:探讨Spring框架使用真相 [Re: tommy_kin] | Copy to clipboard |
Posted by: jameszhang Posted on: 2004-10-13 08:36 tommy_kin wrote: 其实应该体谅,当你的环境都是英文,你会来回切换吗?我估计根本就没有中文输入,哈哈哈 |
23.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-10-13 09:08 even the chinese fonts are very limited, not mention the input at all. |
24.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: alexwish Posted on: 2004-10-20 16:52 说真的我对板桥还是很佩服的。 此人能融技术于性情之中,也可以说是个大家吧。 只是我感觉没有必要为了技术而争论。 技术只是工具,在不同的场合下,谁能解决问题,那那个时候的技术就是最好的。我更看中实用性和高效性。 |
25.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: kavinwang Posted on: 2004-10-20 21:32 floater: 能解释一下干吗不用汉字发表你的看法? 我为下面的内容先向你道歉! 首先我声明,我能看懂你所写的任何一部分内容。 但我想此处为一个论坛,各色人都有,也许有很多来这儿的同志鸟语并不是很好,但他们带着强烈的求知欲来此,目的想学些东西,或求些帮助。我知道你的很多高见我都很是佩服,难道这些你只想写给我这些人看吗?如果是的话,那你不必发表了,我的见解不见得不比你独到,如果不是,那请你用回中国字,让大多数同志能够欣赏你的言论。 当然,也许你也有苦衷,如果是这样,我再次向你道歉! |
26.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-10-20 23:11 The short answer is: I can't. The long answers are here: 1. I type chinese chars very slowly, comparable to java newbies' ClassNotFound. 2. I can't type in chinese in my workplace, it's an english env, can't install anything without permission. 3. I've lived abroad for 15 years, so my technical terms in computers are english oriented, writing in chinese simply interrupts my thinking dramatically(like drawing a circle in one hand and drawing a square in another...). I talked with mainlanders here, they have the same problem as I have. We always joke around: our english is better than chinese, our chinese is better than americans(not the other way around, in order to feel good, ). 4. Help folks who want to improve english, exchange ideas, contribute to whatever I could to the chinese community, maybe 1-2 hours a day. I am using english, I am talking to folks here or elsewhere in chinese bbs, not because I can use english, I live somewhere, I look for some kind of fame, follow some trend. No, not those, I am too old for those. I come to here to contribute, maybe my contribution is small, 1-2 hours a day, maybe I am not good at many areas, but I can share whatever experience I have. I've been here for almost two years, I found I benefit from here more than I contribute, I guess life is always even. Folks may not like my english approach at first, but if they think twice, they could take this chance to benefit from it too. I like this forum because it's more concentrate on technicals, not politics or fashion shows. That's why I sighed at the beginning of the first post. The reason I wrote that was intended to correct something that I believe incorrect, which is entirely arguable. Furthermore, I would like to see more practical approaches, rather than testing approach or even blindly trend following. |
27.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: lcwling Posted on: 2004-10-21 00:18 支持floater,的确为我们贡献了不少,不仅是技术上的帮助,还有语言上的提高;就像以前的一位主管,他是Taiwan人,在美国学习,工作了好几年,提到“物件导向”,我们不知是何新的技术,说到oo,大家一下就明白,勉强翻译,时常会带来沟通不良! |
28.Re:探讨Spring框架使用真相 [Re: floater] | Copy to clipboard |
Posted by: hncszy Posted on: 2004-10-21 00:33 floater wrote: 支持floater!!! |
29.Re:探讨Spring框架使用真相 [Re: kavinwang] | Copy to clipboard |
Posted by: helloworld Posted on: 2004-10-21 02:54 kavinwang wrote: 如果你在这个论坛时间长了,你就会知道好多...... 新到一个论坛,你该先了解一下环境先... |
30.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: errorter Posted on: 2004-10-21 03:27 呵,关于语言的问题 floater等人似乎已经解释过好几次了 我印象中都第三次了——虽然来这是时间不长 其实有问题或疑问的时候首先该使用搜索的 |
31.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: jameszhang Posted on: 2004-10-21 08:19 不要强人所难,支持floater,呵呵,身处他乡容易吗?!!! |
32.Re:探讨Spring框架使用真相 [Re: kavinwang] | Copy to clipboard |
Posted by: littledeer1974 Posted on: 2004-10-21 08:41 kavinwang wrote: 我也在国外(6年了),深深明白floater的感受,所以我从来不会对写英文的人有什么想法,Kavin你的意思我也明白不过,大家都是冲着提高技术来的,我想floater也绝对没有什么炫耀或是什么其他的目的 就象你刚来就发表很多贴子,回答很多问题,我也不会理解成你是在炫耀什么,我只是觉得,我们这里又多了一个热心的同行,一直在高兴呢 其实你再多了解了解会发现这里的同志们是不错D 还有就是[鸟语]这个词,以后尽量不要用了,好吗(有人说中文是鸟语的话,你生气吗,对不),谢谢你了(你说到求知欲,读英文也是一种学习嘛,学习计算机知识,英文有多重要也不用在这里讨论了吧,当然了这里也不是,也不能强迫大家的,换个角度来想,营造这样的环境是不是也是一个有意义的尝试呢) 不知道,你能否同意我的想法呢,kavin |
33.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: tangming Posted on: 2004-10-21 11:26 这个问题都不知道说了多少遍了, 如果翻过以前的帖子肯定解释过的。 到一个论坛先潜水一阵子搞清楚状况再疑问也不迟, 相信floater被问得这么多次,也要烦了。 |
34.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-10-21 11:44 yea, a little, maybe I should consider making this at the top, . |
35.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: tangming Posted on: 2004-10-22 10:04 干脆在签名档写上: 不是我不想用中文,条件不允许啊! |
36.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: kavinwang Posted on: 2004-10-27 14:20 All just a word: sorry! |
37.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: kavinwang Posted on: 2004-11-05 15:14 我的中文不是太好,英文还不如中文! 如果哪位能够把floater的一些精彩的言论翻译成为中文,可能会对很多同志有益,也是一个大大的善举,善事。 |
38.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-11-07 03:12 I am glad if it's useful and practical, otherwise treat them as chatting. |
39.Re:探讨Spring框架使用真相 [Re: kavinwang] | Copy to clipboard |
Posted by: emarket Posted on: 2004-11-07 17:37 kavinwang wrote: //hehe, 个人观点,鸟语不好,就不要学飞了,否则永远慢人家半拍。 |
40.Re:探讨Spring框架使用真相 [Re: emarket] | Copy to clipboard |
Posted by: kavinwang Posted on: 2004-11-07 18:46 emarket wrote: 如果再不学飞,慢的就不是半拍了。很多同志要吃饭的,难道因为要慢半拍而饿死自己。 声明:floter同志的英文问题已经解释得很清楚了,本人也为自己的言论道过歉了,甚至现在内心对那件事还有些遗憾。 |
41.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: floater Posted on: 2004-11-08 02:05 no, no need 甚至现在内心对那件事还有些遗憾. Here is where we communicate with each other, not fight against each other. |
42.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: 主管 Posted on: 2004-11-08 11:47 站在不同的角度讨论不同的问题是产生争议的根本。没有context没有约束的问题通常会有这样的争议。 sigh |
43.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: malulu Posted on: 2004-11-11 18:44 大家还是把注意力放在讨论的话题本身吧,有时用鸟语反而更好,可以让人慢慢看,仔细想。 |
44.Re:探讨Spring框架使用真相 [Re: nothing] | Copy to clipboard |
Posted by: HenryYu Posted on: 2004-12-15 13:20 spring是个好东西,ejb也是个好东西,很难想象j2ee开发没有应用服务容器是什么的样子的情形;分布式对象传递、容器事务、jms等等服务正在各个j2ee容器厂商赖依生存的基础,难道有了spring,ibm、bea等公司就等着game over了?显然不是,spring的出现减低了开发j2ee的难度,并不是改变了j2ee开发的道路。技术以项目为本,如果我们的项目需要分布式,我们没有理由抛弃ejb。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |