Month: June 2009

[Rod Johnson] 做一个vertical slice,在开发周期内就做好性能测试

也就是在当前所有的功能模块中做一下“切片”,切出来的片可以典型地代表系统的性能,如果这个切片能通过测试,那就可以认为系统性能可以满足要求。 那么怎么样决定哪个功能属于切片呢?"Often the vertical slice will implement some of the functionality that we suspect will have the worst performance in the application and some of the functionality that will be most heavily used in production"

[Rod Johnson] 不打包,直接部署一个文件夹

我以前就是这样做的,自我感觉挺轻便,却被别人强烈鄙视,说是不合规范! 现在你看,Rod Johnson自己都这么做,还有什么可说的? 这样做还有个好处:“The advantages of expanded deployment in development are that it often enables individual files to be updated without full redeployment”

JXPath

今天看到了Rod Johnson在他很久以前写的书上说, JXPath不错。 于是我去它的官方网站看了一下,确实很牛!看这一段就知道了! ====================================================== Address address = (Address)JXPathContext.newContext(vendor). getValue(“locations[address/zipCode=’90210′]/address”); This XPath expression is equivalent to the following Java code: Address address = null; Collection locations = vendor.getLocations(); Iterator it = locations.iterator(); while (it.hasNext()){ Location location = (Location)it.next(); String zipCode = location.getAddress().getZipCode(); if (zipCode.equals(“90210”)){ address = location.getAddress(); break; } }

[Rod Johnson] 集群环境下,修改Session数据后要立即rebind一下这个对象

原文说: "Thus, to ensure correct replication behavior, always rebind a session attribute when the session data is changed." 比如,假设session中现有这样一个对象    session.setAtrribute("employee", employee); 现在改变一下这个对象的值    employee.setName("Changed Name"); 那么当前服务器节点上, session.getAtrribute("employee").getName() 就自动变成了"Changed Name". 但是Cluster上的其他节点呢? 会不会自动更新? 不同的应用服务器有不同的实现。为了避免不一致的情况,应该在改变employee的值之后重新调用一下 session.setAtrribute("employee", employee),这样的话可以保证其它其他节点跟着一起更新,因为这是Servlet规范所规定的。

[Rod Johnson] O/R Mapping 的优点与缺点

优点:    1.程序员不用写SQL代码。写SQL很浪费时间的。    2.基于O/R Mapping可以实现domain object model 缺点:    1.complex deployment descriptors    2.reduced control over that access — 深有同感。我一向对半自动化的持久化持怀疑态度。一项数据在何时持久化,应该由程序员通过编码显式地控制。    3. 性能,尤其是批量删改的时候。    4. 迷信O/R Mapping的人往往会采用database-driven data modeling. 这会使object与relation的阻抗更大。