Computer Programming
In Design Patterns, an aggregate is not a design pattern but rather refers to an object such as a list, vector, or generator which provides an interface for creating iterators. The following example code is in Python.
mylist = for item in mylist: print "Mom, we're out of " + item + "!" def fibonacci(n): a,b = 0,1 count = 0 while count < n: count += 1 a,b = b, a+b yield a for x in fibonacci(10): print x def fibsum(n): total = 0 for x in fibonacci(n): total += x return total def fibsum_alt(n): """ Alternate implementation. demonstration that Python's built-in function sum works with arbitrary iterators """ return sum(fibonacci(n)) myNumbers = def average(g): return float(sum(g))/len(g) #in Python 3.0 the cast to float will no longer be necessaryPython hides essentially all of the details using the iterator protocol. Confusingly, Design Patterns uses "aggregate" to refer to the blank in the code for x in ___:
which is unrelated to the term "aggregation". Neither of these terms refer to the statistical aggregation of data such as the act of adding up the Fibonacci sequence or taking the average of a list of numbers.
Read more about this topic: Aggregate Pattern
Famous quotes containing the words computer and/or programming:
“The computer takes up where psychoanalysis left off. It takes the ideas of a decentered self and makes it more concrete by modeling mind as a multiprocessing machine.”
—Sherry Turkle (b. 1948)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)