The Artima Developer Community
Sponsored Link •

Design Forum
Defining Coarse & Fine Grained

1 reply on 1 page. Most recent reply: Dec 12, 2002 5:02 PM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Jeff Schneider

Posts: 7
Nickname: jeffs
Registered: Nov, 2002

Defining Coarse & Fine Grained Posted: Dec 2, 2002 3:25 PM
Reply to this message Reply
Advertisement
I was having a conversation with another developer when we discovered that we were not in agreement on what 'coarse' and 'fine' grained interfaces were. So now, I ask you!

Does the granularity deal with:
A. The number of network trips necessary to carry out some CRUD process.

B. The naming pattern for the interface itself (e.g. getEmployeeName vs. getEmployee)

C. The granularity of the information sent or returned from the call (e.g. Was the NAME field sent/returned or was the EMPLOYEE record returned)

D. Some combination of A, B & C (spell out which combo)

Before answering consider the following interfaces:
getEmployeeName(SSN) : returns Name field
getEmployee(SSN) : returns Employee record
get(Employee, Name, SSN) : returns Name field
do(get, Employee, Name, SSN) : returns Name field
do(string) : returns Name field
do(GetEmployeeCommand) : returns Employee record


Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Defining Coarse & Fine Grained Posted: Dec 12, 2002 5:02 PM
Reply to this message Reply
I like these :


A) Yes it can.
I think what you are dealing is the correct level of chattyness between the Client & the Server. Basically small calls like :
  public String getName ();
  public String getSurName ();
  public int getAge ();
are in the case of RMI or EJB better replace by
  public PersonnalDataVO getPersonnalData ();
A simple "record-like" structure will be returned.
Check the ValueObject Pattern.
The pattern improves performances drastically by reducing the Chattyness.


B) This is trivial & complex.
What is the name of the interface will be my answer ?
If the answer is EmployeeInfo, the second one should apply. But this is a coarse answer. Basically, you should also consider the fact the interface may be on Contract or something similar...
Hence, yes the naming convention will be impacted by the "coarsity" of the interface.

C) This is really a question of design. Ifyou are dealing with a networked application, the Employee should probably be returned...
More exactly the EmployeeVO should be returned... may be that EmployeeVO would only contain the name.

D) You could have those :
public interface EmployeeInfo
{
  public String getName (String anSSN);
  public String getSurname (String anSSN);
  public int getAge (String anSSN);
// For remote calls use ***only*** this one 
  public EmployeeVO getEmployee (String anSSN);
}


Does it help ?

Regards,

Thomas SMETS,
SCJP2 - Brussels

Flat View: This topic has 1 reply on 1 page
Topic: AOP Previous Topic   Next Topic Topic: Constructor

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use