Assembling Values into Composite Objects, Part 1
The problem -- or at least the engineering challenge -- with business
logic is that it's frequently not tidy. A single piece of business
information may derive from a calculation involving many subsidiary
values.
Corporate earnings, to cite an example of apparently little importance
to American public companies these days, can be derived from (among
other things) gross revenue, gross expenses, taxes paid, depreciation of
assets, and amortization of capital expenditures. Those component values
likely exist in your computing environment as distinct objects, which in
turn come from different database tables. If your job is to deliver an
earnings number to a software client, then you have a complicated task
at hand.
You can realize a bit of an efficiency increase by doing your "object
gathering" on the business logic tier, rather than expecting your client
to make a bunch of queries. You run a couple of risks, namely:
* The information in the aggregate object at the business tier
becomes obsolete, or,
* You make just as many queries to the back end from the business
logic layer as you would from the presentation layer.
Even if the latter drawback is the case in your system, you'll still
probably better off than you would be by doing the queries from the
client; the bandwidth between the business logic layer and the back end
is (probably) very high, and the latency there is likely low.
This sort of design is used for all kinds of problems, and is,
therefore, called a software pattern. Specifically, it's called a value
object aggregator, or value object assembler.
Before we build our value object aggregator class, we need to establish
some value objects to aggregate. A typical value object looks (in part)
like this:
public class ExpenseVO {
public Date expenseDate;
public Double expenseTotal;
public ExpenseVO (Date expenseDate, Double expenseTotal) {
this.expenseDate = expenseDate;
this.expenseTotal= expenseTotal;
}
}
How do we stitch value objects like this one into a more useful whole?
That's the subject of next week's installment.
» posted by ITworld staff
ITworld
Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.
Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.
Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.
VMware ESX Server in the Enterprise
By Edward L. Haletky
Published Dec 29, 2007 by Prentice Hall.
Enter now! | Official rules | Sample chapter
Green IT
By Toby Velte, Anthony Velte, Robert C. Elsenpeter
To be published Oct. 10, 2008 by McGraw Hill Professional
Enter now! | Official rules | About the book







