best_practice.html
来自「比dwr更好的ajax框架,中国人写的.」· HTML 代码 · 共 151 行
HTML
151 行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Buffalo AJAX - Best Practice</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body class="composite">
<div id="banner">
<a href="index.html" id="bannerLeft">
<img src="images/buffalo-title.gif" alt="" />
</a>
<a href="http://sourceforge.net" id="bannerRight">
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=178867&type=1" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
Last Published: 10/08/2006
</div>
<div class="xright"> <a href="http://www.amowa.net/buffalo/zh">Chinese Docs</a>
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Quick Start</h5>
<ul>
<li class="none">
<a href="tutorial.html">1 Minute Tutorial</a>
</li>
<li class="none">
<a href="http://demo.amowa.net/buffalo-demo/">Demo</a>
</li>
<li class="none">
<a href="download.html">Download</a>
</li>
<li class="none">
<a href="features.html">Features</a>
</li>
<li class="none">
<a href="faq.html">FAQ</a>
</li>
</ul>
<h5>Mastering Buffalo</h5>
<ul>
<li class="none">
<strong>Best Practise</strong>
</li>
<li class="none">
<a href="howto.html">How to...</a>
</li>
</ul>
<h5>Reference</h5>
<ul>
<li class="none">
<a href="jsapi.html">JavaScript API</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section"><h2>Best Practice</h2><p>Here we have some best practice come from real projects. These practice suggest that do ajax in a *right* way. Please consider them in you project.</p><div class="section"><h3>Use DTO instead of domain object directly</h3><p>Most ORM tools bring us convenience especially dealing with object relationship. In a traditional java project, we can define a consistency domain model which can be used among the tiers. This is good even in a clustered application, because they in a same JVM and the inner state of object could be stored. But, in buffalo applications, you'd better not use this as it is *really* remote call. You should consider about the band width issue. </p><p>Let's take an example: userService.listUser, which will returns an user list, and at the same time, User have AddressInfo, have Roles, and may belongs to Department. in a traditional JSP programming, it's fine. But in buffalo, it's too bad. If you don't handle any of this situation, buffalo will try to serialize <b>every</b> property connected with this user, even the one to many, many to many reference data. That's a huge waste of time and band width as we don't need too much data to display.</p><p>So when desining buffalo service, please use DTO(or ViewHelper) to narrow the output for use on page only. </p></div><div class="section"><h3>Define the remoting service interface carefully</h3><p>Please desine the remoting service method really for remoting call. If a client start a remote call, the service should reply the enough infomation at once. The client need not call other method. </p></div><div class="section"><h3>Adopt the browser forward/back feature</h3><p>Many end users including me, are confused when a web application cannot use the browser foward/back button to navigate the view. A good example is google, and bad is...MSN Live Mail. From version 1.2, buffalo introduce this feature. Please consider adopting this feature to improve user experience. </p></div><div class="section"><h3>Design more interactive user interface</h3><p>This is a general requirement for all ajax products. When user click a button or link, you should provide a significant tip noticing user what is happenning. In traditional web development, those actions will cause a page refresh or page swtich. In ajax, you should provide more. </p></div><div class="section"><h3>In small/medium applications, adopt OPOA</h3><p><a href="http://michael.nona.name/archives/117">OPOA(Chinese)</a> defines a type of web application. Small, operation based applications always have less pages and require better interaction, such as mail application, system monitor etc. For these applications, you can use OPOA to simplify the development and provide better experience. </p></div><div class="section"><h3>For medium/large applications, use OPOA carefully</h3><p>Because the limitation of browser capacity, large applications (which has hundreds of views) that adopting OPOA find that CPU or memory is in a high usage after running for a while. For this case, you need split the whole system into modules if you still want to use OPOA. when user switch module, will really relocate to a new page so that the browser have a chance to clean memory and have a rest. </p></div></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">©
2004-2006
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?