Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Design observation: value object Design pattern.

 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all;

my data access class called Data.java and implement DB.java interface, as you know the methods in the Data.java class is :

public String[] read(int recNo);
public int[] find(String[] crit);
....

after i end writting the Data.java class , i think to add another class in the same package suncertify.db that wrap the method in the Data class by
using value object design pattern as this:
public Contractor read(int recNo);
public LinkedList<Contracotr> find(String[] crit);
...

note that this DataWrapper class differ about the class that provide business logic to client.

i thought that when i design the application as this the application we depends on the actual name and number of the db table field so also i generator my field name and size dynamic but in the future any change on the db file field number will make the application change as well.

Two point:
1- don't use Value object Design pattern, just use String array.
2 use Value object Design pattern, that provide efficient and more OOD, but make that application more coupling.

my thought is :
in the real live db application , the programmer know in advance the
table structure, and he develop application depends on this structure, and
any change in the future the develop must alter his application.
it is normal case in our live.
ex : JDBC also provide meta information , but now programmer use it, he
use hardcoded table column and build a beans for each row in the table.
so
I WILL USE VALUE OBJECT DESIGN PATTERN IN MY APPLICATION.

What you thoughts ....

m_darim
SCJP, SCJD B&S in progress ... may be finish in 1/6/2008
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think it is a good idea!
I did not do that, the only reason being "simplicity" is one of the main factor. But now that I'm finished (will submitted pretty soon..1-2 weeks), I think he might have been a nice design..

I handle the conversion at my business layer.

Regards,
Alex
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic