Howard Lewis Ship – Tapestry和Hivemind项目创立人

翻译自theserversideHoward 采访,本文档版权由Tim翻译,在免费、且无任何附加条件的前提下,可在网络媒体中自由传播,如需部分或者全文引用,请事先征求作者意见。

Tim freetmp@msn.com

 

Howard Lewis Ship - Founder, Tapestry and Hivemind

Howard Lewis Ship – TapestryHivemind项目创立人

 

Howard Lewis Ship got addicted to coding at age 13 and never looked back. He began developing Java web applications in 1997 and founded the Tapestry project in 2000. He is active as the lead developer of the Tapestry and HiveMind projects (both part of the Apache Jakarta project) and wrote the definitive guide to Tapestry, "Tapestry in Action", for Manning publications. He is currently an independent consultant, specializing in Tapestry training and mentoring. He lives near Boston , Massachusetts , USA with his wife Suzanne, a novelist.

Howard Lewis Ship13岁起就义无反顾的沉迷编程。他从1997年起开始开发Java Web应用。在2000年他成立了Tapestry项目。他是TapestryHiveMind项目(都是Apache Jakarta的子项目)的开发负责人。他撰写了Tapestry的权威著作,Manning出版社出版的《Tapestry in Action》一书。他现在是一名独立的咨询师,专长是Tapestry的培训和指导。他和他的作家妻子Suzanne居住在美国麻省波士顿附近。

 

Hi Howard tell us about yourself?

Hi Howard 自我介绍下吧。

 

Well, I am Howard Lewis Ship. I am the creator and lead developer of the Tapestry project, an open source Java project for creating web applications. More recently, I have been spinning some of that technology to a new project called HiveMind, which is a services framework for creating applications in a more sane way.

好的,我是Howard Lewis Ship。我是Tapestry项目的创建者和开发负责人,Tapestry是一个创建Web应用的开源Java项目。最近,我又从Tapestry分离了一些技术并发起了另外一个叫HiveMind的项目,它是一个service的框架,用于更便利的方法创建应用。

 

So what is Tapestry and why did it come about?

那什么是Tapestry还有它的由来是什么?

 

Tapestry came out of my experiences when I was working as a consultant at a Boston-based consulting company, Primix. We had a fairly good-sized team there, 8-10 people, mix of experience levels. We had some people who are very junior, fresh out of college, usually sprinkled in a couple of people who were senior. We were doing work in Java. We were using early forms of J2EE and even earlier than that we were just doing raw Servlets and JSPs with a lot of problems because we were not getting the kind of success that we wanted. There was too much pain. Every project seemed to turn into kind of a death march. Prior to working with Primix, I had been exposed a little bit toWeb Objects. Web Objects is Apple's web application framework, component based, and having used it a little bit, done a few little demos with it and getting kind of a feel for it, I really saw the power of having a component approach to developing a web application. It was at this point where I had no projects in the pipeline had about a month or two month off and I just sort of started juggling in code and that literally turned into Tapestry. I somehow got going with that, spent a couple of weeks getting the first prototype working properly and it has just grown and grown and grown from there, it has been a lot of fun.

Tapestry是在我经历的基础上创建,当时我在波士顿一家叫Primix的咨询公司上班。在那里我们有一个大小非常适合的团队,810个涵盖了各种经验层次的员工。有一些非常年轻、刚从大学出来的新手,通常分配给一些经验丰富的老员工来带。我们在做Java方面的工作,使用初期版本的J2EE。甚至有更早的时候,我们还在最原始的那种经常会出来一大堆问题的ServletJSP平台上开发过,通常并不能得到期望的结果,太郁闷了,每个项目看起来都陷入了痛苦的深渊。在加入Primix之前,我曾接触过WebObjects,它是Apple公司的一个基于控件的开发web 应用的 framework。经过初步的使用及自己写的一些小演示来初步体验,让我看到了使用控件方法开发web应用的无穷魅力。正好我在Pipeline那一段时间没有什么项目,大约有一到两个月左右时间比较闲,期间我写完了一些初步的代码,然后它逐渐就成为了Tapestry。我继续完善它,花了好几周完成了第一个原型。然后不断的不断的给它添砖加瓦,整个过程非常有趣。

 

So how is Tapestry different from struts and other web frameworks?

请问TapestryStruts以及其它的一些web framework有什么区别?

 

If you look at things like struts and web work and most of the other frameworks, they are operation centric, you are mapping a URL to a particular operation, you want to call it a servlet or an action or what not and there are always constraints in how you build those servlets or those actions because you have to allow for the fact that everything in a J2EE server is multithreaded. So no instance variables, you have to put your logic in one place inside an action, you have to put your state someplace else, inside these request objects or the http session object. You are really mired down with all these problems. What do I name my query parameters. How do I form my URLs, how do I get those URLs mapped to the servlets, how do I than get some kind of response sent back to the client. It is just that really people get used to it, but it is really hard to expect people, especially junior people program in that kind of environment. We have all these weird impositions, multithreading basically in an event-based model instead of a traditional desktop type model.

如果你观察一下StrutsWebWork或是其它一些framework,它们都是以操作为核心,将URL映射到某个操作。这些操作可能被称作是Servlet或是Action。当你在创建这些ServletAction时候将会受到各种约束。因为在J2EE服务器里面,一切都是多线程的。因此你不能使用实例变量,你必须将你的业务逻辑放在Action里面某个地方,然后又将状态信息存放在request或是session等另外的地方。你的大量精力将会陷入在这些问题里面,要考虑怎么样命名参数,怎么样构建URL,怎么样将URL映射到Servlet,怎么样返回给客户端参数。熟练的开发者好象都已经习惯这些了,但很难期望所有的人,尤其是新手也要在这样的环境开发。我们背负这些沉重的负担,多线程基本上是一个基于事件的模型,而不是传统的桌面类型。

 

Tapestry is component centric. That means you build an application from pages, pages are build from components, components are build from components. Tapestry is having sort of a blueprint of your entire application and that means it can do a lot of things for you that normally you would have to do. Things like figuring what the URL should look like and mapping those URLs to the behavior of your application. So you will create a component and you tell it invoke this method when you get clicked if it is a link or where you can submit it if it is a form. What you find is huge swathes of code drop out of the picture because they are in the framework, they have been written once, they have been tested once and you know that servlet applications that are very hard to test. So by letting the framework do more by giving it the blueprint of the application in the forms of pages and components. It can take on all this responsibility for really boring plumbing work. The kind of stuff no one wants to write, no one wants to test, the kind of thing that can really bite you later on if you don't get it right the first time.

Tapestry是以控件为核心。就是说你的应用是页面组成的,页面是由控件组成,控件也可由控件组成。Tapestry有一个完整应用所需要的一系列蓝图,它可以为你做很多工作,通常这些都要你自己动手来做。比如自动帮你处理和调用URL。你仅需要创建控件然后告诉Tapestry当你点击链接或提交表单时调用这个控件即可。你会发现很多代码你都不用写了,因为它已经包含在framework中,它已经写好在那里并且经过了测试。你知道servlet是很难测试的。因此让framework多做些工作,为应用提供页面,控件等形式的蓝图。它会承担大部分枯燥无味的重复工作,承担大家都比较烦的那部分开发和测试工作,因为这些工作如果你自己来做,没做好以后就会带来麻烦。

 

The sounds are more like JSF. What are your thoughts on that standard and how does Tapestry compare?

这听起来有点象JSF。你对JSF标准是怎么看待的?Tapestry和它比较有何区别?

 

JSF has been coming, coming, and coming and it is kind of boogie man that is chasing way all the other web application frameworks. I think it has a very different scope and intent. JSF is sort of wedged into the JSP model, like you have a JSP page in the middle of it you got these JSF tags and you're no longer doing JSP, your do doing JSF. You are building this component object model that has this very complicated event structure. It requires a lot more Java code to get the same thing done using JSF than it would using Tapestry for example. They have really high goals that are complicated to deal with. They want to be able to have one page in one set of components, somehow render for different devices. Full desktop web browser, little WML on a palm pilot or something on a mobile phone and they have the render tips that they followed from spring so that may be able to render things differently for different environments. Very very long, very complicated and from the examples that I have been looking at very code heavy. Tapestry is much more focussed on the real world I think. It is focused on HTML. It will definitely do WML, XHTML and all that type of thing. But the groove that has been run through the framework is HTML. It is set up more for an environment like the one I was working in when I was at Primix where the pipeline started with the page designers who did not know Java, some cases they do not know HTML, they just knew Photoshop and then they turned that to HTML and then that would be sent over the Java people while the Java people of course cant do colors, can't do HTML don't know all the Java script things. So you need to be able to keep those roles separate, the HTML role, the Java role. JSF is about special tools that people are going to use to drag and drop their controls and wire them together like Visual Basic. I really do not see the HTML designers and the page designers using those stools. They are very comfortable with one tool. Each of them have their own tool. They are very idiosyncratic. They want to be able to look at HTML and just see it. Tapestry because of its approach, because it uses just basic HTML with a couple of additional attributes or occasionally an extra element, previews properly. I mean I use this four-year-old copy of Homesite and I still get WYSIWYG to review my Tapestry pages when I am developing them. So in that respect there has been the talk of division between the page centric frameworks such as JSF and Tapestry and then the other frameworks that are modelled more on Swing like Echo and I know there are a few other ones there. But I think it is more than that. I mean JSF is component based, Tapestry is component based, but Tapestry is really focused on really high presentation apps where the presentation is king.

JSF它来了来了来了呵呵……。JSF它是那种boogie man类型,追赶着其它所有的web application framework。我想JSF和我们的范围和目的不同。它是JSF模型的一部分。

 

JSF, you have already mentioned this little bit, but JSF has the promise of tools, does Tapestry have any plans for tool support?

你刚提及到JSFJSF它承诺有工具支持,不知道Tapestry有没有工具支持的计划?

 

As I said, with Tapestry, your most important tool is your standard WYSIWYG editor, Dreamweaver or your own copy of Homesite and mine still works fine. If you are working in the Eclipse platform, Geoff Longman up at Intelligent Works up in Canada, he has put together this most amazing plugin for Eclipse called Spindle and I do not highlight that in my book nearly enough. It really does a phenomenal job because in Tapestry you have the HTML templates. You have the Java code and you have the page specifications for these validated XML files. So the information is scattered between these. Some of the informations in the HTML template, some is in the specs, some is in the Java code. Spindle really unifies all that. So when you are editing the HTML you can do command completion to complete the names of things based on what is in the spec and allows you to jump back and forth and do all the work and what is really cool is he actually uses Tapestry, he has his own copy of Tapestry in there and whenever you save your files that runs them through Tapestry to verify them for errors. So that's really good. Tapestry has really, really good runtime exception reporting. I am really thinking it is probably the best that is out there, but its even better not to run the appointment first. Spindle gives you that, which is yet another big productivity gain because as soon as you save a file, it tells you if there are any errors in it and that is pretty impressive. So you have that for your Java guys and standard editor for your HTML guys. You're nearly done.

我刚说过,在Tapestry里面,你最重要的工具是你的HTML可视化编辑器,如Dreamweaver什么的软件就能很好的工作。如果你使用Eclipse平台,加拿大Intelligent WorksGeoff Longman已经实现了一个非常优秀的Eclipse插件SpindleSpindle在我的书中强调得不够。它确实是一个非常好的工具,因为在Tapestry里你需要创建HTML模板,Java代码还有XML的页面配置文件等。但是这些元素是分散在不同的文件里面,一些在模板里面,一些在Java代码里或其它不同的地方。Spindle将这些统一了起来,在你编辑HTML的时候它可以自动从你的配置文件中获取相应的信息而支持自动完成功能。你可以很方便管理这些关联的元素,很方便在它们之间跳转进行管理。更酷的是他本人也是一位Tapestry的使用者,他有他自己的Tapestry版本。当你进行修改保存时候它会自动在Tapestry里面运行以便检查错误,所以说它非常好。虽然Tapestry有非常非常好的runtime exception报告机制,我也确信他是目前最好的,但是你也不一定要用得上它。因为Spindle在你保存文件的时候它就会帮你指正错误。因此开发人员使用Spindle,美工使用标志的HTML编辑器,你需要的全部工具就都有了。

 

Some developers and designers are very picky about their URLs. How do you feel about that complaint?

一些开发人员和设计师对URL方面有些抱怨,你是怎么看待这些意见的?(译者补充:Tapestry目前版本所有的URL都是框架生成的,用户无法干预。)

 

I have always been little bit wary about that. All the applications I have done in terms of URL management. URL is really not that important. I have never really actually done an application that may use J2EE security which is URL based. So up till now it hasn't been a priority for me. Now that Tapestry generates its big URLS and hasn't been an issue, but it is becoming an issue for the user base. As the user base grows, people are using these things and some of the commiters of Tapestry like Eric Hatcher really saying we have to manage the URLs better. That is the focus for Tapestry 3.1, which is what I am working on right now.

我一直对这个都比较慎重。我所做过的所有程序从URL方面来说它们都不是那么重要。我从来没做过一个应用使用J2EE的基于URL的安全机制。因此直到现在我认为这个问题不是很高优先级要做,Tapestry生成的长串的URL机制并不是什么大问题。不过当我们的用户基数增长时候,当更多人使用他的时候,项目的一些开发贡献者象Eric Hatcher确实说过我们应该更好的来处理URL的问题。它将会是Tapestry 3.1的关注焦点,我们现在也正在忙这个。

 

The 3.0? Yeah. You still got ugly URLs.

至于3.0版嘛,呵呵,你还得忍受这种难看的URL

 

What is new in Tapestry 3.0 final release?

Tapestry 3.0 final 版本有什么新内容呢?

 

Compared to the previous release of Tapestry, which is Tapestry 2.3 while I was still in SourceForge. What's new? First of all, new license, Apache Software license ASL 2.0. New home in Jakarta , a lot of new commiters, which is great. In terms of features the big thing was in Tapestry 2.3 things were very very structured. You had yet another specification called the application specification and in it was a list of every page, you gave a name to each page and you gave it a sort of patch to each page specification and now it is an XML file. In your HTML templates you just had place holders for the components and you would say this is the span and its component foo, and then in the page specification you had to tell us what the type of foo was, which type of component it was and all the other information about its configuration, how its parameters are bound. For a new developer or someone who will do something quick in Tapestry that's a lot. To add one page and edit one file and then edit the HTML file, the page specification file, the Java file. Even with using the version of Spindle that was available back than it was still a lot of work. So the big improvement for Tapestry 3.0 is what I call implicit components. Components where you just put them in HTML templates, it looks a little bit more like JSP like, you put the type in the template, you put the configurations of parameters in the template and you do not need a page specification , or at least you do not need it for the components. Your page specification is short, you get to see exactly what is going on in your template. In the book I use the syntax almost the entire way through because it lets you look at one thing and see it all. What is great is you have your choice even within a single page you can mix and match, do part of it using implicit components and part of it using the more formal declared components. So that is one of the main features of Tapestry 3.0. Certainly there have been a lot of interesting new components added. One of my favorites is the date picker which is a nice little Java script drop down picker for dates. I think the biggest productivity gain after the implicit components, the RAD style, is the extra emphasis I put on exception reporting. There was a complaint that came in on the mailing list from a user, I wish I remembered his name saying "Boy when things go on in Tapestry you get a lot of information, why can't it tell me what is wrong with my XML file?" I wrote back and said that is ridiculous, there is no way you can do that and of course about two weeks later I checked it in so it could. So really everything it does, reads these specifications and these templates, it creates objects, it keeps track of where - which file and which line within that file that drove the creation of those objects and that means at runtime it has something it can report. It can say go look at home.HTML line 13 there is your problem and that is huge, I mean I put this together while I was working on the examples for the book for Tapestry in Action and I though my own personal productivity skyrocket because I no longer had to sneak around the way I would previously with Tapestry in order to figure out what had gone wrong? What I had done wrong. So let me think what other big features are in 3.0... a lot of improved documentation. We did a lot of documentation, added a lot of new features, really cool component reference that people really seem to like, we will come back later with more.

和上一个版本,就是还是在SourceForgeTapestry 2.3相比较,有什么新内容呢?首先是License改变了,使用了ApacheLicense ASL 2.0。我们的项目转到了Jakarta,大量新的开发贡献者加入项目,令人振奋。从特性方面来说,大的来讲就是在2.3版中是比较结构化的设计,所有的配置都放在一个叫application specification的配置文件里面,然后在这个文件里面每个页面有它自己的一段。但是新版Tapestry每个页面都有一个自己的XML配置文件,我们称为page specification。在HTML模板里面,你只需要引用这些控件,然后在page specification里面配置好这个控件的类型,参数以及其它信息。所以新的开发者很快就可以用Tapestry上手,他只要添加一个HTML模板,一个page specification文件和一个Java文件就可以工作了,甚至你还可以用Spindle插件节省很多工作。另外一个Tapestry 3.0的重大改进是我所讲的隐含控件,这种控件你只需要写在HTML模板里面,有点象JSP,可以把类型,参数等设置信息都写在HTML模板里面,因此连page specification都不用写了,至少对于这个控件你不用写page specification。所以配置起来更简单,在模板里面就可以看到所有的东西。我在我的书中几乎都是用这种隐式的方法示例,因为看起来更直观。而且更酷的是你可以自行选择用哪种方法(显式或隐式),即使同一个页面中你可以混合使用两种方法。因此它是Tapestry 3.0的主要特性。另外新版当然增加了很多有用的控件。如我最爱用的是那个日期选择的控件,它是一个漂亮的基于Java Script的下拉日期选择控件。至于那些极大提高效率的功能,除了隐式控件,RAD样式之外,那就是我强调的exception报告机制。它的由来说来话长,我曾在邮件列表上收到个一个埋怨,大致就是说“当Tapestry报错的时候可以看到一大堆垃圾信息,能不能直接告诉我是配置文件哪一行引起出错的呢”,我当时回信说这个要求太离谱了,因为没办法可以做到这样。但是两周过后我又看了一遍这个邮件觉得这个提议还是可行。因为每一步操作,如读取配置和模板,它创建对象,它可以一直跟踪回去,然后确定究竟是哪一行配置创建了一个对象。所以在运行期间,它确实可以将这些信息提供出来。如它可以告诉你Home.HTML 13行或者其他什么地方有错误。当我在写书调试我的示例程序时候也得益这个功能,当出错时候我不用一行行去查错,弄清楚究竟是哪里出错了。我再想想3.0版有哪些新东西……对了,我们有大量改进的文档。我们编写了很多文档,增加了很多特性以及控件参考手册,我们还将会提供更多的文档。

 

So how much work when you talk about the line precise reporting? How much work was that?

你在这个精确错误报告的功能上花了多少时间?有多大的工作量?

 

As I said that once big idea stuck in my head, it was maybe a week or two's worth of work to get it right. Dion (TSS Editor) has mentioned maybe it could be something to do with aspects. I am not certain about that, I did it the old hard way which is interfaces and base classes and then it just a lot of work, changing all the exceptions to take this location objects as a property that could be displayed on the exception page and just basically changing the subclassing digester which is called the digester which I used to read the specifications so that you can track the location for me, so that you get that location and plug it into the objects that are created and then keep carrying it forward. The specification objects you used to create the runtime objects - they need to know the location. So something that takes a lot of discipline and touches like an abstract all sorts of place throughout your code.

 

Lets talk about Tiles, does Tapestry have a Tiles equivalent? And does it need one?

我们来聊聊Tiles吧,Tapestry有没有一个类似Tiles功能的地方?它是不是需要一个这样的东西?

 

Tapestry does not have anything like Tiles, because it does not need it. Tapestry is all about components. Pages are themselves components, can be constructed from components and unlike JSPs, Tapestry components can have their own HTML templates. More than that, they are aware, Tapestry components are aware of the portion of its page template or its containing template that it tags wrap around and there is a component called render body that takes that and puts it in place. So what you do in Tiles by saying okay I have a navigation border up top and I have copyright message below, in Tapestry turns into a component that template has the navigational template, the render body components and then the copyright message below and of course you can go as deep as you want. There is no upper limit to how complicated and how complex you can construct your components, so there isn't a need for something like Tiles. Likewise, there really is no need to use frames for a Tapestry application because again you can construct very complicated HTML pages from all your basic components each with their own templates.

Tapestry没有类似Tiles的东西,因为它不需要。Tapestry是基于控件的。页面本身也是控件,可以由控件来创建,和JSP不同,Tapestry控件可以有它自己的HTML模板。而且它们是智能的。

 

So what is the biggest mind shift for a Struts developer that starts with Tapestry?

对于一个Struts开发者开始用Tapestry最大的观念转变是什么?

 

A lot of people come to Tapestry from struts or even a web work background and they are looking for something familiar. They are like "how do I map my URLs to actions"?, of course you don't - Tapestry does that You really have to get into this feel of just saying okay I have pages and I have components and the operations sort of are in the background. You end up with just methods on your java classes that get invoked by the framework on demand. A lot of people ask how do I gain access to the servlet API. While you can, but there really isn't the need to. If you want to have some data stored on the server persistently well pages can have properties so you can just say make this property persistent. Tapestry will take care of moving the data back and forth to the HTTP session. So in that respect, if you're looking from your expectation they are completely different beasts. I still do not understand why there is this high learning curve for Tapestry... Once you get past that high learning curve it is really a matter of unlearning your bad things, the torture that has been inflicted on you by servlets and struts and then continuing on in the Tapestry way.

有很多使用Tapestry的用户都是由Struts过来的,甚至有WebWork的经历。他们会在Tapestry里面寻找他们熟悉的那些东西,可能会问“如何将URL映射到Action里面”?当然你并不需要做这个,Tapestry已经帮你搞定了。你需要建立的意识是,你有了页面,有了控件,有了后台的操作,剩下你要做的仅是完成Java代码里面一个供框架调用的方法。许多人经常问如何才能访问Servlet API,虽然这也是可以访问的,但你完全没必要这样做。如果你想在在服务器端保存数据,你可以存在页面的属性里面,然后让属性保存即可。Tapestry自己会管理如何在HTTP session中保存和传递这些数据。因此在这个方面,如果你寻找你期望那些东西他们完全是不同的东西。我仍然不能理解为什么大家还要在Tapestry里面要这个,当你学会了那些烦琐的东西之后你需要做的是忘记掉那些在ServletStruts中折磨你的东西,不要在Tapestry里面继续了。

 

So what is coming in Tapestry's future?

Tapestry即将添加的功能有哪些?

 

As I mentioned, controlling URLs is getting more important. Right now if you look at a really big Tapestry application with hundreds of pages you end up with directories that have hundreds or potentially thousands of files in them because they all pretty much have to be in one place. I mean there are ways around that, but they are also a lot of work. You can't take advantage with J2EE security because everything is in one folder and in J2EE security is mapped to folders. So big change for Tapestry 3.1 is more control over the URLs, primarily the ability to break your application across several folders and apply security to those different folders.

如上所讲,管理URL将越来越重要。现在你要是观察一个有数百个页面的真正的Tapestry的大型应用

 

Underneath the covers Tapestry is being rebuilt to take advantage of HiveMind, which is the microkernel services framework that I been developing as a separate project. This gives a lot of capability to make it even easier to extend and override the basic services provided by Tapestry in your applications in a way that is useful to you. An example, Eric Hatcher is working for Garden on a project using Tapestry and they wanted all the messages, all the localized text messages to come not from the web application archive, but out of the database. They want their users to be able to customize some of the messages. So what he had to do was to subclass the base engine, which is the central controlling object in Tapestry and overwrite the bit of code that creates the messages subsystem, slip in his version. I think in HiveMind you will be able to do that without doing any subclassing, there will just be a place to declare your descriptors and that is kind of neat. HiveMind provides a lot of other really cool features that Tapestry could take advantage of. It is going to be very easy to add a lot power to your applications, specific things for your application. So that's one big thing. I've been getting beat up for at least a year. In fact at the last TheServerSide Symposium I think it was Jason Carreira who said "I cant justify Tapestry application because all the classes are abstract and he is right - Tapestry has its own internal testing framework of a script based system that is good for internal use, but it is not ready to be used by other people so I am in the process of converting that into a part of the framework so that people have a relatively easy way to test their application as a unit test as opposed to using something like HTTP unit, which requires running two processes.

为了发挥HiveMind的优势,Tapestry实际上已经进行了重构。HiveMind是我另外开发的一个微内核的service框架。

 

There are a lot of other features that people are interested in. There is a constant discussion on the WIKI and there is actually a constant push and pull - what should go on the 3.1. Should 3.1 be another year-and-a-half like 3.0 was or should it be six months, what goes in and what comes out. So really what goes in, lot of people have a lot of cool ideas and the WIKI which is hosted off the Jakarta home page is a is a good place to find out more about what is going to happen.

还有很多其他大家感兴趣的特性。在WIKI上有一个长久的讨论。如3.1版应该怎么搞啊,3.1版是不是又要象3.0版一样搞个一年半,还是说6个月就搞完,要添加哪些,干掉哪些。很多人都有很多好主意。这些都在JakartaWIKI上,大家对发展有兴趣可以去看看。

 

How do you see Tapestry fitting in with Spring and Hibernate and other container type persistence mechanisms?

如何让Tapestry SpringHibernate以及其它一些持久容器一起工作?

 

People really want to use Tapestry and Hibernate together and people have done some work over the last year and year-and-a-half, I mean people have done couple of different versions of PetStore using Tapestry and Hibernate and I myself am learning Hibernate, I am kind of behind the curve there and have a few other things on my plate, but I really think that is part of the way things are going to go as people are de-emphasizing J2EE and only using a few features of J2EE that they need specifically because they are looking for thinner solutions, where they have a Tomcat or a Jetty and a Tapestry and a Hibernates and maybe between those two there is going to be a Spring or HiveMind. Spring has great support for Hibernate and that of course is easily accessible from Tapestry pages because Tapestry pages are real Java objects. They are not scripts. And of course the whole thing is that Tapestry is just the presentation layer. So it really is good that you can take the persistence layer of your choice, Hibernate, the application server of your choice JBoss, BEA WebLogic, presentation layer of your choice, Tapestry and put them all together. It is really good that people have the freedom to make that choice to learn that technologies they like and use them together that way.

大家确实喜欢TapestryHibernate结合工作,在过去的一年到一年半的时间做了大量工作。我意思是说有人做了几个不同版本使用Tapestry + HibernatePetStore。我自己也在学习Hibernate。我想很多人都只用到了J2EE的小部分功能,因此他们希望有轻量级的方案。他们可能有一个TomcatJetty再加上TapestryHibernate,它们之间可能用到SpringHiveMindSpring有很好的Hibernate支持,当然从Tapestry的页面也很容易访问,因为Tapestry的页面是真正的Java对象不是脚本。当然整个来说Tapestry是表现层,因此你可以自由选择持久层的方案,用Hibernate或是什么,应用服务器也可以自由选择JbossBEA WebLogic等。然后将它们放在一起。人们高兴的是可以自由选择喜欢的东西然后把它们组合起来工作。

 

Tell us a little bit more about HiveMind and where did it come from?

能不能给我们介绍一下HiveMind以及它的由来?

 

HiveMind kind of grew out of three different places. While I was still working at WebCT, WebCT has a huge project that is called Vista , its their big J2EE enterprise educational support software. So its a big big application, thousands of Java pages, thousands of JSPs, I've rarely seen anything even close to this and of course like all projects this developed under time constraints and with our team distributed across India, Massachusetts and Vancouver, British Columbia. So there's a lot to it, no one person really knows everything that is going on in Vista, but I've seen quite a bit of it and there was some desire to do some refactoring work on it and one area that was slotted initially was the idea of rationalizing how does it start up and shutdown, because it runs inside BEA WebLogic, but has a lot tools, it's a collection of many different tools working together. Each tool may want to do something special to start out, bring some database tables and cache the information or set up a JMS connection or that type of thing. I've been pushing the idea that we should have some kind of microkernel to manage this kind of thing rather than do it explicitly in Java code and they got a little traction on this when it had to do the start up and shutdown piece using things using HiveMind. So I developed HiveMind for that purpose and again the vision of HiveMind is one part eclipse plug-in API where you have a microkernel that just knows how to assemble something from plug-ins, now in the Eclipse tools, their plug-in API is final based, its expecting directories with particular structure and particular XML file, but it does something very useful. It reads all that information and it defines extension points for defining tools bars and extension points for defining menus and extension points for defining your build process. So that's what we neat, I mean Eclipse when it starts up doesn't know what it is, it doesn't know that it is a Java IDE because it isn't, it is a microkernel that has plug-ins and makes that it a Java IDE. I had the vision of doing something like that, but for Vista, where Vista would start up, and it will just be the nature of the plug-ins that will determine how everything fits together. It is a kind of HiveMind is a god in the machine. It has the broadest possible view of all the different pieces of the applications and knows how to make them all work together. That is kind of a microkernel thing. So HiveMind has fortunately lived on after I left WebCT and decided to go consulting independently and it is taking on a life of its own just like Tapestry did four years ago.

HiveMind主要从三个地方成长起来的。当我在WebCT工作的时候,它有一个叫Vista的大项目,Vista是一个企业级的教育培训软件,因此非常非常大,有上千个Java页面和JSP页面。我很少碰到过象这样的大项目,因此当然对在这里的所有项目很感兴趣。项目要求紧迫的进度,开发团队也分布在印度、麻省、温哥华、英属哥伦比亚几个不同的地方。因此项目包含很多东西,没有哪一个人真正了解Vista项目的全部进行状态。但我有幸见识了项目不少的方面。项目中需要在某些方面做一些重构的工作,并且初期就在如何合理化启动和停止方面预留了接口,因为它在BEA WebLogic上面运行,有很多工具在一起工作,每个工具都需要在启动的时候做一些特殊的工作,打开数据库表缓存一些数据、或者是建立一个JMS连接等类似的事情。我曾经致力提出应当建立一个微内核来做这些事情,而不是每个地方都来写一段Java代码。他们在碰到确实需要一个类似HiveMind这样的工具来处理启动和停止功能时候也给了我一点动力。因此我就为这个目的开发了HiveMind,而且HiveMind的想法是成为Eclipse plug-in API一部分,你有一个微内核,它知道如何来从plug-in中合并各个元素。现在Eclispetools里面,他们的plug-in API

 

So how does HiveMind compare to Spring and PicoContainer other these lightweight containers?

 

They are all pretty good ideas. Each one is going to tickle an individual person's needs in a different way. PicoContainer is a sort of a the leanest and meanest one but what's neat about it is it doesn't require that the objects implement a particular interface, Spring is the same way, it doesn't care about interface so much. HiveMind is very much interface oriented, so every service in HiveMind needs to implement a specific interface, which gives us a lot of latitude to do a lot of interesting AOP like thing using just standard technologies like dynamic proxies or JBoss' JavaAssist framework. In terms of maturity, PicoContainer is new, Avalon has been run for a quite a bit longer. Spring is gaining a lot of traction and has some really great integration with some other big tools like Hibernate. HiveMind is sort of I think catching up to those. I think the biggest difference between all of them is that first of all HiveMind have the same line precise error reporting as Tapestry, which is great because it is so driven by XML. Second, none of the other frameworks, especially Spring, PicoContainer idea have this configuration idea that I borrowed from Eclipse for HiveMind. So they can talk to a lot of services and configuring services, connecting services, but HiveMind has this idea of configuration data that can come from different locations. Like I was saying with Eclipse you can talk about a tool bar in that different modules can contribute to that tool bar, you can do the exact same thing using HiveMind which really makes sense in any kind of application, web application, desktop application.

 

Great. Can you use HiveMind and Spring together?

 

You can't use them together yet, but there is no real reason like any of these containers, HiveMind, Spring, Avalon can't run one of the other containers as a managed bean or service or whatever the right terminology is. I think everyone is going to integrate with everyone else. People have done pictures of this and I fully expect to have a way in HiveMind of having Spring as a service that can provide beans managed by Spring as other HiveMind services that will be fairly simple to do and I think doing something similar from the Spring side into HiveMind would also be very simple and we are talking dozens of lines of code.

 

Can you use HiveMind for configuration?

你能使用HiveMind进行配置工作吗?

 

That is its primary purpose. The primary purpose of HiveMind is to configure your application to supplement the static code, the classes and other such of your application with more sophisticated logic that talks about the life cycle of these different services, configures them, makes them collaborate with each other and takes care of a lot of busy, dumb work plumbing like as with Tapestry. Concerned in this case with when do you instantiate something, how do you ensure you do it in a thread safe manner, how do you configure it, how do you connect it up to other services. Your HiveMind does that and to my mind HiveMind does it once, does it right, does test it, and it is just ready to be used in any kind of application.

当然,这就是它的主要功能。HiveMind的主要目的是配置你的应用

 

Excellent. So what are you excited about in Java at the moment?

讲得好。当前Java中哪方面的技术令你比较兴奋?

 

There's a lot going on is Java. I think I really am looking forward to the attributes, being able to put the annotations on Java code, its really going to change how frameworks like Tapestry and HiveMind operate at some point in the future. So you are going to see a lot of interesting tools that way, but I think one of the things I like about Java, having worked in languages like PL1 and Objective C and thinks like that, is Java already is more than good enough. I think there is theory that every problem that we have developing today can be solved by just finding a new language that has that one or two little features that were missing, we have seen that before and maybe it was more realistic in the past, bringing up towards the range of Java, where you didn't really have garbage collection like in C than, there is limit to how complicated you can build an application. I still think that Java on the server side is more than good enough and although I am excited about things like Groovy and I like the concept of scripting languages like Groovy and Python. I don't want to make yet another trade off of processing power for just a couple of more features and to my mind frameworks like HiveMind take the edge off the problems that are in Java, which again is some of this boring plumbing work about instantiating, configuring and connecting. So I think Java is like fertile ground to build really powerful solutions and there is really no need to go chasing the next magic language and again reset our language power versus CPU power equation yet again. There was something else I wanted to talk about. I think I mentioned Groovy, which I think is pretty groovy, and maybe something I'll use in Tapestry once it stabilizes.

Java方面很多都在进行。我想我最期望的是Java的注释(annotation)功能,它将会给类似TapestryHiveMind这样的Framework带来某些改变。所以你看到现在有很多有趣的工具在做这样的事。但我认为我喜欢Java的一点是它象其他一些语言如PL1Object C,已经工作得够好了。我想有一种理论是今天我们碰到的所有问题,都可以用一种新的语言来弥补它没有的一两种特性。我们以前见过,或许过去的更现实一些。相对Java来说,你不能具有garbage collection功能,如C语言一样。这些将限制你构建的应用的复杂程度。我依旧认为Java在服务器端已经做得够好了,虽然我也对其他一些语言感兴趣,如Groovy。我喜欢脚本语言的理念如GroovyPython。我不想为了一两个新的特性放弃掉现有的东西,那意味又要重新完成这些烦躁的工作,又要去考虑初始化,配置以及连接等等。因此我认为Java就是一个用来构建强大方案的肥沃土壤,完全没有必要去追求另外一种神奇的语言,然后推倒所有的现有资源重来。另外我想谈的是,我认为Groovy确实非常迷人,或许当它稳定以后可以考虑在Tapestry里面一些合适的地方使用它。

 

Would you like to see the JCP change?

你希望看到JCP改进吗?

 

Yeah. The JCP to me is a little problematic. If you look at something like JSF which is one of the JSRs I've been following with great detail. Long gestation time, what it produced at the end were basically being expected to take on faith, does JSF work, does it scale, how does it perform, can it handle some of the really complicated cases that come up in real application design. Well I guess that we really want to go line by line through the reference implementation you could find out. Again this hits close to home; in Tapestry, some of the things you might want to do with an application were a surprise to me. Even a year or two into building Tapestry and I have the freedom because I wasn't a standards body, I wasn't producing a reference implementation and locking people into one particular approach. I had the freedom to go back and correct my mistakes. JSF there are going to be mistakes in JSF 1.0, but people are going to be locked into it and what you are going to see is a lot of application specific, application server specific kludges, application specific components and so forth. I am not sure what you are actually going to gain by having JSF as a standard since in order to use it you are going to use a lot of vendor specific things, vendor specific tools, vendor specific configuration files perhaps, but again the whole point is the JCP I mean the fact that they are trying to innovate inside a committee just doesn't make sense. Okay, perhaps they could set the bar, they could say we need a component framework or we need whatever the next big thing is. All you people here, publically provide an idea of what that should look like, provide an implementation, provide a design and that's the first task and their job is to pick the winner, based on criteria that are public and available and obvious and a very open thing, so you can see what BEA is producing, we can see what JBoss, we can see what IBM is bringing to the table in terms of a potential standard. Is that realistic for the vendors, they don't want to do it that way, so who exactly is the JCP serving?

当然。在我眼里JCP是有点问题。如果你仔细观察JSF一下如我参与的一个JSRJSF,漫长的前期时间,结果所期望无条件相信,JSF是否能工作,是否具有扩充性,能否处理一些现实中存在的真实的复杂应用。我想我们真的需要一行一行去读RI(参考实现)才能知道。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值