Chinaunix首页 | 论坛 | 博客
  • 博客访问: 590427
  • 博文数量: 155
  • 博客积分: 7055
  • 博客等级: 少将
  • 技术积分: 1700
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-22 11:40
文章分类

全部博文(155)

文章存档

2016年(1)

2011年(2)

2010年(1)

2009年(2)

2008年(9)

2007年(39)

2006年(58)

2005年(38)

2004年(5)

我的朋友

分类: Java

2007-03-07 11:59:21

//070307
Application development and maintenance are much easier if the different components of a web application have clear and distinct responsibilities.
开发和维护会变得简单,当将一个网络应用分解成清楚和明确的功能部分后。
打一个比方,单独一个人可以注册一个小公司,然后他接待客户,根据客户需求完成方案,取得收益。一个人做所有事情。
但是这样他会很累,而且当公司慢慢往大发展了,他肯定是要
找一个前台,专门负责接待客户。
找一个技术,专门负责按照客户需求完成方案。
找一个账务,专门负责公司收支。等等。

The views within the web tier MVC pattern typically consist of HTML and JSP pages.
You easily can support WML, for example, instead of HTML. Because the view is decoupled from the model, you can support multiple views, each for a different client type, using the same model components.
The controller portion of the web tier MVC design generally is a Java servlet.
MVC pattern里的View 可以包括HTML,JSP页面,可以很容易支持WML。因为View 从Model里分离出来了,你可以为一个Model设计多个Views。
MVC里的Controller通常就是一个java servlet。

为了实现MVC架构,struts提供了:ActionForm、Tag Library(这些属于View部分),Action (Controller部分)

===
Generally a framework exists to take care of common tasks, reduce boilerplate code, and solve complex architectural challenges.
Fabrizio Gianneschi found that iBATIS reduced the amount of code in the persistence layer by a significant 62 percent. This savings was primarily due to the fact that no JDBC code had to be written. The SQL was still handcoded,
一个framework存在的目的,就是省去人们花在常规性任务、样板性代码上的精力,应对更复杂结构体系的挑战。
某人发现使用ibatis,可使 persistence layer 减少60%的代码。主要是由于不需要写JDBC代码了。SQL仍然是hardcoded的

At the time of this writing, iBATIS supports the three most popular development platforms: Java, Ruby, and C# for Microsoft .NET.

Applications often need to access data from multiple data sources: relational databases, file systems, directory services, web services, and other providers.
Each of these data stores has a different API to access the underlying storage mechanism, along with a whole set of idiosyncrasies.
The Data Access Object (DAO) pattern is used to hide the unique implementation quirks of these APIs. It provides a simple and common API for application developers so that the consumers of the data can be free of the complexities of the data access APIs.
The DAO pattern is all about hiding the data access implementations behind interfaces, but you still have to build the underlying implementations.
DAO pattern 封装不同的DataSource的访问API,提供一个统一的API。
当然,封装如何去实现,是你要做的。

举个例子:
the JDBC API in Java is a good example of the DAO pattern in action.


ref:
programming jakarta struts
ibatis in action


阅读(1299) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~