Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Architecture & Framework » Spring Framework  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:探讨Spring框架使用真相 [Re:nothing]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2004-08-27 23:10 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.


其实说白了,大家"惊奇"的是它的IoC模式(使用AOP功能需要了解AOP,比较难),那么,Spring之类的Ioc模式是什么? 就是:你在编制程序时,只要写被调用者的接口代码,具体子类实例可通过配置实现。

  Ioc模式是什么知道的人不多,但是,当他知道生成对象不用再使用new了,只要在配置文件里配置一下,他感到新鲜,其实这就是Ioc模式的实现,PicoContainer是另外一种真正轻量的Ioc模式实现,PicoContainer还是采取代码将对象注射一个小容器中,而Spring采取配置文件。

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.


Spring最近还发表了Spring without EJB的书,这倒是说了实话,Spring和EJB其实是相竞争

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.


1. Spring不介入EJB容器

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.


如果硬套上EJB使用,只是相借助其集群分布式功能,而这个正是Spring目前所缺少的

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.


为了避免你每次使用Spring时想到粘糊糊的异型,不如Spring without EJB,这也正是Spring的初衷

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).


floater edited on 2004-08-27 23:15

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code

话题树型展开
人气 标题 作者 字数 发贴时间
27328 [精华] 探讨Spring框架使用真相 nothing 2685 2004-08-27 21:41
25106 Re:探讨Spring框架使用真相 floater 4691 2004-08-27 23:10
23625 Re:探讨Spring框架使用真相 tier3 186 2004-09-14 17:40
23723 Re:探讨Spring框架使用真相 dissip 550 2004-09-03 12:37
23507 Re:探讨Spring框架使用真相 jeffrey_he 66 2004-09-07 09:17
23337 Re:探讨Spring框架使用真相 floater 157 2004-09-14 21:25
23416 Re:探讨Spring框架使用真相 supertoy 536 2004-09-19 20:11
23241 Re:探讨Spring框架使用真相 tommy_kin 38 2004-09-30 15:17
23293 Re:探讨Spring框架使用真相 davidself 96 2004-09-30 15:21
23252 Re:探讨Spring框架使用真相 ww1ww1 112 2004-09-30 20:12
22996 Re:探讨Spring框架使用真相 jameszhang 123 2004-10-13 08:36
22978 Re:探讨Spring框架使用真相 floater 70 2004-10-13 09:08
23272 Re:探讨Spring框架使用真相 alexwish 107 2004-10-20 16:52
23329 Re:探讨Spring框架使用真相 kavinwang 250 2004-10-20 21:32
22980 Re:探讨Spring框架使用真相 helloworld 348 2004-10-21 02:54
22928 Re:探讨Spring框架使用真相 littledeer1974 654 2004-10-21 08:41
22806 Re:探讨Spring框架使用真相 emarket 331 2004-11-07 17:37
22760 Re:探讨Spring框架使用真相 kavinwang 176 2004-11-07 18:46
22946 Re:探讨Spring框架使用真相 floater 1842 2004-10-20 23:11
23121 Re:探讨Spring框架使用真相 hncszy 618 2004-10-21 00:33
23087 Re:探讨Spring框架使用真相 lcwling 121 2004-10-21 00:18
24052 Re:探讨Spring框架使用真相 lcwling 5 2004-08-28 00:25
23073 Re:探讨Spring框架使用真相 errorter 76 2004-10-21 03:27
22921 Re:探讨Spring框架使用真相 jameszhang 31 2004-10-21 08:19
22937 Re:探讨Spring框架使用真相 tangming 82 2004-10-21 11:26
22868 Re:探讨Spring框架使用真相 floater 67 2004-10-21 11:44
22954 Re:探讨Spring框架使用真相 tangming 27 2004-10-22 10:04
23104 Re:探讨Spring框架使用真相 kavinwang 23 2004-10-27 14:20
22804 Re:探讨Spring框架使用真相 kavinwang 74 2004-11-05 15:14
22506 Re:探讨Spring框架使用真相 floater 73 2004-11-07 03:12
22818 Re:探讨Spring框架使用真相 floater 104 2004-11-08 02:05
22608 Re:探讨Spring框架使用真相 主管 55 2004-11-08 11:47
24082 Re:探讨Spring框架使用真相 hncszy 52 2004-08-28 09:08
22982 Re:探讨Spring框架使用真相 malulu 41 2004-11-11 18:44
23090 Re:探讨Spring框架使用真相 HenryYu 201 2004-12-15 13:20
23853 Re:探讨Spring框架使用真相 wes109 356 2004-08-30 17:38
23804 Re:探讨Spring框架使用真相 wes109 75 2004-08-30 17:42
23901 Re:探讨Spring框架使用真相 juweiping 370 2004-09-07 11:39
23322 Re:探讨Spring框架使用真相 wes109 304 2004-09-15 08:37
23973 Re:探讨Spring框架使用真相 dissip 788 2004-08-31 19:26
23840 Re:探讨Spring框架使用真相 holyadai 116 2004-09-02 09:07
23659 Re:探讨Spring框架使用真相 helloworld 64 2004-09-02 11:15
23677 Re:探讨Spring框架使用真相 wes109 63 2004-09-02 11:46
23658 Re:探讨Spring框架使用真相 floater 2689 2004-09-02 12:09

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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