I don't understand the notion or appeal of result sets and business
objects.
A result set is just a collection of rows. In SQL-land we tend to think
of getting a bunch of rows from the db and then processing them, as
opposed to the RPG read/process/read approach. Neither is wrong or
right, just different. Anywhere there's a subfile the sql people would
think in terms of a result set. Order entry, item search, customer
lookup, etc.
As for business objects, their appeal (to me at least) is that you can
embed the business logic into them and not have to worry about it as the
consumer. Take something "simple" like item balances. How many rubber
chickens are available for sale? Well, is it the AvailQty bucket? Or is
it AvailQty-ReservedQty, or perhaps
AvailQty+InboundQty-ReservedQty-DamagedQty, or some other combination of
quantities. An item business object could have a property like
"AvailableForSale" which was the correct computed value, and everyone
would be singing the same tune. Can this be done w/out business objects?
Of course. But there's a big (programmer) performance gain in being able
to write:
Item x = Item.GetItem(12345);
int qtyForSale = x.AvailableForSale;
especially when you add in an intelligent IDE with intellisense (or
whatever RDi calls it) which will prompt you with the available options.
Also business obejects let us string together relations w/out having to
worry about how the relations are made, since the linkage is
encapsulated in the business object. For example:
Order o = Order.GetOrder(12345);
List<OrderLine> lines = o.GetLines(); //Here's a result set.
Foreach(OrderLine line in lines)
If(line.Item.AvailableQuantity > line.OrderedQuantity)
Print("Order {0}, Line {1} requested {2} of item {3} ({4}), only
{5} available!",
o.ID, line.ID, line.OrderedQuantity,
line.Item.ID, line.Item.Description,
line.Item.AvailableQuantity
);
In that example I walked from Order to the list of order lines, to the
items on each order w/out having to know a darn thing about how the
database was structured.
-Walden
--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com
Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.