Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Need feedback on design approach

Need feedback on design approach

2004-08-20       - By Prasanna Kumar B.P[SLK/IND]

 Back
Reply:     1     2  

All,
This mail is too lengthy. Sorry for that.

I need your suggestions/feedback on the below design approaches.

Requirement: Employee details need to be created and displayed in  a system.
An Employee can
1. have multiple addresses(home, communication etc)
2. belong to a department
3. have multiple dependents

For the above requirements design approach could be

Process 1: Create Employee
-- ---- ---- ---- ---- ---- ----
Design#1: Create a DAO class EmployeeDAO that will have methods like
a) addEmployee(emp_id)
b) addAddress(Address,type)
c) addDepatment(department)
d) addDependent(dep_name[])

 This DAO will be called by my BO/SF repeatedly to create an employee.

Design#2:Create a DAO class EmployeeDAO that will have only ONE method
taking all details as parameters
addEmployee(emp_id, department, dep_name[], Address[] )

This addEmployee() will call a stored procedure to create ENTIRE employee
details, passing entire employee details as Arrays.


Process 2: Get entire employee details to diplay on screen
-- ---- ---- ---- ---- ---- ---- ---- -----
Design 1: EmployeeDAO will have methods like
a) getEmployeeName(emp_id)
b) getEmployeeAddress(emp_id)
c) getDepartment(emp_id)
d) getDependants(emp_id)

  This DAO will be called by my BO/SF repeatedly to to construct DTO object
containing entire employee information.

Design 2: EmployeeDAO will have only one method getEmployeeDetails() which
returns DTO containing entire employee detail. This method in turn will call
a stored procedure which returns multiple cursors containing employee
information.


Now, What do you feel ? Which approach is correct ? Please consider
maintainability and performance also into consideration.

Thanks in advance,
Prasanna
-- ---- ---- ---- ---- ---- ----





====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">


<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Tahoma><FONT size=2>All,<BR>This mail is too lengthy. Sorry for
that.<SPAN class=205133212-20082004>&nbsp;</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>I need your suggestions/feedback on the below
design approaches. </FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><STRONG>Requirement</STRONG>: Employee details
need to be&nbsp;<SPAN class=205133212-20082004>created and </SPAN>displayed
in&nbsp; a system. An Employee can <BR>1. have multiple addresses(home,
communication etc) <BR>2. belong to a department<BR>3. have&nbsp;<SPAN
class=205133212-20082004>multiple </SPAN>dependents </FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>For the above requirements design approach could
be </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><STRONG>Process 1: Create
Employee<BR></STRONG>-- ---- ---- ---- ---- ---- ----<BR><STRONG>Design#1<
/STRONG>:
Create a DAO class EmployeeDAO that will have methods like<BR>&nbsp;a)
addEmployee(emp_id)<BR>&nbsp;b) addAddress(Address,type)<BR>&nbsp;c)
addDepatment(department)<BR>&nbsp;d)
addDependent(dep_name[])<BR>&nbsp;<BR>&nbsp; This DAO will be called by my BO
/SF
repeatedly to create an employee.&nbsp;</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><STRONG>Design#2</STRONG>:Create a DAO class
EmployeeDAO that will have only ONE method&nbsp;<SPAN
class=205133212-20082004>taking all details as
parameters</SPAN><BR>&nbsp;addEmployee(emp_id, department, dep_name[], Address[
]
)</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;This addEmployee() will call a stored
procedure to create ENTIRE employee details, passing entire employee details as
Arrays.<BR>&nbsp;<BR>&nbsp;<BR><STRONG>Process 2:&nbsp;<SPAN
class=205133212-20082004>Get </SPAN>entire employee details<SPAN
class=205133212-20082004> to diplay on
screen</SPAN></STRONG><BR>-- ---- ---- ---- ---- ---- ---- ---- -----<BR>
<STRONG>Design
1</STRONG>: EmployeeDAO will have methods like<BR>&nbsp;a)
getEmployeeName(emp_id)<BR>&nbsp;b) getEmployeeAddress(emp_id)<BR>&nbsp;c)
getDepartment(emp_id)<BR>&nbsp;d) getDependants(emp_id)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp; This DAO will be called by my BO/SF
repeatedly to to construct DTO object containing entire employee
information.<BR>&nbsp;<BR><STRONG>Design 2</STRONG>: EmployeeDAO will have only
one method getEmployeeDetails() which returns DTO containing entire employee
detail. <STRONG>This method in turn will call a stored procedure which returns
multiple cursors containing employee information</STRONG>.</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><BR><FONT face=Tahoma size=2>Now, What do you feel ? Which approach is
correct ? Please consider maintainability and performance also into
consideration.</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=205133212-20082004></SPAN><FONT face=Tahoma size=2>T<SPAN
class=205133212-20082004>hanks in advance,</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=205133212-20082004>Prasanna</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=205133212-20082004>-- ---- ---- ---- ---- ---- ----</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=205133212-20082004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=205133212-20082004></SPAN>&nbsp;</DIV>
<DIV><BR>&nbsp;</FONT></DIV></BODY></HTML>
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.