?? lib0044.html
字號:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Shortcuts</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0043.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0045.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch06"></a>
<div class="section">
<h2 class="first-section-title"><a name="207"></a><a name="ch06lev1sec6"></a>Shortcuts</h2><p class="first-para">Over the years, I've adopted several shortcuts that decrease the time and effort required in the object-modeling phase.</p>
<p class="para">
<b class="bold">Document deployment wrappers as one class.</b> How deployment wrappers (e.g., session beans) are structured is standard, and there is no value in documenting it repeatedly. For example, model an EJB as one class instead of breaking it up into its three or four component parts that all have the same signatures anyway.</p>
<p class="para">
<b class="bold">Assume that all documented attributes will have of accessors (get methods) and mutators (set methods).</b> This simplifies the model and eliminates <a name="208"></a><a name="IDX-80"></a>a lot of boring busywork. It also makes the model easier to read and thus more useful. For example, if you document that a <span class="fixed">CustomerVO</span> class has a <span class="fixed">lastName</span> attribute, you should be able to assume the existence of <span class="fixed">getFirstName()</span> and <span class="fixed">setFirstName()</span> methods without explicitly documenting them in the model.</p>
<p class="para">
<b class="bold">Omit relationships to objects in the JDK.</b> Including these relationships adds little value but a lot of complexity, making the model hard to read. For example, many attributes in the JDK are strings. Technically, any class containing a string attribute should have a relationship to the <span class="fixed">java.lang.String</span> class. In a typical application, documenting these types of relationships would add hundreds or thousands of relationships to your model and provide no benefit.</p>
<p class="para">
<b class="bold">Forget about generating code from UML.</b> My experience is that it's usually a net time loss. The minute level of detail you have to type in the model usually exceeds the time it would take to code it using any integrated development <a name="209"></a><a name="IDX-81"></a>environment (IDE). On the other hand, generating UML from existing code can be an extremely valuable and easy to do if your IDE supports it.</p>
<p class="last-para">
<b class="bold">Don't attempt to micromanage the coding when determining methods. </b>Leave some work to the developer. If the development team starts documenting private methods, it's going too far.</p>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0043.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0045.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -