what is the difference between a data object and a business object?

thanks for any input
[27 byte] By [nizzails11a] at [2007-10-2 13:50:19]
# 1

Those are kind of crappy terms, but I can see what you are asking. A "data" object would be one that is completely stupid and exists only to hold, organize, and spit back data. Anything that implements Collections would be a good example.

A "business" object would be a proper object designed with OOD principles in mind, to serve a complex role. Any Swing component would be an example.

Drake

Drake_Duna at 2007-7-13 11:50:49 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
The year it was written?No seriously :) Nowadays we think of the difference being a data object is lower level object that helps with shuttling data around. A business object is higher level object that helps processing of data.
_dnoyeBa at 2007-7-13 11:50:49 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> Those are kind of crappy terms, but I can see what

> you are asking. A "data" object would be one that is

> completely stupid and exists only to hold, organize,

> and spit back data. Anything that implements

> Collections would be a good example.

>

Not sure I totally agree. If the OP had said DTO and BO, I think these are recognized terms. The former has only state and no behavior. (Think of a struct in C++). The latter has behavior and state. BO's are, IMO, 'true' objects. DTO's are really to transfer data between tiers or across machines when remoting.

> A "business" object would be a proper object designed

> with OOD principles in mind, to serve a complex role.

> Any Swing component would be an example.

>

What do you mean by 'component' in Swing? A UI widget? Listener? A true business object, IMO, would be something like:

class Account {

// State

private BigDecimal balance;

private User owner;

// Behavior

public void debit(final BigDecimalAmount)

throws NegativeAccountBalanceException {

// blah

}

public void credit(final BigDecimalAmount)

throws BouncedCheckException {

// blah

}

}

> Drake

- Saish

Saisha at 2007-7-13 11:50:49 > top of Java-index,Other Topics,Patterns & OO Design...