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
> 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