the vast majority of java enterprise applications are architected along the lines of suns original petstore showcase application. rather than seeing this as a market stall displaying all the j2ee goods on offer, developers took it as a blueprint for enterprise applications. it certainly created a lot of work for java application developers (as well as systems administrators and systems integrators), but whether most of the applications needed most of the possible layers - including bean-managed persistence and the ubiquitous dao - is open for question at the very least. this article briefly describes some of the testability shortcomings of the traditional j2ee model and presents some alternatives.
the j2ee model
with j2ee we are tied to a single logical server in a client/server architecture, and any component such as a servlet or ejb has to be deployed to the server (potentially a time-consuming process) before we know whether it works. this makes it difficult to use test-driven techniques to develop these components. to make a small change to such a component requires a code change, a rec... 下一页