⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib0040.html

📁 j2ee架构师手册
💻 HTML
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Turning Objects into Classes</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="LiB0039.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0041.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="193"></a><a name="ch06lev1sec2"></a>Turning Objects into Classes</h2><a name="194"></a><a name="IDX-75"></a>
<p class="para">Once you have identified major objects in the application, you need to refine those objects into classes and organize them in a framework.</p>
<p class="para">
<b class="bold">After identifying objects, you need to identify which layers they pertain to. </b>It is common for objects to have multiple roles. Any object you have identified as playing multiple roles (e.g., manage data access, implement business rules, etc.) must get counterparts in multiple layers. For example, <span class="fixed">ReportTemplate</span>, <span class="fixed">ReportTemplateParameter</span>, and <span class="fixed">ReportDataItem</span> from <a href="LiB0039.html#192" target="_parent" class="chapterjump">table 6.1</a> had persistence requirements as well as requirements as business objects. Therefore, they appeared as classes in at least the data access layer, the business object layer, and the value object layer.</p>
<p class="para">
<b class="bold">Define separate classes for each object in each layer.</b> If you define the same class for each of these roles, the classes get too large to effectively maintain and you lose all the benefits from software layering.</p>
<p class="last-para">From the object identification example, consider object <span class="fixed">ReportTemplate</span>. Class <span class="fixed">ReportTemplateDAO</span>, residing in the data access layer, was responsible for reading and writing template information using a relational database. <span class="fixed">ReportTemplateVO</span> in the value object layer described all characteristics of a report template (e.g., its name, data type, display length, etc.). <span class="fixed">ReportTemplateBus</span> in the business logic layer coordinated and enforced all rules for creating a new report template.</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="LiB0039.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0041.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 + -