Definitely easier for someone inheriting that code to see the business logic than direct calls to item values and view lookups.
Java has a handy notion called "Iterable": any class that claims to implement that feature can use a very terse looping syntax. So if you were writing these same classes in Java, and InvoiceCollection implemented Iterable, then this syntax:
if (customer.getInvoices().getCount() > 0) {
invoice = customer.getInvoices().getFirst();
while (invoice != null) {
// Do what you like here
invoice = customer.getInvoices().getNext();
}
}
...can be shortened all the way to:
for (Invoice invoice : customer.getInvoices()) {
// Do what you like here
}
It's like Forall in LotusScript without all the messy Variant side effects. :)
Definitely easier for someone inheriting that code to see the business logic than direct calls to item values and view lookups.
Java has a handy notion called "Iterable": any class that claims to implement that feature can use a very terse looping syntax. So if you were writing these same classes in Java, and InvoiceCollection implemented Iterable, then this syntax:
if (customer.getInvoices().getCount() > 0) {
invoice = customer.getInvoices().getFirst();
while (invoice != null) {
// Do what you like here
invoice = customer.getInvoices().getNext();
}
}
...can be shortened all the way to:
for (Invoice invoice : customer.getInvoices()) {
// Do what you like here
}
It's like Forall in LotusScript without all the messy Variant side effects. :)